Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Undo stack cleared after python command

Undo stack cleared after python command

Anonymous
Not applicable
670 Views
1 Reply
Message 1 of 2

Undo stack cleared after python command

Anonymous
Not applicable

My artists have been complaining about their undo stack clearing everytime they save. The problem only happened when my postsave callback ran. I investigated and found that running any python command will clear the undo stack.  Here was my test:

 

python.execute "print 'HELLO!'"

 

Then the undo stack is empty. Is there a way to run a python command without losing the undos?

 

Thanks,

Miles

671 Views
1 Reply
Reply (1)
Message 2 of 2

kevinvandecar
Community Manager
Community Manager

Hi Miles,

 

Yes this is normal. The python execution, by default, is not able to participate in undo properly. There is one way to execute python that would allow it to maintain the undo stack, but you need to be careful... This should only be used when the scene state is not being modified. So for example, if your python script deletes a scene node and object, then it could cause some instability. See here for the details... http://help.autodesk.com/view/3DSMAX/2015/ENU/?guid=__files_GUID_860B6BEB_AE3E_4F99_96E9_CCD70DF4B77...

 

 

hope it helps, kevin


Kevin Vandecar
Developer Technical Services
Autodesk Developer Network



0 Likes