PDA

View Full Version : UI opened through expressions


cgcreator
06-30-2003, 11:36 PM
Is it possible to open windows thru expressions like when you change a certain attribute have a window launch?

cgcreator
07-03-2003, 06:21 AM
I've setup this Global Epression as an Expression.


global proc mainUI()
{
// Create a new template object.
//
if (!`uiTemplate -exists TestTemplate`) {
uiTemplate TestTemplate;
}

// Add the command default parameters to the template.
//
frameLayout -defineTemplate TestTemplate
-borderVisible true -labelVisible true -labelAlign "center"
-marginWidth 5 -marginHeight 5;

button -defineTemplate TestTemplate -width 150 -label "Default Text";

// Now make a window.
//
window -title "Test Window" ExampleWindow4;

// Make our template current
//
setUITemplate -pushTemplate TestTemplate;

frameLayout -label "Buttons" TestFrameLayout;
columnLayout TestColumnLayout;
button;
button -label "Not Default Text";
button;
// Restore previous, if any template to clean up.
//
setUITemplate -popTemplate;

showWindow ExampleWindow4;

};

ok that makes the UI

if i type mainUI on the command line it launches ok. ok now i have this expression checking the rotaionX to see if its == to 1.

$rx = locator1.rotateX;
if ($rx == 1)
{
MainUI;
}

its not working... these are just examples of the UI and what i want to check. trying to get this test to work and then going to apply it to my rig... can you not source glob proc from expressions?

mark_wilkins
07-03-2003, 07:54 PM
You REALLY don't want to do what you're suggesting, because it won't do what you think it does.

I created a small expression that looked like this:


if (translateY == 2) {
window;
showWindow;
}


then I set the ty attribute to 2. Nothing happened.

Changing the timeline, though, made a window pop up. Then, changing the timeline again made a second window pop up. Soooo at the very least you're going to have to deal with several things, such as that node recalculation may not happen with every change of the input attribute, and that you'd have to check for existence of the window and not create it if it's already there.

If you really need this behavior, make a scriptJob. Alternatively, why not just lock the attribute and thereby force the animator to use your script to change it?

-- Mark

cgcreator
07-03-2003, 08:35 PM
Thanks that helped

CGTalk Moderation
01-15-2006, 01:00 PM
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.