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

T bailp/maya 115146/maya ref naming 2 #2350

Merged
merged 5 commits into from
May 26, 2022

Conversation

pierrebai-adsk
Copy link
Collaborator

Based on Yves Boudreault's branch.

Simplified it a bit after merging, fixed issues with reconnecting to the wrong node.

From Yves's original code I kept:

  • Add an environment variable MAYAUSD_ENABLE_MAYA_REFERENCE_OLD_BEHAVIOUR to use the old behaviour in AL.
  • Keeps the Maya Ref node name in a custom attribute.
  • Requires that the attribute be directly on the prim, not in a lower layer or indirect reference.
  • This allows having a different Maya Ref Node for each prim even if they are built from the same referenced file and namespace.
  • Adds more unit tests.

Improve the code to avoid having two Maya Ref that happen to refer to the same reference file use each other's Maya Ref Node by accident.

The subtle change is that we no longer search for the corresponding Maya Ref Node if the custom attribute is not present. When the attribute is not present, it means the Maya Ref was never edited and thus need to create its own Maya Ref Node, not search for an existing one.

I also refactored the code to avoid some code duplication and push out some code into their own functions for clarity.

  • Make all ref-node-name generator always generate the full name, including any RN suffix.
  • Renamed isMayaReference() to useNewMayaRefNaming() for clarity since that was the function's purpose.
  • Added setMayaRefCustomAttribute() and getMayaRefCustomAttribute() for clarity, isolation and reuse.
  • Got rid of getRefNodeNameFromPrim() since its only usage was to try to find a Maya Ref Node when the custom attribute was absent, which was incorrect and led to accidentally use the node from other Maya Ref.
  • De-duplicate the Maya ref node searching code.
  • Fixed the new test that simulated reparent a prim but did not simulate that the custom attribute would follow.

Based on Yves Boudreault's branch. Simplified it a bit after merging

- Add an environment variable MAYAUSD_ENABLE_MAYA_REFERENCE_OLD_BEHAVIOUR to use the old behaviour in AL.
- Keeps the Maya Ref node name in a custom attribute.
- Requires that the attribute be directly on the prim, not in a lower layer or indirect reference.
- This allows having a different Maya Ref Node for each prim even if they are built from teh same substrate.
- Adds more unit tests.
Improve the code to avoid having two Maya Ref that happen to refer to the same reference file use each other's Maya Ref Node by accident.

The subtle change is that we no longer search for the corresponding Maya Ref Node if the custom attribute is not present. When the attribute is not present, it means the Maya Ref was never edited and thus need to create its own Maya Ref Node, not search for an existing one.

I also refactored the code to avoid some code duplication and push out some code into their own functions for clarity.

- Make all ref-node-name generator always generate the full name, including any RN suffix.
- Renamed isMayaReference() to useNewMayaRefNaming() for clarity since that was the function's purpose.
- Added setMayaRefCustomAttribute() and getMayaRefCustomAttribute() for clarity, isolation and reuse.
- Got rid of getRefNodeNameFromPrim() since its only usage was to try to find a Maya Ref Node when the custom attribute was absent, which was incorrect and led to accidentally use the node from other Maya Ref.
- De-duplicate the Maya ref node searching code.
- Fixed the new test that simulated reparent a prim but did not simulate that the custom attribute would follow.
Copy link
Collaborator

@ppt-adsk ppt-adsk left a comment

Choose a reason for hiding this comment

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

Nit-picks only, thanks for doing this!

@pierrebai-adsk pierrebai-adsk requested review from nxkb and fabal May 12, 2022 15:11
@pierrebai-adsk
Copy link
Collaborator Author

Looking for some feedback on how this will affect the AL plugin. Would changing the naming scheme by default be a problem?

Use legacy-oriented function and env, var names instead of new-oriented names to emphasize that it is code that might be removed in the future.
ppt-adsk
ppt-adsk previously approved these changes May 12, 2022
... use the length function instead.
@pierrebai-adsk
Copy link
Collaborator Author

Given that this is pretty much equivalent to what Yves had written and it was approved, I'm going to label this as ready for merge.

@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label May 20, 2022
@seando-adsk seando-adsk added the core Related to core library label May 26, 2022
@seando-adsk seando-adsk merged commit bf19dcf into dev May 26, 2022
@seando-adsk seando-adsk deleted the t_bailp/MAYA-115146/maya-ref-naming-2 branch May 26, 2022 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to core library ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants