|04 April 2006||#1|
Lord of the postsportfolio
Join Date: Nov 2003
Pause/Resume a script?
I've been working on this script for setting up a character rig. At one point a new window is created within a procedure which requires the use of a string variable declared within the same procedure. The problem is, the window pops up and the procedure keeps running, as it's called by a button command from the original script UI. So the string the window needs not only no longer exists by the time the user interacts with the new window, but the changes the new pop-up window is supposed to make are obsolete, as it is supposed to effect objects before the procedure finishes.
So is there a way to pause a preocedure, or stop it from evaluating until the pop-up window is closed?
clicking the button results in...
does anyone know how to fix this?
|04 April 2006||#2|
SW Development Manager - Maya
Join Date: Apr 2004
You should probably add a callback to your UI slider and then in the callback do whatever you need to do. But, no...the string you are declaring is local to the proc so what you have isn't going to work.
Looking at what you have there I think the attrFieldSliderGrp might be a control that you could use...try this example:
|04 April 2006||#4|
wandering in Singapore
Join Date: Nov 2005
I think this is an issue regarding variable scope. In your example, since $neededString is declared within the bloc of a procedure, it exists only within the scope of that proc. If you turn your proc into one that returns a string value, however, and input the return value into a variable which exists outside your proc, I think you will get what you're looking for. Here is a modified example:
global proc string test()
string $neededString = "needed";
string $newWindow = `window -title "window1"`;
floatSliderGrp -label "size"
-minValue -10 -maxValue 10
button -label "scale now" -command "$neededFloat = `floatSliderGrp -q -value myWin`; setAttr ($neededString + \".scale\") $neededFloat $neededFloat $neededFloat" myWin;
string $neededString;$neededString = test();
|Thread Closed share thread|