[Closed] Is it a maxscript bug or my mistake
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
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.