Does exist a simple way to remove variables?
Maybe somebody know a simple way to remove variables what was created during the script testing for example if you create rollout
rollout rl_test "Some Rollout" width:100 height:100 ( checkbutton myButton "My Button" width:80 height:24 ) createDialog rl_test
if I execute code bellow before rollout is created
rl_test.myButton.state
then I get
-- Unknown property: "myButton" in undefined
and this is fine because max doesn't know about such a rollout and button
but after rollout was created it always returns some value even if rollout was closed. Maybe are some smart way to clear this data from Max memory without restarting Max.
Comments
.
In your case replace:
toolDeleteGlobal "myGlobalGlobal"
with:
toolDeleteGlobal "rl_test"
Setting them to undefined does nothing but create the global and set it to undefined.
The only true method to remove them is by using:
globalvars.remove "rl_test"
I'm starting to put all my fns in structs lately so here's a struct version.
globalvars.remove
It's an old post i know, but in case someone else has this problem and came to this thread.
To remove a global variable, you need to use globalvars.remove
for example if your global variable is called my_number, then to remove it you just type
globalvars.remove "my_number"
see globalVars Structure
Free() Method is nice to clean up memory BUT it NOT revome global variables(!), it just reinit their value. For example:
You can check in the help for globalVars Structure but read carefully all the warning notes.
In the best case, a.k.a. good practice, use only Local variables.
Cheers!
my recent MAXScripts RSS (archive here)
You can also try free()
This has been in Max since version 2009, but they say it was undocumented until version 2012.
Free() Method
The free() method has been implemented since 3ds Max 9 but has remained undocumented. This method frees the memory used by the value without waiting for a garbage collection to occur. It is implemented for the following classes:
String ValueStringStream Value
FileStream Value
BitMap Value
Array Value
BitArray Value
Mesh Value
Principal Technical Artist - Zynga, Inc.
you can simply type this
you can simply type this line
Thanks Jos For rollout
Thanks Jos
For rollout elements it will work perfect :)
However for another kind of variables what are cashed will be more work to undefine all of them.
dont think it's possible
dont think it's possible without restart max. you can try yo run the garbage collector. (Maxscript help : Manual Garbage Collection) but it doesnt clear variables in use..
gc() - doesn't help
You are right garbage collect doesn't help :(
any way thank you for help :) at list now I know how to destroy variables in rollout :)