-
Notifications
You must be signed in to change notification settings - Fork 201
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
Fix reparenting/renaming of pulled objects USD ancestor #3861
Fix reparenting/renaming of pulled objects USD ancestor #3861
Conversation
Adds `unparentItems` to correctly un-parent a UFE child from its parent. - Disconnects the parent source attributes. - Resets `offsetParentMatrix` and `lodVisibility` to their defaults. - Removes proxyAccessor outputs that are not in use anymore. Introduces a `force` flag to proxyAccessor.parent. - When enabled, the child will be correctly unparented before being re-parented. - When disabled, by default, the action will issue an error, as before.
… reusable `OpUndoItem`.
…S_MANAGER. However, continue skipping `testReparentAncestorOfEditAsMaya` as it still fails even with orphanedNodesManager.
…after reparenting/renaming its USD ancestors. The proxyAccessor parenting connection was not updated with the new USD parent. The pulled maya object was still inheriting the old USD parent xform and visibility.
…correctly handles visibility and xform.
@jufrantz Thanks for the PR. We will discuss internally and get it reviewed. In the meantime, I also noticed that the Can you try re-enabling the test and adding this code to see if it fixes that test. index 030e780ad..61b07ce62 100644
--- a/test/lib/mayaUsd/fileio/testEditAsMaya.py
+++ b/test/lib/mayaUsd/fileio/testEditAsMaya.py
@@ -152,11 +152,18 @@ class EditAsMayaTestCase(unittest.TestCase):
# Note: the parent command changes the selection, so preserve and restore it.
selToPreserve = ufe.GlobalSelection.get().front()
+ self.assertTrue(mayaUsd.lib.PrimUpdaterManager.discardEdits("A"))
cmds.parent("stage1", locName)
ufe.GlobalSelection.get().clear()
ufe.GlobalSelection.get().append(selToPreserve)
+ # Edit "A" Prim as Maya data.
aUsdUfePathStr = "|" + locName + aUsdUfePathStr
+ with mayaUsd.lib.OpUndoItemList():
+ self.assertTrue(mayaUsd.lib.PrimUpdaterManager.canEditAsMaya(aUsdUfePathStr))
+ self.assertTrue(mayaUsd.lib.PrimUpdaterManager.editAsMaya(aUsdUfePathStr))
+ validateEditAsMayaMetadata()
+
validateEditAsMayaMetadata() Thanks, Sean |
Worked like a charm, added 2dfdf46. |
@@ -244,6 +253,50 @@ def connectParentChildAttr(parentAttr, childDagPath, attrName, connect): | |||
else: | |||
cmds.disconnectAttr(parentAttr, childAttr) | |||
|
|||
def unparentItems(ufeChildren): |
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 not knowledgeable on proxy accessor, so I'll assume all this is fine :)
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.
Great work!
@jufrantz I ran the preflight for you and unfortunately it failed during testing
|
Thank you @seando-adsk and @pierrebai-adsk for the review. I retested on my end, did a clean checkout of the branch, and ran build.py with
There may be something in my environment or workflow causing this discrepancy. This is quite suspicious! I will investigate further to try to reproduce the preflight failures. If you have any insights, I will greatly appreciate them. |
One thing I noticed is that for your testing you are using USD v23.11 for both your tests with Maya 2023 and 2024. In our preflight we use USD v21.11 for Maya 2023 and USD v22.11 with Maya 2024. Not sure if that makes a difference. We include the full USD build in our MayaUsd installers, so you can build with that (first extracting devkit.zip). That way you'll exactly match our internal builds. Sean |
OK thanks. I built using USD extracted from mayausd-0.29 release packages. Unfortunately, |
I have a strong lead. After syncing my branch with Autodesk/dev, I’m now encountering the same test failure, which suggests that the combined changes might not work together. |
Yes, preflight merges your branch against latest dev. |
Hello @seando-adsk, It appears that the reason for the failure is very likeky an unrelated issue in Autodesk/dev, which has been occurring since PR #3881, commit b9d928d. The new zealous testEditAsMaya case fails when verifying that the edited Maya worldspace xform matches USD, right after the editAsMaya operation. The pulled transform has Here is the current behaviour in dev: And a scripted repro: import maya.cmds
import mayaUsd.ufe
import mayaUsd_createStageWithNewLayer
maya.cmds.loadPlugin("mayaUsdPlugin", quiet=True)
proxyShape = mayaUsd_createStageWithNewLayer.createStageWithNewLayer()
shapeStage = mayaUsd.ufe.getStage(proxyShape)
shapeStage.GetRootLayer().ImportFromString('''#sdf 1
def Xform "transform1"
{
double3 xformOp:translate = (0, 10, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
def Mesh "pCube1"
{
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [0, 1, 3, 2, 2, 3, 5, 4, 4, 5, 7, 6, 6, 7, 1, 0, 1, 7, 5, 3, 6, 0, 2, 4]
point3f[] points = [(-1, -1, 1), (1, -1, 1), (-1, 1, 1), (1, 1, 1), (-1, 1, -1), (1, 1, -1), (-1, -1, -1), (1, -1, -1)]
}
}
''')
maya.cmds.mayaUsdEditAsMaya("|stage1|stageShape1,/transform1") If this issue is confirmed, we'll need to wait for it to be fixed before this PR can pass all checks. Please let me know if there’s anything else I can do. Cheers, |
Hi @jufrantz , thank you for your investigation. I'm taking a look at that change |
@samuelliu-adsk @seando-adsk, |
@seando-adsk, |
@jufrantz Unfortunately it was too late for the v0.30 release, as we had already locked that one down. But as you can see I have merged this PR now so it should be in our next release after v0.30. |
No problem for us, we'll patch v0.30 on our side. Thank you for the information. |
Hello,
This PR addresses an issue where pulled Maya objects transform and visibility were disconnected from the USD stages after renaming or reparenting a USD ancestor of the pulled prim. Our artists very frequently have multiple pulled objects in the same stage while re-structuring the hierarchy.
Before this fix:
Ater this fix:
Changes included in this PR:
mayaUsd.lib.proxyAccessor
, ensuring it does not leave disconnected proxyAccessor outputs, potentially accessing invalid prims: a25dcd6 and unit-test 415dcb6.PrimUpdaterManager
to mutualize themayaUsd.lib.proxyAccessor.parent
python call: dc89563.OrphanedNodeManager
, following thepullInformation
update: 2969283.HAS_ORPHANED_NODES_MANAGER
env to add a unit test in testEditAsMaya.py. Disabled a failing test. It was failing without my changes with Maya2023 + USD-23.11 and Maya2024 + USD-23.11. The CMake/test changes: 243eecd. The new test: 1a93630.--
Julien