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

Add undo / redo to Edit-as-Maya workflows. #1969

Merged
merged 1 commit into from
Jan 11, 2022

Conversation

pierrebai-adsk
Copy link
Collaborator

Create commands:

  • Add mayaUsdEditAsMaya command for edit as Maya.
  • Add mayaUsdDuplicate command for duplicate as Maya and duplicate to USD.
  • Add mayaUsdDiscardEdits command for discarding edits.
  • Add mayaUsdMergeToUsd command to merge back to USD.
  • This makes it easy to script and support undo/redo.
  • Remove the old mel script for pull/push/discards/duplicate, replace them with these commands.
  • Add unit tests for all new commands.

Create system to record undo items:

  • Add OpUndoInfo to record all undoable steps for each commands.
  • Add an instance to UsdUndoManager singleton to record undo items from anywhere.
  • Add OpUndoItem to record a single undoable sub-operation step.
  • Add OpUndoInfoMuting to muting recording undo items in block of code that handles undo differently.
  • Add OpUndoInfoRecorder to automatically record all undo items in a block of scoped code.

Provide undo items for many common scenarios:

  • Implement OpUndoItem for USD undo block (UsdUndoBlock / UsdUndoItem).
  • Implement OpUndoItem for MDagModifier.
  • Implement OpUndoItem for MDGModifier.
  • Implement OpUndoItem for selection.
  • Implement OpUndoItem for locking nodes.
  • Implement OpUndoItem for pair of Python do/undo scripts.
  • Implement OpUndoItem for any generic pair of do/undo C++ functions.

Various code adjustments:

  • Remove the cached pull root from PrimUpdaterManager since it was interfering with undo/redo.
  • Retrieving it for each command is not costly and avoid needing us to clear it.
  • Use undo info muting in read job (import) class since it implements its own undo / redo.

Create commands:

    Add mayaUsdEditAsMaya command for edit as Maya.
    Add mayaUsdDuplicate command for duplicate as Maya and duplicate to USD.
    Add mayaUsdDiscardEdits command for discarding edits.
    Add mayaUsdMergeToUsd command to merge back to USD.
    This makes it easy to script and support undo/redo.
    Remove the old mel script for pull/push/discards/duplicate, replace them with these commands.
    Add unit tests for all new commands.

Create system to record undo items:

    Add OpUndoInfo to record all undoable steps for each commands.
    Add an instance to UsdUndoManager singleton to record undo items from anywhere.
    Add OpUndoItem to record a single undoable sub-operation step.
    Add OpUndoInfoMuting to muting recording undo items in block of code that handles undo differently.
    Add OpUndoInfoRecorder to automatically record all undo items in a block of scoped code.

Provide undo items for many common scenarios:

    Implement OpUndoItem for USD undo block (UsdUndoBlock / UsdUndoItem).
    Implement OpUndoItem for MDagModifier.
    Implement OpUndoItem for MDGModifier.
    Implement OpUndoItem for selection.
    Implement OpUndoItem for locking nodes.
    Implement OpUndoItem for pair of Python do/undo scripts.
    Implement OpUndoItem for any generic pair of do/undo C++ functions.

Various code adjustments:

    Remove the cached pull root from PrimUpdaterManager since it was interfering with undo/redo.
    Retrieving it for each command is not costly and avoid needing us to clear it.
    Use undo info muting in read job (import) class since it implements its own undo / redo.
@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jan 10, 2022
@kxl-adsk kxl-adsk merged commit 70124fe into dev Jan 11, 2022
@kxl-adsk kxl-adsk deleted the t_bailp/MAYA-114109/undo-redo-push-pull-simplified branch January 11, 2022 09:40
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants