[Closed] if undo then
(
undo "A" on
(
print "done A"
b=box()
)
if undo "A" do
(
print "undone A"
)
)
Please help me realize this thing – to understand if the operation was undone, then print “undone”
you need to create a #sceneUndo event callback…
from the mxs help
callbacks.removeScripts id:#test
callbacks.addScript #sceneRedo "format \"Redo: %\
\" (callbacks.notificationParam())" id:#test
callbacks.addScript #sceneUndo "format \"Undo: %\
\" (callbacks.notificationParam())" id:#test
[left]
[/left]
run the snippet above, read the mxs help -> General Event Callback Mechanism about #sceneUndo, and run the snippet again
(
undo "A" on
(
print "done A"
b=box()
)
callbacks.removeScripts id:#test
callbacks.addScript #sceneRedo "format \"Redo: %\
\" (callbacks.notificationParam())" id:#test
callbacks.addScript #sceneUndo "format \"Undo: %\
\" (callbacks.notificationParam())" id:#test
)
result:
"done A"
OK
Undo: MAXScript
In help is says “returns the name of the undo entry in 3ds Max 8 and higher.”
But I get only Undo: MAXScript
I could of course see if (callbacks.notificationParam())== “A” then print “undone A”
that’s different story… look in undo history. what names do you have there? these are the names that could be returned with callbacks.notificationParam()
if you execute any undoable code from mxs listener it always registers with undo name “MAXScript”