Feedback

What's your question?

By: Asked

Understanding Undo-Redo

Hi,

I am developing a undo-redo frame work using python. There is bit of confusion and I tried similar approach in Maya but even in Maya I won't able to understand it's undo-redo stack management.

Follow this: (Interactive Creation Mode should be on)

1. Create Cube 1
2. Create Cube 2
3. Create Cube 3
4. Undo (Cube 3 is gone and Cube 2 is selected)
5. Press Delete (Cube 2 is deleted)
6. Undo (Cube 2 comes again)
7. Undo (Cube 2 is gone and Cube 1 is selected)
8. Redo (Cube 2 comes again)
9. Redo (Cube 2 is deleted)
10. Redo (No more redo actions.....
11 Where is cube 3.....?

It seems "delete" operation is removing entire stack after wards. I need a bit technical explanation behind this scenario.

Cheers

Prashant

Add comment viewed 302 times Latest activity 7 months ago

or Cancel

2 answers

  • 1

michalf [ Editor ]

On step 5. you are after one undo, and by pressing delete, you purge "redo list" by making modification to the scene. If you look closer between step 5-10, step 5 is the only one that is not undo/redo. Undo/redo moves you along a list of actions back and forth, but any other action (step 5) deletes "future" scene changes from this list.

I feel my explanation is somewhat twisted, but I hope it makes sense in the end...

NN comments
vfxoverflow_191
-

I did some other tests. When you are some where in the middle of the stack (Not in the last), “delete” action purge the history from it’s current position. Logically it’s like when you have total 5 actions and you ‘undo’ twice, Now you are at action 3, if you press ‘delete’, 4th action delete will be inserted and previously stored 4th and 5th action will be purged. I think I have to wait for some one who throw some more details.

vfxoverflow_191
-
I did some other tests. When you are some where in the middle of the stack (Not in the last), "delete" action purge the history from it's current position. Logically it's like when you have total 5 actions and you 'undo' twice, Now you are at action 3, if you press 'delete', 4th action delete will be inserted and previously stored 4th and 5th action will be purged.

May be some one else can shed some more light….

or Cancel
  • 0

julian [ Admin ]

You created a tree. At the point where you have Cube 2 selected, you have 2 futures. The second future (Delete at step 5) overshadowed the first (Create cube at step 3). If the undo mechanism was tree instead of a queue you would be able to choose, but unfortunately its not. It can only take one path so it takes the most recent.

alt text

NN comments
vfxoverflow_191
-

Thanks Julian,

So the correct way is to purge the forward stack if action is ‘delete’ and it would be easier to implement also. BTW, How did you created the above image?

julian
-

I think it doesn’t really matter whether it is a delete or some other operation. Step 3 “create cube 3” was undone, so if you then do something else (such as create a sphere at step 5 instead of delete) then that is a new branch in the tree and it means you can never get cube 3 back.

I used http://www.omnigroup.com/products/omnigraffle/ to make that diagram. Its really cool for that kind of thing, and UI mockups etc.

or Cancel