MAYA-129047 allow editing prims directly under the stage #3069
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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...)