Notifications
Clear all

[Closed] massive undo on loop

i trying to be able to undo a massive change of objects in a loops in a scene.

[color=white]What I want to undo in this sample , firstable i switch off the turbosmooth in all geometry objects in scene but i will be able to undo it if the the user make a mistake.
I could do switch on turbosmooth for fix it but in case of changes iterinations or other properties i can undo it easly.

[size=3]code:

[/color][/size]undo “test”on
(

global test = “TurboSmooth”

for o in geometry do for m in o.modifiers where m.name as string == test do m.enabled = false

)

but doesnt work.

I dont know if is posible to undo massive change of properties of objects done in a loop
or i have to use another command or do in another way.but probably i dont it wrong i stil ned to learn a lot of maxscript.

Thanks in advance

4 Replies
1 Reply
(@f97ao)
Joined: 1 year ago

Posts: 0

Be careful with undo in big loops, it gets very slow and can demand so much memory so max crashes. Undo doesn’t always work as expected, but I would expect it to work here.
/Andreas

thanks f97ao

but undo stil doesnt work . i been tryin g and work in simple lines ofcode but in bigs loops like ” where m.name” kind of stafe doesnt do it properly.

I tried in a scene with all the objects with turbosmooth on the first of the stack and still doesnt work the undo
[size=3][color=darkorange]undo[/color][/size] “mytest” on

(

for o in geometry do o.modifiers[1].enabled = false

)

does undo have any problem with .enabled property or is imposibe to work or undo the loops.

another posibility i thinked does the undo depends of the number of undo setup on preferences general. i have it on 20.

wel i will continue trying to find a solution

Hi !

try making your script a macroscript
something like
macroscript MyScript
category:My Cat
(
– Your script here
)

when you execute your macrtoscript, you should have an “Undo Maxscript” or
“undo MyScript” entry in the undo list

my script is already a macroscript but i found it confusing how it display in the undo list.

if your script does selection or other thing will put all this info in the undo list so will be dificult to find it on the undo list.
is your macroscript is like a floating window that you keep open whe you work yo can have proper track of what is going on so is not like press undo and will do it or in the undo list because i will be full of select and other operations.