-
Notifications
You must be signed in to change notification settings - Fork 202
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-125918 auto re-edit when merging a Maya Ref #2762
Conversation
This required many fixes and improvements. The main challenges were: - The fact that a given prim is a Maya reference is the knowledge of custom prim update manager. - Some things were not available as UFE commands. - It is possible to edit multiple Maya Ref at the same time in a single edit session (for example two ref as child of an edited prim) - Many small bugs or limitations that had to be fixed. The first item was addressed by having the possibility for prim updater to add extra work to be done once an operation (edit-as-Maya, merge-to-USD, etc) is done successfully: - Add a composite UFE command to the prim updater context. - This command contains sub-commands that are executed at the end of a prim updater operation. - The prim updater customization classes can thus add final work that need to be done after the edit-as-Maya or merge-to-USD is done. Augment the updater undo items to support UFE commands: - Added execute to OpUndoItem because UFE and Maya commands sometimes do things differently in execute vs redo. - Added a UfeCommandUndoItem to execute UFE commands in the prim updater manager undo item system. Add commands for edit and switching variants: - Added Edit-as-Maya UFE command. - Added Set-Variant-Selection UFE command. - Change context op to use the new commands. Modify the Maya ref prim updater to use this: - Made the Maya Ref prim updater automatically switch to the Maya Ref variant when merge-to-USD ends. - This uses the new prim updater context additional command system. - This trigger an edit due to the existing code to edit when switching variant on auto-edit Maya Ref. - (That code is in the prim updater manager, listening to scene notifications.) Small fixes to make things work: - Made the USD path to DAG path map settable on the context to avoid recreating the context multiple times. - (Recreating the context caused the additional commands to be lost...) - Fixed the code that check if commands and property changes, etc are allowed when one layer is invalid (null). Testing: - Add a unit test.
_controllingFlag = nullptr; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows resetting the "in-push-pull" flag early because otherwise it would interfere with the auto-edit mechanism that is triggered by the final additional command when merging to USD a Maya Ref with auto-edit on.
proxyStage, | ||
ctxArgs, | ||
std::get<UsdPathToDagPathMapPtr>(pushCustomizeSrc)); | ||
context.SetUsdPathToDagPathMap(std::get<UsdPathToDagPathMapPtr>(pushCustomizeSrc)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid re-creating the context since it would interfere with having additional commands. The command would be added in the context, but a new one would be used afterward,,,,
.def( | ||
"GetAdditionalFinalCommands", | ||
&UsdMayaPrimUpdaterContext::GetAdditionalFinalCommands, | ||
boost::python::return_internal_reference<>()) | ||
.def("MapSdfPathToDagPath", &UsdMayaPrimUpdaterContext::MapSdfPathToDagPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, calling this currently fails in Python because UFE does not expose the UndoableCommand and CompositeUndoableCommand to Python. Not a blocker until someone wants to add additional commands from aprim updater in Python.
/// \brief execute a single sub-operation. By default calls redo. | ||
MAYAUSD_CORE_PUBLIC | ||
virtual bool execute() { return redo(); } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As explained, the old design assumed redo == execute, but this not the case for some UFE commands.
EditAsMayaUfeCommand::~EditAsMayaUfeCommand() { } | ||
|
||
void EditAsMayaUfeCommand::execute() | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case you're wondering: there was already a EditAsMayaCommand class... but it is a Maya Command (MPxCommand) not a UFE command (Ufe::UndoableCommand). So I had to use a more specific name to disambiguate.
Also fix two tests that changed behavior now that we respect auto-edit and that chaning variant is checked at execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. However, it's a big change and I would propose to wait and not merge it for the next release so that QA had enough time to identify any regressions
We can ask QA what they prefer next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Just one minor comment about the using macro.
This required many fixes and improvements.
The main challenges were:
The first item was addressed by having the possibility for prim updater to add extra work to be done once an operation (edit-as-Maya, merge-to-USD, etc) is done successfully:
Augment the updater undo items to support UFE commands:
Add commands for edit and switching variants:
Modify the Maya ref prim updater to use this:
Small fixes to make things work:
Testing: