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

Fix orphaned node discard edits with unloaded ancestor. #2638

Merged
merged 1 commit into from
Oct 6, 2022

Conversation

ppt-adsk
Copy link
Collaborator

@ppt-adsk ppt-adsk commented Oct 3, 2022

As per MAYA-123378, discarding edits on an orphaned Maya node whose USD ancestor is unloaded causes an error.

Added a unit test for this case. Without the fix, the test fails, with the fix, the test succeeds.

// layer stored as overs, the usdPrim will never be invalid: a prim that
// exists only because of over opinions is valid, but is typeless.
// Therefore, the conditional will always succeed, and
// discardOrphanedEdits() is never called. PPT, 30-Sep-2022.
auto ret = usdPrim ? discardPrimEdits(pulledPath) : discardOrphanedEdits(dagPath, pulledPath);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is very uncomfortable: before the fix, discardOrphanedEdits() was never called. However, the fix requires UFE support.

if(CMAKE_UFE_V3_FEATURES_AVAILABLE)
set(TEST_DISCARD_EDITS testDiscardEdits.py)
mayaUsd_get_unittest_target(target ${TEST_DISCARD_EDITS})
if(UFE_TRIE_NODE_HAS_CHILDREN_COMPONENTS_ACCESSOR)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Enable test for orphaned node discard edits on ancestor unload only if UFE support is present.

// layer stored as overs, the usdPrim will never be invalid: a prim that
// exists only because of over opinions is valid, but is typeless.
// Therefore, the conditional will always succeed, and
// discardOrphanedEdits() is never called. PPT, 30-Sep-2022.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we check if it is typeless? Would that help?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That feels weak... And yet another code path to support and test. My hope is that since the required UFE support in Maya is coming very shortly on all Maya versions where this matters (UFE v3 and up), that we simply remove this broken code path soon. Thanks for the thought, though.

}
TF_VERIFY(trieNode->hasData());
// If the pull parent is visible, the pulled path is not orphaned.
return !getVisibilityPlug(trieNode);
Copy link
Collaborator

Choose a reason for hiding this comment

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

The only caveat I see with this approach, which we may not want to support, is: what if the user has set the node invisible by hand for whatever reason? Here we take for granted that invisible means orphaned.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you touch the pull parent, which by default is not visible in the Outliner, you're voiding your warranty... So yes, invisible pull parent means orphaned.

Copy link
Collaborator

@pierrebai-adsk pierrebai-adsk left a comment

Choose a reason for hiding this comment

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

Aside for a few interrogations, this looks fine.

@seando-adsk seando-adsk added the workflows Related to in-context workflows label Oct 6, 2022
@seando-adsk seando-adsk merged commit adefb9e into dev Oct 6, 2022
@seando-adsk seando-adsk deleted the tremblp/MAYA-123378/fix_discard_edits_error branch October 6, 2022 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workflows Related to in-context workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants