ZBrushCentral

managing the Edit:Undo count?

A scripting puzzle…

Has anyone worked out a way to zero out the Edit:Undo count (and the redo count)? Or, for that matter, a way to simply reduce the count (without actually performing an undo or adding to the redo count)?

Thanks! Sven

Hmm. I think I found a way, but it’s clunky. I’d be curious if anyone else has their own solution.

To the few other scripters who may be interested, here’s a test script that demonstrates a way to limit the number of Undos. This demo is likely not useful for any real work but shows a method that might be useful in some specific scripting situations.

To Install…
Unzip the UndoClear.zsc file into the ZPlugs directory. On next startup, you’ll find a button named Clear Undo and a slider named MaxUndo under the Edit>Clear SubPalette.

After you’re done testing that it works simply delete the UndoClear.zsc file. If you have time to try it out please post if you find any problems.

To use it:
Set the slider to the maximum number of Undos you want before you press the Clear Undo Button. Then, Pressing the Clear Undo Button will reduce the Undos to exactly the Max Undos you have set (or less, if the number of pending Undos is less than the Max.)

The MaxUndo slider starts out set to zero… if you just press the Clear Undo Button, it will clear the undo stack to zero.

Experiment:
Draw a Sphere3d and enter edit mode. Zadd 10 bumps on the surface. Drop down the Edit menu and set the MaxUndo slider to 5, then press the Clear Undo button. When you look again at the Edit>Tool>Undo Button, you’ll notice that it now will only allow five undo clicks (or five Control-Z keyboard strokes, and only the most recent five of those ten bumps can be undone.

The Undo stack has been clipped to the last five undos.

Sven

Attachments

clear undo.jpg

Blimey, you do put the poor old thing through some work! :wink:

Works OK for me, though I’ve only had a quick look so far… An interesting solution.

Yeah, like I said, Clunky! :rolleyes: and I’m open to suggestions… :slight_smile: