PDA

View Full Version : Is it a maxscript bug or my mistake


fudongmu
10-28-2006, 02:37 PM
the code about this


rollout renderbox " renderbox" width:272 height:296
(
--.......
)
if not(renderbox.open) then CreateDialog renderbox bgcolor:[30,50,100] fgcolor:[255,150,0]


i want it just creates a dialog , but it always creates a new one . it made me confusing when
test the script . i spent much time to try to find out if i did something wrong. but it work well when i use it as a macroscript. Sorry for my poor english

Bobo
10-28-2006, 05:35 PM
Each time you run the code, the rollout gets redefined and of course the new rollout's .open property is false by default. The variable does not point at the old rollout anymore, so you have no way to access any properties of the previous incarnation.

The correct way to deal with this is to declare the rollout as a global variable, try to close it even BEFORE it being defined, then define it (thus overwriting the content of the global variable) and then creating a dialog out of it.

(
global someRollout
try(destroyDialog someRollout)catch()
rollout someRollout "someRollout"
(
--your rollout controls here
)
createDialog someRollout
)


This will ensure there is always ONLY ONE copy of the rollout displayed.

fudongmu
10-29-2006, 01:03 AM
thanks ,Bobo

CGTalk Moderation
10-29-2006, 01:03 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.