ZBrushCentral

Delete undo history on all subtools

Here’s a script that some might find useful. It deletes the undo history and older undos on all subtools. - Kinda useful if you want that sort of thing.

// Nuke undo history script
[IButton, "Nuke undo history", "Deletes UNDO history for ALL subtools.",

// create variable equal to number of sub tools
[VarDef, len, [SubToolGetCount]]
[VarDef, msg, ""]
[VarSet, msg, ""]
[VarDef, c, 0]
[VarSet, c, 0]

[VarSet,i,0] 
	[Loop,len,
		[SubToolSelect,[Val,i]] // select the current sub tool
		[IPress,Edit:Tool:DelOlderUH] // Delete Older Undo History
		[IPress,Edit:Tool:DelUH] // Delete Undo History
		[VarInc, i] // i++
		[VarSet, c, i]
	]

[VarSet, msg, [StrMerge, msg, c, " subtools have had UNDO history deleted."]]

// show message for two seconds
[Note, msg,,2]

] // end button

As always, use at your own risk.

nice, thanx for sharing.
it could be just even more optimized as you dont need all these varaiables, you can instead use the loop counter value, so no need to increment with i and c to count the number of subtools. and prevent to press the button when there is no undo history at all for a subtool.

// Nuke undo history script
[IButton, "Nuke undo history", "Deletes UNDO history for ALL subtools.",

	[Loop,[SubToolGetCount],
		[SubToolSelect,n]
		[If, [IsEnabled, "Edit:Tool:DelOlderUH"],[IPress,Edit:Tool:DelOlderUH]]
		[If, [IsEnabled, "Edit:Tool:DelUH"],[IPress,Edit:Tool:DelUH]]
	,n]
	[Note, [StrMerge, [SubToolGetCount], " subtools have had UNDO history deleted."],,2]
] // end button

hope it helps!
Nicolas

1 Like

Thanks Nicolas,
I’ve had problems in the past where variables weren’t initialized properly and got into the habit of pairing up get & set together.

Hi guys this would be useful to me. forgive me I’m a total scripting noob. where do I paste this ?

Short answer :

  • save the button text block into a file.
  • press H to show the script window load the file with the menu Zscript:Load
  • press the button in the

online Manual :
http://docs.pixologic.com/user-guide/customizing-zbrush/zscripting/

Youtube:

1 Like

Thanks super helpful

1 Like