Maya Shelf

From bernie's
Jump to navigation Jump to search

Locator from manip tool

//trick from NathanN @cgtalk
setToolTo moveSuperContext; 
vector $centerPos = `manipMoveContext -q -position Move`;
vector $rot = `manipMoveContext -q -oa Move`;
$b = `spaceLocator`;
move -r ($centerPos.x) ($centerPos.y) ($centerPos.z) $b;
rotate -r (rad_to_deg($rot.x)) (rad_to_deg($rot.y)) (rad_to_deg($rot.z))

Show/hide joints

string $firstJoints[] = `ls -typ "joint" -tail 1`;
int $showHide = `getAttr($firstJoints[0]+".drawStyle")`;
$showHide = ($showHide == 0)? 2:0;
for($j in `ls -typ "joint"`){
    setAttr ($j+".drawStyle") $showHide;

Wire color Chooser

global string $cursel[];
proc string changeColor(){
    global string $cursel[];
    if(size(`ls -sl`)>0 || size($cursel)> 0){
        if(size(`ls -sl`)>0){
            $cursel = `ls -sl`;
        select -cl;
        for($obj in $cursel){
            string $shap[] = `listRelatives -s -f $obj`;
            $v = `colorIndexSliderGrp -q -v "colorSlider"`;
            if($shap[0] == ""){
                setAttr ($obj+".overrideEnabled") 1;
                setAttr ($obj+".overrideRGBColors") 0;
                setAttr ($obj+".overrideColor") $v;  
            for($s in $shap){ 
                setAttr ($s+".overrideEnabled") 1;
                setAttr ($s+".overrideRGBColors") 0;
                setAttr ($s+".overrideColor") $v;  
    return 1;
proc plop(){
    global string $cursel[];
    select -r $cursel;
    $cursel = {};

string $window = `window -title "Change color"`;
string $slid = `colorIndexSliderGrp -label "Select Color" -min 0 -max 31 -cc "plop()" -dc "changeColor()" "colorSlider"`;
showWindow $window;