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

MAYA-129047 allow editing prims directly under the stage #3069

Merged
merged 2 commits into from
May 10, 2023

Conversation

pierrebai-adsk
Copy link
Collaborator

When handling the combined visibility of the edited prim, the code did not work when the prim was directly under the stage.

More precisely, the ProxyAccessor design did not support accessing properties of the absolute root node of a stage. Normally, this would not be a problem since that prim does not have attributes, but for Edit-as-Maya, the combined visibility assumed it could create a SdfPath to the associated property, which is impossible for the root prim.

The solution is to modify the ProxyAccessor code to avoid creating the SdfPath to the property and instead keep the prim path and property name separate in the code. Unfortunately, the way the ProxyAccessor works is by encoding the full path of the property ("prim.property") in the Maya attribute name. So we "cheat" by creating impossible names for the root node. For example "/.combinedVisibility". This requires never treating the Maya attribute name as a SdfPath, but splitting it ourselves into a SdfPath and a property name. We do this to be backward compatible.

Before the introduction of combinedVisibility, the only attribute that was accessed on the stage root prim was its transformation matrix, at the code cheated by not providing a property name and having the code magically knowing that when there is no property name, it meant the transform matrix was intended. Again, this magic is kept for backward compatibility.

While at it, some code cleanup was done to use an explicit structure instead of a std::tuple to make the code more readable and easier to maintain. (std::get<3> make is unclear what is being accessed...)

When handling the combined visibility of the edited prim, the code did not work when the prim was directly under the stage.

More precisely, the ProxyAccessor design did not support accessing properties of the absolute root node of a stage. Normally, this would not be a problem since that prim does not have attributes, but for Edit-as-Maya, the combined visibility assumed it could create a SdfPath to the associated property, which is imposible for the root prim.

The solution is to modify the ProxyAccessor code to avoid creating the SdfPath to the property and instead keep th eprim path and property name separate in the code. Unfortunately, the way the proxy accessor works is by encoding the full path of the property ("prim.property") in the Maya attribute name. So we "cheat" by creating impossible names for the root node. For example "/.compositeVisibility". This requires never treating the Maya attribute name as a SdfPath, but spliting it ourselves into a SdfPath and a property name. We do this to be backward compatible.

Before the introduction of compositeVisibility, the only attribute that was accessed on the stage root prim was its transformation matrix, at the code cheated by *not* providing a property name and having the code magically knowing that when there is no property name, it meant the transform matrix was intended. Again, this magic is kept for backward compatibility.

While at it, some code cleanup was done to use an explicit structure instead of a std::tuple to make the code more readable and easier to maintain. (std::get<3> make is unclear what is being accessed...)
@pierrebai-adsk
Copy link
Collaborator Author

Successful PF is #966 (only the known isolate select test fails in 2022)

vlasovi
vlasovi previously approved these changes May 9, 2023
Copy link
Collaborator

@vlasovi vlasovi left a comment

Choose a reason for hiding this comment

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

Looks good.

@pierrebai-adsk pierrebai-adsk added bug Something isn't working adsk Related to Autodesk plugin proxy Related to base proxy shape labels May 9, 2023
@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label May 9, 2023
@seando-adsk seando-adsk merged commit e3a2d2a into dev May 10, 2023
@seando-adsk seando-adsk deleted the bailp/MAYA-129047/edit-as-maya-mesh branch May 10, 2023 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin bug Something isn't working proxy Related to base proxy shape 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.

3 participants