PDA

View Full Version : Undo contexts


Moosley
11-26-2007, 11:47 AM
I'm trying to get max 2008 to display a proper undo entry in the list for some scripted stuff, but for some reason it always puts 'MAXScript' even though I'm using the optional string in the undo context... For example:


(
undo "Create Boxes" on ( for x = 1 to 10 do box pos:[random -100 100,random -100 100,random -100 100] )
)


refuses to put 'Create Boxes' in the list and just defaults to 'MAXScript'. Any ideas what I'm doing wrong?

LoneRobot
11-26-2007, 01:02 PM
hi simon,

im not using 2008 yet, but in the past I have had the same issue. I found if I defined the string as a local variable, and passed that variable instead of the string in the undo code, it would display correctly.

Moosley
11-27-2007, 10:49 AM
Still not having much luck with the name, even using a variable as suggested :sad:

LoneRobot
11-27-2007, 11:29 AM
hi simon,

i had tried the same thing and was confused as to why it worked on my scripts, and not with your example. The reason was that in my scripts the undo context was contained within an "on pressed" handler in the code. if you put it in a rollout and call it when a UI element is pressed, it will update the undo list with the correct text. outside of that, i guess max just sees the fact that some 'general' maxscript has been run.

rollout test"" width:162 height:56
(
button btn1 "If i could turn back time...." pos:[16,11] width:133 height:31
on btn1 pressed do undo "Create Boxes" on ( for x = 1 to 10 do box pos:[random -100 100,random -100 100,random -100 100] )
)
createdialog test

CGTalk Moderation
11-27-2007, 11:29 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.