-
Notifications
You must be signed in to change notification settings - Fork 202
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
MAYA-122218 showing dactivated children #2265
Conversation
Some code paths were ignoring deactivated children when they should not because hasChildren() was ignoring deactivated children.
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.
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.
Only failure is the PF on OSX python 2 Maya 2020 failed to launch, but all others passed. |
Th eonyl PF failure is the OSX python build that constantly fails to start. |
# 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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
# 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: |
There was a problem hiding this comment.
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.
Need to detect patch level 4.
@@ -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) |
There was a problem hiding this comment.
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:
#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;) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
test/lib/ufe/testChildFilter.py
Outdated
@@ -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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
test/lib/ufe/testContextOps.py
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"vreater" --> "greater"
test/lib/ufe/testContextOps.py
Outdated
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 |
There was a problem hiding this comment.
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.
…ust 2023.1 that really deletes.
test/testUtils/ufeUtils.py
Outdated
@@ -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): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
test/lib/ufe/testContextOps.py
Outdated
# 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()) |
There was a problem hiding this comment.
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.
test/testUtils/ufeUtils.py
Outdated
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) |
There was a problem hiding this comment.
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.
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. |
Some code paths were ignoring deactivated children when they should not because hasChildren() was ignoring deactivated children.