PDA

View Full Version : clearing variables and windows


KanedaHelpMe
02-21-2008, 09:01 PM
i'm new to mel, and i am currently taking a mel class. we are currently working on an assignment where we need to create windows. since i am messing around and testing things out, i am creating windows very often. however, it is really a pain in the ass to have to change my script with new window name every time (since i don't want to rely on maya's automatic naming)

anyway, i was wondering if there's any way to clear things that have been created with mel like varibles, strings, arrays, and windows without having to close and reopen maya.

thanks!

greatPumpkin
02-22-2008, 09:45 AM
if you are working in the script editor and don't want to clutter things up, it's easier to put your stuff inside of a proc:

i.e.:

proc makeAWindow()
{
string $win = window -t "Test Window";
showWindow $win;
}
makeAWindow;

this way any variables you declare inside the proc will not be kept after the proc finishes running. Also, if you are applying an explicit name to your window (a good idea)- then you can delete it if it exists on every open so you don't have to keep reanming it:

proc makeAWindow()
{
// declare the name of your window up front
string $win = "aWindowNamedFoo"

// delete the window if it exists already
if(`window -exists $win`)
{
deleteUI $win;
}
string $win = window -t "Test Window" $win;
showWindow $win;
}
makeAWindow;

KanedaHelpMe
02-23-2008, 03:06 AM
thanks, that was helpful.

the other thing that became apparent to me today is that there doesn't seem to be a way to ptint a list of already declared variables. my mel teacher didn't even know how to do it.

any thoughts?

CGTalk Moderation
02-23-2008, 03:06 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.