PDA

View Full Version : source local procedures for use with buttons


westiemad
10-23-2006, 10:19 AM
Hi Guys,
If you save this out to a mel file and then source it in maya, when you click the button you get an error because it won't source the local proc in the same file, if you do this without the button etc it'll work. Anyone know how to get this to work, I've had a quick go with evals and can't get it?

proc test()
{
print "works\n";
}

global proc buttonPress()
{
window -width 150;
columnLayout -adjustableColumn true;
button -label Default -c test;
showWindow;
}


Cheers

AnDy.

Robert Bateman
10-23-2006, 11:35 AM
global proc test()
{
print "works\n";
}

global proc buttonPress()
{
window -width 150;
columnLayout -adjustableColumn true;
button -label Default -c test;
showWindow;
}

remember that when you run code in the script editor it makes everything global by default....

westiemad
10-23-2006, 11:37 AM
yep, i'm fully aware of that, hence the reason I said save it to a file.

You can however stop your variables being declared global by adding: { and } around them.

EDIT: solved :)

CGTalk Moderation
10-23-2006, 11:37 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.