Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAYA-122218 showing dactivated children #2265

Merged
merged 14 commits into from
Apr 22, 2022

Conversation

pierrebai-adsk
Copy link
Collaborator

Some code paths were ignoring deactivated children when they should not because hasChildren() was ignoring deactivated children.

Some code paths were ignoring deactivated children when they should not because hasChildren() was ignoring deactivated children.
@seando-adsk
Copy link
Collaborator

I'm not sure it is that simple. Did you look at the history of this file (and the pulledObjectHierarchy)? We (Krystian and I) have modified this code a few times to fix different bugs. Did you test that those scenarios (from prior bugs) are still fixed with these changes?

Reverted the children behaviour to not return deactivated items. Only made hasChildren() consider deactivated children.
@pierrebai-adsk
Copy link
Collaborator Author

pierrebai-adsk commented Apr 7, 2022

I looked at the most recent changes through git file history, like MAYA 113820 and MAYA-121568

Proxy shape has duplicated code that also need the fix.
Also put back in place the old code form in children() to minimize the diff.
Maya 2022 desctivate the prim when deleting, but 2023 and later permanently deletes them.
@pierrebai-adsk
Copy link
Collaborator Author

Only failure is the PF on OSX python 2 Maya 2020 failed to launch, but all others passed.

@pierrebai-adsk
Copy link
Collaborator Author

Th eonyl PF failure is the OSX python build that constantly fails to start.

@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Apr 12, 2022
# The proxy shape should now have no UFE child items (since we skip inactive)
# but hasChildren still reports true for inactive to allow the caller to then
# do conditional inactive filtering.
if mayaUtils.mayaMajorVersion() >= 2023:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused why this check is against a Maya version. What change is there in Maya that is affecting this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused as to why we changed the test at all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behaviour of the delete command vs prim changed from deactibvating to really deleting. When deactivated, hasChildren() returns true.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay then instead of using then the Maya test should also surround lines 363 (which does the delete) and the comment you wrote here should be added to the test. Then for Maya 2023 we should not use delete, but instead deactivate the prim.

seando-adsk
seando-adsk previously approved these changes Apr 12, 2022
lib/mayaUsd/ufe/ProxyShapeHierarchy.cpp Show resolved Hide resolved
# The proxy shape should now have no UFE child items (since we skip inactive)
# but hasChildren still reports true for inactive to allow the caller to then
# do conditional inactive filtering.
if mayaUtils.mayaMajorVersion() >= 2023:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused as to why we changed the test at all.

@pierrebai-adsk pierrebai-adsk added do-not-merge-yet Development is not finished, PR not ready for merge and removed ready-for-merge Development process is finished, PR is ready for merge labels Apr 13, 2022
@@ -133,6 +133,8 @@ const UsdPrim& ProxyShapeHierarchy::getUsdRootPrim() const

Ufe::SceneItem::Ptr ProxyShapeHierarchy::sceneItem() const { return fItem; }

#if defined(UFE_V4_FEATURES_AVAILABLE) && (UFE_MINOR_VERSION > 4 || UFE_PATCH_LEVEL > 3)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just use a single test like this:

Suggested change
#if defined(UFE_V4_FEATURES_AVAILABLE) && (UFE_MINOR_VERSION > 4 || UFE_PATCH_LEVEL > 3)
#if (UFE_PREVIEW_VERSION_NUM >= 4004)

#if defined(UFE_V4_FEATURES_AVAILABLE) && (UFE_MINOR_VERSION > 4 || UFE_PATCH_LEVEL > 3)
bool hasFilteredChildren(const ChildFilter&) const override;
#endif
UFE_V2(Ufe::SceneItemList filteredChildren(const ChildFilter&) const override;)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add the UFE_V2 here? It is not needed as this file is only included in Ufe v3

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I did not realize it the entire file was already a UFE-3 only. It's just that other headers implementing the same interface had this UFE_V2 conditional, so I thought it was missing in this one. I got confused by the fact some implementations of the UFE Hierarchy interface use the UFE_V2 macro, others don't.

# The proxy shape should now have no UFE child items (since we skip inactive)
# but hasChildren still reports true for inactive to allow the caller to then
# do conditional inactive filtering.
if mayaUtils.mayaMajorVersion() >= 2023:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay then instead of using then the Maya test should also surround lines 363 (which does the delete) and the comment you wrote here should be added to the test. Then for Maya 2023 we should not use delete, but instead deactivate the prim.

