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

LOOKDEVX-1592 - Clean up references, targets, and connections on delete #3194

Merged

Conversation

JGamache-autodesk
Copy link
Collaborator

Similar to what is done on Rename, we traverse the scene and clean up any reference, target, or connection that will become invalid once the prim is removed.

Similar to what is done on Rename, we traverse the scene and clean up any
reference, target, or connection that will become invalid once the prim
is removed.
@JGamache-autodesk JGamache-autodesk added ufe-usd Related to UFE-USD plugin in Maya-Usd workflows Related to in-context workflows labels Jul 4, 2023
const SdfReferencesProxy& referencesList,
SdfListOpType op)
{
// set the listProxy based on the SdfListOpType
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 file, please always compare with the function just above the new one to see the difference between cleaning up and renaming.

prepend apiSchemas = ["MaterialBindingAPI"]
)
{
rel material:binding = </mtl/BrownMat>
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 material will be propagated to all children.

prepend apiSchemas = ["MaterialBindingAPI"]
)
{
rel material:binding = </mtlFoliage/GreenMat>
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 material wins over the parent material.

SdfReferencesProxy referencesList = primSpec->GetReferenceList();

// update append/prepend lists individually
removeInternalReferencePath(deletedPrim, referencesList, SdfListOpTypeAppended);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Even in the previously-existing version for rename, IDK why we don't treat the SdfListOpTypeOrdered, SdfListOpTypeAdded, SdfListOpTypeExplicit and SdfListOpTypeDeleted. MayaUSd might not author those, but we can edit USD file that may contain them.

# Ref2 has an "external" reference, but to this file. It will not be
# cleaned up because external, baut maybe it should have since the
# referenced file happens to be the root layer?
self.assertTrue(stage.GetPrimAtPath('/TreeBase/leaf_ref_2').HasAuthoredReferences())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed, might be good to file a story to improve this, along with my comments about other list ops.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also small typo baut -> but, no need to respin teh PR just for that in a unit test though

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.

LGTM, but I think we have ground to create a story about improving the code further in the future.

@JGamache-autodesk
Copy link
Collaborator Author

Thanks Pierre, I have opened EMSUSD-251 to track improvements.
@seando-adsk ready for merge.

@JGamache-autodesk JGamache-autodesk added the ready-for-merge Development process is finished, PR is ready for merge label Jul 4, 2023
@seando-adsk seando-adsk merged commit 64949d9 into dev Jul 5, 2023
@seando-adsk seando-adsk deleted the gamaj/LOOKDEVX-1592/clean_up_relationships_on_delete branch July 5, 2023 12:59
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 workflows Related to in-context workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants