Commit f309fee
authored
SG-41210: Add a per user undo-redo stack to Annotate Mode (#1016)
### [SG-41210](https://jira.autodesk.com/browse/SG-41210): Add a per
user undo-redo stack to Annotate Mode
### Summarize your change.
The undo, redo and clear actions in the Annotate Mode were refactored. A
new undo property was added so that bringing back cleared annotations
would be done through an `undo` action instead of `redo`. Both the undo
and redo properties were made per user via the username and process id
values. An `undoClearAllFrames` and a `redoClearAllFrames` properties
were also created to managed clearing annotations on the timeline. This
action is special because in a context of multiple annotators, clearing
can be done by anyone on any frames and specifically undone by the user
who made the action. Basic undo and redo actions are per frame. However,
undoing and redoing a clear of all the annotations on the timeline can
be done on any frame.
The undo, redo and clear button states were also updated to match this
new implementation of the Annotate Mode. If the draw mode is `_Select`
(i.e. the cursor), all three buttons are disabled since the Annotate
mode is not actually active anymore and the states were not updated in
that case. Undoing, redoing and clearing annotations can only be done if
a real drawing mode (e.g. pen or text) is selected to avoid issues with
the buttons not being updated.
This implementation is following this design:
**Draw a paint stroke**
- Add a "create" action for the stroke onto that user's undo stack for
that frame
- Empty the redo stack for that frame
**Clear all on a frame**
- Empty the undo and redo stacks for that frame
- Add a "ClearAll" action for all the strokes for that frame
**- Clear all frames on the timeline**
- Empty the undo and redo stacks for all frames
- Add a "ClearAllFrames" action for the strokes for all frames
**Undo**
- If the undoClearAllFrames property has an action
- Restore the strokes stored in the action
- Assign the action to the redoClearAllFrames property
- Reset the undoClearAllFrames property
- Else if the undo stack for that frame is not empty
- Pop the action object
- If the action was "create"
- Remove the annotation from the order property
- Else if the action was "clearAll"
- Restore all the annotations for that action
- Push the action onto the redo stack
**Redo**
- If the redoClearAllFrames property has an action
- Remove the strokes stored in the action
- Assign the action to the undoClearAllFrames property
- Reset the redoClearAllFrames property
- Else if the redo stack for that frame is not empty
- Pop the action object
- If the action was "create"
- Restore the annotation from the order property
- Else if the action was "clearAll"
- Remove all the annotations for that action
- Push the action onto the undo stack
### Describe the reason for the change.
Some changes were needed to match the new product requirements around
undo, redo and clear actions. This changes were mainly needed to handle
multiple annotators simultaneously in a Live Review session.
### Describe what you have tested and on which operating system.
Basic operations of drawing, undoing, redoing, clearing a frame, and
clearing the timeline were tested on macOS 15.6.1
---------
Signed-off-by: Éloïse Brosseau <[email protected]>1 parent 261638a commit f309fee
File tree
2 files changed
+577
-149
lines changed- src/plugins/rv-packages/annotate
2 files changed
+577
-149
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
0 commit comments