Notifications
Clear all

[Closed] simple script works fine directly, not undoable through a floater?

Hi,

I did this simple thing do offset animations on a selection set. It’s in a floater and uses a spinner to make the offset adjustable.

It works but I can’t undo! Any ideas?


macroScript Macro2
(
	
rollout keysoffset "Keys offset" width:160 height:56
(
	spinner spn1 "" pos:[8,8] width:56 height:16 range:[-10,10,1] type:#integer
	button btn1 "Offset keys" pos:[72,8] width:80 height:40
	label lbl1 "frames" pos:[8,32] width:56 height:16
	on btn1 pressed do
		for i = 1 to selection.count do inserttime selection[i] 0 (i*spn1.value)
)
	createdialog keysoffset
)

Edit: the actual manipulation code


for i = 1 to selection.count do inserttime selection[i] 0 (i*2)

can be undone when executed from the listener or as a single-line drag’n’drop macroscript

1 Reply

Nevermind. I had to specifically tell max to undo that block.


on btn1 pressed do (
	undo on (
		for i = 1 to selection.count do inserttime selection[i] 0 (i*spn1.value)
	)
)