PDA

View Full Version : scriptJob - Why I can't run scriptJob correctly


safakoner
01-02-2004, 04:06 PM
Hi

I am writing a code. But I can't run this correctly. Can you check it ?
Thanks


window;
columnLayout;
button -l " test " bb;
showWindow;

global proc doit()
{
scriptJob -e "SelectionChanged" "checkSimpleSelection" ;
}


global proc checkSimpleSelection()
{
string $sel="equinox";
if(!($sel == 1)){
button -e -bgc 1.0 0.0 0.0 bb;
}else{
button -e -bgc 0.0 0.0 0.0 bb;
}
}

sphere -n equinox;
select -cl;
doit ;

wgreenlee1
01-02-2004, 04:33 PM
works for me....
it makes a nurbs sphere with ur name on it......lol

is it supposed to do something more.....?


oh...you want it to make the sphere when you press test?is that what the prob is?

safakoner
01-02-2004, 04:51 PM
himmmmmm
I want to do like this


When I select sphere "equinox"

bb button background set to red

else

bb button background set to default. ( selection empty or any other object selected. )

wgreenlee1
01-02-2004, 05:29 PM
well then it needs to be something like:

else{
if nothing selected button -e -bgc 0.0 0.0 0.0 bb;
}

but i cant find any command to make it drop the color.....

wgreenlee1
01-02-2004, 09:43 PM
did you see this yet?
it dims the button
maybe it might work for button colors also?i dunno but i thought i would show this to you

________________________________
// Create a window with a menu item and button that will dim if
// there are no objects selected in the scene.
//
string $window = `window -menuBar true -title "dimWhen Example"`;
menu -label "Edit";
string $menuItem = `menuItem -label "Delete Selection" -command ("delete")`;
columnLayout -adjustableColumn true;
string $button = `button -label "Delete Selection" -command ("delete")`;

// Create a few buttons to create some objects, select all the objects in
// the scene, and clear the selection.
//
button -label "Create Objects" -command ("sphere; cone; cylinder;");
button -label "Select All" -command ("select -all");
button -label "Select Nothing" -command ("select -clear");

// Add the dim conditions.
//
dimWhen -false SomethingSelected $button;
dimWhen -false SomethingSelected $menuItem;

showWindow $window;
_______________________________
_______________________________

sbp
01-03-2004, 01:10 AM
Hi equinox,

Two problems. The first is the script job doesn't indicate what is selected, only the selection has changed, so you need to get the selection. The other is you need showWindow or something to force the window update.

global proc checkSimpleSelection()
{
string $sel[] = `ls -sl`;
if($sel[0] == "equinox") {
button -e -bgc 1.0 0.0 0.0 bb;
}else{
button -e -bgc 0.0 0.0 0.0 bb;
}
showWindow;
}

safakoner
01-05-2004, 10:39 AM
@sbp
@wgreenlee1

thanks you very much :bounce:
It is working :)

wgreenlee1
01-05-2004, 05:34 PM
Originally posted by equinox
@sbp
@wgreenlee1

thanks you very much :bounce:
It is working :)

can you show us what you got so i might learn whats going on that fixed it from theorigial one you had?

thx...sorry for the trouble

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