@@ -92,7 +92,7 @@ def testFilteredChildren(self):
ball3Prim = mayaUsd.ufe.ufePathToPrim(ball3PathStr)
ball3Prim.SetActive(False)

# Props should now have 5 children and ball3 should not be one of them.
# Props children should have 5 children and ball3 should not be one of them.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove "now". The comment was correct. At line 84 we test that there are 6 children and now we are testing that there are 5.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took multiple passes to update the test and did not realized I dropped a word there.

- Simplified the #if used to detect the UFE version.
- Removed the UFE_V2 that was not needed.
- Simplified the test.
bool PulledObjectHierarchy::hasChildren() const { return _mayaHierarchy->hasChildren(); }

Ufe::SceneItemList PulledObjectHierarchy::children() const { return _mayaHierarchy->children(); }

#ifdef UFE_V2_FEATURES_AVAILABLE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire file is UFE v3 (in CMakeLists.txt), so this ifdef is redundant.

@@ -358,17 +358,20 @@ def testAddNewPrimWithDelete(self):
self.assertEqual(len(proxyShapehier.children()), 1)

# Using UFE, delete this new prim (which doesn't actually delete it but
# instead makes it inactive).
# instead makes it inactive). In Maya 2023 and vreater, delete really
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"vreater" --> "greater"

item = usdUtils.getPrimFromSceneItem(ufeItem)
item.SetActive(False)
else:
cmds.delete()

# The proxy shape should now have no UFE child items (since we skip inactive)
# but hasChildren still reports true for inactive to allow the caller to then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment and code don't match.

- Removed redundant conditional compilation.
- Fix context ops test to account for different behavior in different versions.
The behavior of hasChildren is based on the UFE version, not the Maya version, unlike the behaviour of cmds.delete.
@@ -105,3 +105,26 @@ def ufeFeatureSetVersion():
# v0.2.20 (unreleased preview version 2).
major = ufe.VersionInfo.getMajorVersion()
return ufe.VersionInfo.getMinorVersion() if major == 0 else major

def hasMinimumVersion(releaseVersions, unreleasedVersions):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need this. See
https://github.com/Autodesk/maya-usd/pull/2096/files
on the approach we've chosen: we use the Maya preview release version and the UFE preview version to determine whether code should be compiled and tests run. Then, when the next Maya preview release is released, we clean up ALL the preview release and UFE preview release conditions we're put in, and replace them with UFE feature set version checks.

This cleans up the code one preview release at a time so that we don't leave old unreleased version checks in the files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I till need to differentiate between 0.4.3 and 0.4.4 though, so I'll test that only intstead.

Comment on lines 373 to 381
# The proxy shape should now have no UFE child items (since we skip inactive
# when returning the children list) but hasChildren still reports true in
# UFE version before 0.4.4 for inactive to allow the caller to do conditional
# inactive filtering, so we test that hasChildren is true for those versions.
ufeVersion = ufeUtils.fullVersion()
if (0, 4, 4) <= ufeVersion < (1, 0, 0):
self.assertFalse(proxyShapehier.hasChildren())
else:
self.assertTrue(proxyShapehier.hasChildren())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have been doing this in a different way that allows us to find and remove these checks at a later date when a new Maya PR ships. Once the Maya PR ships with this new Ufe 0.4.x version we don't need a test on the specific Ufe version anymore - just a check against Ufe v4 is okay. So to find them we always use either the existing ufeFeatureSetVersion function or UFE_PREVIEW_VERSION_NUM and fix/remove them. So I think your test should be something like:
if (os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') > '4004'):
This cmake variable is also set as an env var for all these Ufe tests.

Comment on lines 109 to 118
def fullVersion():
'''
Return the full UFE version as a tuple of (major, minor, patch),
so for example:
(0, 4, 4)
'''
major = ufe.VersionInfo.getMajorVersion()
minor = ufe.VersionInfo.getMinorVersion()
patch = ufe.VersionInfo.getPatchLevel()
return (major, minor, patch)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be needed.

@pierrebai-adsk
Copy link
Collaborator Author

The pm;y failure was on Windows 2020 python 2 where a schema test timed out for unknown reason. The test is entirely unrelated to my changes.

@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Apr 21, 2022
@seando-adsk seando-adsk merged commit 37e43b8 into dev Apr 22, 2022
@seando-adsk seando-adsk deleted the t_bailp/MAYA-122218/cancel-edit-break-stage branch April 22, 2022 13:29
@seando-adsk seando-adsk added the ufe-usd Related to UFE-USD plugin in Maya-Usd label Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge ufe-usd Related to UFE-USD plugin in Maya-Usd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants