PDA

View Full Version : shift select custom buttons


patbb
10-18-2005, 12:33 AM
Hi,


Ok here i have my own little window, with a whole bunch of buttons to select part of my character easily.

is there a way to shift select theses buttons?

(bottom is a part of my little window)

Thanks, btw this is my first script, if you have any suggestion to add cool stuff instead of beeing a boring little window, please let me know. It was alot of fun to do...

thanks!

-p


================

if (`window -exists Window`)

deleteUI Window;





window -widthHeight 700 800 -title "Select" Window;

frameLayout

-label "select"

-labelAlign "top"

-borderStyle "out";

rowColumnLayout -numberOfColumns 5 -columnWidth 1 75 -columnWidth 2 75 -columnWidth 3 75 -columnWidth 4 75 -columnWidth 5 75;





button -label "FKL- Arm All" -command ("select -r chr01:CNT_CLAVICLE_L chr_01:CNT_FKARM_L chr_01:CNT_FKELBOW_L chr01:CNT_FKHAND_L chr_01:CNT_HANDATTRS_L") -align "left";

button -label "L- Hand att" -command ("select -r chr_01:CNT_HANDATTRS_L") -align "left";

button -label "Spine-All" -command ("select -r chr_01:CNT_ROOT chr_01:CNT_SPINE2 chr_01:CNT_NECK chr_01:CNT_HEAD");

button -label "Hand att -R" -command ("select -r chr_01:CNT_HANDATTRS_R") -align "right";

button -label "Arm All -FKR" -command ("select -r chr_01:CNT_FKARM_R chr_01:CNT_FKELBOW_R chr_01:CNT_FKHAND_R chr_01:CNT_HANDATTRS_R chr_01:CNT_CLAVICLE_R") -align "right";

button -label "FKL- Should" -command ("select -r chr_01:CNT_FKARM_L") -align "left";

button -label "L- Clav" -command ("select -r chr_01:CNT_CLAVICLE_L") -align "left";

button -label "Head" -command ("select -r chr_01:CNT_HEAD");

etc etc etc...

thanks

goleafsgo
10-18-2005, 02:39 PM
By "shift select" do you mean that you want to check for the shift key and then toggle selection instead? If you want to do that then instead of putting the select command in the -command flag you could call a proc. Then in your proc you could check if the shift key is down, check out the "getModifiers" command in the help, and then do a different type of selection.

Is that what you were getting at?

patbb
10-18-2005, 04:15 PM
thanks man, but i don't really understand what you are saying... :(
I forgot to say that i don't know anything about scripting and that baby talk was appropriate if you wanted me to understand anything.

here is what i want to do.
let say i have one button to select the hand control, one button to select the elbow, and one to select the shoulder.

all i want to do is to click on the hand button to select the hand, then while holding the shift key, click on the elbow and shoulder button to select them as well.

So i end up having the hand, elbow and shoulder selected.

So far i worked around it and just added another button that select the 3 objects together but it takes more place and i was just curious to see the proper method of doing this.

I think this is what you tryed to tell me, and i took a quick look at the help file for procedures and getmodifiers but i don't understand any of that just yet so i'll try to read some more tonight and try to figure it ut.

thanks alot for the help.


-p

goleafsgo
10-18-2005, 04:33 PM
To get you started, here are the basic steps that you will need to take...
I haven't run any of this code so there may be typos or whatever but this is one approach that you can take.

1. Instead of something like this in your UI:

-command ("select -r chr_01:CNT_HANDATTRS_L")

you will want to call a proc like this:

-command ("selectMyHand")


2. Then you need to implement the "selectMyHand" proc which will check to see if the shift key is down and then add to selection or replace selection. Something like this:

global proc selectMyHand()
{
int $mods = `getModifiers`;

// this should be true if the shift key is
// down...this comes from the getModifier
// help page.
if (($mods / 1) % 2)
{
// since the shift key is down we will use
// the -add flag instead of the -r flag, which
// replaces the selection.
select -add chr_01:CNT_HANDATTRS_L;
}
else
{
// since the shift key is not down we just
// replace the selection with the -r flag.
select -r chr_01:CNT_HANDATTRS_L;
}
}

patbb
10-18-2005, 07:40 PM
thanks alot, it worked (after i removed the "{}" after if and else)

thanks for the help, it inspire me to add a bunch of stuff to this window, and learn about scripts...

-p

CGTalk Moderation
10-18-2005, 07:40 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.