Ability to undo/redo multiple changes in one step#122
Open
denzo wants to merge 12 commits intooffirgolan:masterfrom
Open
Ability to undo/redo multiple changes in one step#122denzo wants to merge 12 commits intooffirgolan:masterfrom
denzo wants to merge 12 commits intooffirgolan:masterfrom
Conversation
Owner
|
@denzo there are a lot of changes here. Can you explain what's going on and why these changes are needed? |
Contributor
Author
|
@offirgolan Apologies for the delayed response. I've updated the description of this PR and added tests and explanation in the code. I hope it made it a bit more clear. Let me know what you think and if this is something you would consider including as a feature of this awesome addon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces new functionality without breaking the existing one.
Currently the undo/redo stack consists of list of changes. Therefore it is not possible to make multiples changes and be able to undo those in one step. This is easy to demonstrate via using
setPropertiesfor example.Calling
tm.undo()will not undo both of the changes.In order to achieve the above this PR changes the structure of how we store the changes.
The undo/redo stack now stores a collection of
changeSets which is nothing more than anArrayof changes.It looks like this:
The current functionality of the addon stays the same. However, when multiple changes need to be recorded as one the user of the addon needs to call
.startTimeMachineprior to making the changes and.stopTimeMachinewhen all the changes are done.Calling
tm.undo()will undo both of the changes.