global proc callControls() { global string $oddType; global string $activeOdd[]; $activeOdd = `ls -sl`; if (`size($activeOdd)` > 0) $oddType = nodeType($activeOdd[0]); if (`size($activeOdd)` > 0) { if ($oddType == "character") { string $setMembers[] = `character -q -no -et -er -es $activeOdd[0]`; rowColumnLayout -nc 5 -cw 1 10 -cw 2 75 -cw 3 35 -cw 4 35 -cw 5 155 ; for ($memb in $setMembers) { string $controlAttr = `character -q -cp ($memb + ".visibility")`; text -l ""; text -l ($memb); button -w 35 -l "Off" -c ("setAttr " + $controlAttr + " 0"); button -w 35 -l "On" -c ("setAttr " + $controlAttr + " 1"); //button -w 35 -l "Key" -c ("setKeyframe " + $controlAttr); attrFieldSliderGrp -min 0 -max 1 -fmn 0 -fmx 1 -l "" -cal 1 "left" -cal 2 "left" -cal 3 "left" -cw 1 1 -cw 2 34 -cw 3 100 -pre 0 -s 1 -at $controlAttr $memb ; } } else { int $cnt; rowColumnLayout -nc 5 -cw 1 10 -cw 2 75 -cw 3 35 -cw 4 35 -cw 5 155 ; for ($cnt = 0; $cnt < size($activeOdd); $cnt++) { text -l ""; text -label $activeOdd[$cnt]; button -w 100 -l "Off" -c ("setAttr " + $activeOdd[$cnt] + ".visibility 0"); button -w 100 -l "On" -c ("setAttr " + $activeOdd[$cnt] + ".visibility 1"); attrFieldSliderGrp -min 0 -max 1 -step 1 -cw 1 1 -cw 2 50 -cw 3 100 -cal 2 "left" -pre 0 -l "" -at ($activeOdd[$cnt] + ".visibility") ; } } } else { text -l "\nWelcome to OddSync v3\n To create a new OddSync group, select your\n desired objects and then hit Edit -> Create\n To use an existing OddSync group, select it\nfrom the list to the left and hit the Refresh\nbutton.\n- James"; } } //end proc ////////////////////////////// //Procs To Control The State Of Objects ////////////////////////////// global proc setAllOne() { global string $oddType; global string $activeOdd[]; if ($oddType == "character") { string $oddAttr[] = `listAnimatable $activeOdd[0]`; for ($atr in $oddAttr) { if (`getAttr -l $atr` == 1) print ($atr + " is locked"); else catch(`setAttr $atr 1`); } } else { int $oneCnt; for ($oneCnt = 0; $oneCnt < size($activeOdd); $oneCnt++) { catch(`setAttr ($activeOdd[$oneCnt] + ".visibility") 1`); } } } //end proc global proc setAllZero() { global string $oddType; global string $activeOdd[]; if ($oddType == "character") { string $oddAttr[] = `listAnimatable $activeOdd[0]`; for ($atr in $oddAttr) { catch(`setAttr $atr 0`); } } else { int $zeroCnt; for ($zeroCnt = 0; $zeroCnt < size($activeOdd); $zeroCnt++) { catch(`setAttr ($activeOdd[$zeroCnt] + ".visibility") 0`); } } } //end proc global proc keyAllPhon() { global string $oddType; global string $activeOdd[]; if ($oddType == "character") { string $oddAttr[] = `listAnimatable $activeOdd[0]`; for ($atr in $oddAttr) { catch(`setKeyframe $atr`); //$controlAttr; } } else { int $keyCnt; for ($keyCnt = 0; $keyCnt < size($activeOdd); $keyCnt++) { catch(`setKeyframe ($activeOdd[$keyCnt] + ".visibility")`); } } } //end proc global proc selectAll() { global string $oddType; global string $activeOdd[]; if ($oddType == "character") { select (`character -q -no $activeOdd[0]`); } else { select -cl; select $activeOdd; } } //end proc global proc applyNewOS() { global string $activeOdd[]; string $oddSyncName = `textFieldGrp -q -tx SyncName`; if (`size($activeOdd)` <= 0) error "No objects selected"; else character -et -er -es -ed -n ($oddSyncName + "_Odd"); } //end proc ////////////////////////////// //Procs To Create New OddSync Character Sets ////////////////////////////// global proc createNewOS() { global string $activeOdd[]; string $oddSyncName = `textFieldGrp -q -tx SyncName`; if (`size($activeOdd)` <= 0) error "No objects selected"; else character -et -er -es -ed -n ($oddSyncName + "_Odd"); string $createNewOSWin = "createOddSync"; deleteUI -wnd $createNewOSWin; } //end proc global proc createNewOSWin() { global string $activeOdd[]; string $createNewOSWin = "createOddSync"; if (`window -exists $createNewOSWin`) deleteUI $createNewOSWin; window -t "Create New OddSync" //-wh 350 75 -rtf 1 $createNewOSWin; rowColumnLayout -nr 2 -rh 1 25 -rh 2 25 -ral 1 "center" -ral 2 "center" ; textFieldGrp -l "OddSync Name" -cal 1 "left" -cw 1 100 -w 100 -h 25 SyncName ; rowColumnLayout -nc 3 -cw 1 100 -cw 2 100 -cw 3 100 -cal 1 "center" -cal 2 "center" -cal 3 "center" ; button -w 100 -al "center" -l "Create" -c "createNewOS()"; button -w 100 -al "center" -l "Apply" -c "applyNewOS()"; button -w 100 -al "center" -l "Cancel" -c ("deleteUI -wnd " + $createNewOSWin); showWindow $createNewOSWin; } ////////////////////////////// //Main OddSync Proc ////////////////////////////// global proc oddSync() { global string $activeOdd[]; string $oddSyncMainWin = "OddSyncMain"; if (`window -exists $oddSyncMainWin`) deleteUI $oddSyncMainWin; window -t "OddSync v3" //-wh 585 294 //-wh 425 275 -mb 1 -rtf 1 $oddSyncMainWin ; menu -l "Edit" -to 0; menuItem -l "Create..." -c "createNewOSWin()"; //menuItem -l "Delete" -c "delete"; menuItem -d 1; menuItem -l "Graph Editor" -c GraphEditor ; string $oddForm = `formLayout -numberOfDivisions 100 OddSyncForm`; if (`itemFilter -exists OddFilter` != 1) { itemFilter -bt "character" -bt "script" -bn "*_Odd" OddFilter ; } string $oddOutColumn = `rowColumnLayout -nc 1 -cw 1 155`; string $oddLiner = `outlinerEditor -mlc "worldList" -slc "modelList" -ssm 1 -ams 0 -dip 0 -f "OddFilter" OddLiner `; setParent $oddForm; string $oddControls = `rowColumnLayout -nc 2 -cw 1 80 -cw 2 350 -cs 1 5 -cs 2 15 `; rowColumnLayout -nc 1 -cw 1 80 ; text -fn "boldLabelFont" -l "Sync Controls"; button -w 100 -l "Refresh ->" -c "oddSync()"; text -l ""; button -w 100 -l "Set All On" -c "setAllOne()"; button -w 100 -l "Set All Off" -c "setAllZero()"; button -w 100 -l "KeyAll" -c "keyAllPhon()"; text -l ""; button -w 50 -l "Select All" -c "selectAll()"; setParent $oddForm; string $oddScroll = `scrollLayout -hst 0 -w 350`; callControls(); formLayout -edit -attachForm $oddOutColumn "top" 0 -attachForm $oddOutColumn "left" 0 -attachForm $oddOutColumn "bottom" 0 //-attachForm $oddOutColumn "right" 0 -attachForm $oddScroll "top" 0 -attachForm $oddScroll "bottom" 3 -attachForm $oddScroll "right" 3 -attachForm $oddScroll "left" 245 -attachForm $oddControls "top" 0 -attachForm $oddControls "left" 155 $oddForm ; showWindow $oddSyncMainWin; } oddSync();