quick script to switch control selection to the opposite controller

quick script to switch control selection to the opposite controller

Anonymous
Not applicable
1,530 Views
2 Replies
Message 1 of 3

quick script to switch control selection to the opposite controller

Anonymous
Not applicable

 Hey all,

I have virtually no mel/python knowledge. So I was hoping this might be something super easy you could help me out with! 

 

Im trying to make a little script that, first looks at the name of the animation control I have selected. 

 

for example: 

namespacedCharactername:HandCtrl_L

 

and switchs the selection to the opposite control, so in this example

 

namespacedCharactername:HandCtrl_R

 

if we presume that naming conventions are always the same, just the character name, and the name of the controller will change, but not the format of the naming convention

 

Thanks!

 

 

0 Likes
1,531 Views
2 Replies
Replies (2)
Message 2 of 3

rajasekaransurjen
Collaborator
Collaborator

Hi,

Hope this will help.

 

 

global proc rsMirrorSelect()    
{    
    string $rsSl[];
    $rsSl = `ls -sl`;
    int $numTokens;
    string $rsTemp[];
    $numTokens = `tokenize $rsSl[0] "_" $rsTemp`;
    if($rsTemp[$numTokens-1]=="R")
    {
        select -r ($rsTemp[0]+"_L");
    }
    else
    {
        select -r ($rsTemp[0]+"_R");
    }
}
global proc rsWinMirrorSelect()
{
    if (`window -exists "winMirrorSelection"`) deleteUI winMirrorSelection;
    string $window = `window -title "Mirror Selection" -widthHeight 260 55 winMirrorSelection`;
    columnLayout -adjustableColumn true;
           button -label "MIrror Selection" -c rsMirrorSelect;
           button -label "Close" -command ("deleteUI -window " + $window);
    setParent ..;
    showWindow $window;
}
rsWinMirrorSelect;

 

Best regards,
Rajasekaran Surjen.

Message 3 of 3

dg3duy
Collaborator
Collaborator

@rajasekaransurjen 4 years later this code is very useful, thank you very much for sharing it.

0 Likes