Notifications
Clear all

[Closed] UNDO without REDO

I suppose you’ve already thought about it but, just in case…


(
select objects[1]
clearSelection() --clearNodeSelection redraw:false
max undo
)

Within brackets it’s just one ‘undo’ operation and you just keep a redo for deselecting all.

What would happened with other stuff in the undo/redo stack? Do they need to stay there and you just need to skip the redo for your specific action? Do you have a sample code?

Perhaps you can trap your specific action in the #sceneRedo callback and just undo or redo again? However the action will be listed in the undo/redo stack. (Not tested)

what about this…

do something
do another something
do some more things…
undo
IsolateSelection.EnterIsolateSelectionMode()
IsolateSelection.ExitIsolateSelectionMode()

the last ‘triple’ effectively take ONE off the Undo stack and clears the Redo stack

Not to hijack this thread, but is there a PRE Undo Callback/Event?

I am trying to figure out if I could catch the undo BEFORE anything happens, so I can disable my other callback/script that is running, Undo, then enable my stuff again.

If it only allows to catch the Undo AFTER, then it’s probably not going to work in my case.

2 Replies
(@serejah)
Joined: 10 months ago

Posts: 0

In theory you can check if theHold.isHolding() and do nothing in your callbacks in that case.

(@kickflipkid687)
Joined: 10 months ago

Posts: 0

Hmmm… I am currently testing stuff using a Scene Hold operation, and restoring that. So in that case, I think it is always holding then?

In my case, it doesn’t matter if undos/holds already exist I guess… Really I am ideally hoping to catch an undo/redo at the time it happens, and pause my callback/resume after the undo/redo is done.
But that might not be possible.

It’s not the end of the world, but might be confusing to the user. Ssince while my CB is running, if they try to undo a vert movement/etc, nothing happens, unless you hit undo like 3-4 times quickly, then it might pass through/not get interrupted by my callback.

Page 2 / 2