global proc doReset() { textFieldButtonGrp -edit -text "" masterMat; textScrollList -edit -ra slaveMat; checkBox -edit -v false chkDiffuse; checkBox -edit -v false chkTranslucence; checkBox -edit -v false chkTranslucenceDepth; checkBox -edit -v false chkTranslucenceFocus; checkBox -edit -v false chkEccentricity; checkBox -edit -v false chkSpecularRollOff; checkBox -edit -v false chkSpecularColor; checkBox -edit -v false chkReflectivity; checkBox -edit -v false chkReflectedColor; checkBox -edit -v false chkAngle; checkBox -edit -v false chkSpreadX; checkBox -edit -v false chkSpreadY; checkBox -edit -v false chkRoughness; checkBox -edit -v false chkFresnelIndex; checkBox -edit -v false chkSpecularColorA; checkBox -edit -v false chkReflectivityA; checkBox -edit -v false chkReflectedColorA; checkBox -edit -v false chkAnisotropicReflectivity; } global proc pickMasterMat() { string $sel[] = ` ls -sl `; $master = $sel[0]; textFieldButtonGrp -edit -text $master masterMat; } //select the object global proc pickSlaveMat() { $nodeList = `ls -o -sl`; for ( $cnt = 0; $cnt < size ( $nodeList ); $cnt++ ) textScrollList -e -append ( $nodeList[$cnt] ) slaveMat; } //delete the objects global proc delSlaveMat() { int $toDelete[] = `textScrollList -q -sii slaveMat`; if (size($toDelete) == 1) textScrollList -e -rii $toDelete[0] slaveMat; } global proc connect() { string $masterMat; string $slaveMats[]; string $attributes[]; int $counterAttr = 0; //get the materials $masterMat = `textFieldButtonGrp -q -text masterMat`; $slaveMats = `textScrollList -q -ai slaveMat`; //how many slaves? $numberOfSlaves = size($slaveMats); //which attr do I have to connect? if (`checkBox -q -v chkDiffuse`) { $attributes[$counterAttr] = "diffuse"; $counterAttr += 1; } if (`checkBox -q -v chkTranslucence`) { $attributes[$counterAttr] = "translucence"; $counterAttr += 1; } if (`checkBox -q -v chkTranslucenceDepth`) { $attributes[$counterAttr] = "translucenceDepth"; $counterAttr += 1; } if (`checkBox -q -v chkTranslucenceFocus`) { $attributes[$counterAttr] = "translucenceFocus"; $counterAttr += 1; } if (`checkBox -q -v chkEccentricity`) { $attributes[$counterAttr] = "eccentricity"; $counterAttr += 1; } if (`checkBox -q -v chkSpecularRollOff`) { $attributes[$counterAttr] = "specularRollOff"; $counterAttr += 1; } if (`checkBox -q -v chkSpecularColor`) { $attributes[$counterAttr] = "specularColor"; $counterAttr += 1; } if (`checkBox -q -v chkReflectivity`) { $attributes[$counterAttr] = "reflectivity"; $counterAttr += 1; } if (`checkBox -q -v chkReflectedColor`) { $attributes[$counterAttr] = "reflectedColor"; $counterAttr += 1; } if (`checkBox -q -v chkAngle`) { $attributes[$counterAttr] = "angle"; $counterAttr += 1; } if (`checkBox -q -v chkSpreadX`) { $attributes[$counterAttr] = "spreadX"; $counterAttr += 1; } if (`checkBox -q -v chkSpreadY`) { $attributes[$counterAttr] = "spreadY"; $counterAttr += 1; } if (`checkBox -q -v chkRoughness`) { $attributes[$counterAttr] = "roughness"; $counterAttr += 1; } if (`checkBox -q -v chkFresnelIndex`) { $attributes[$counterAttr] = "fresnelRefractiveIndex"; $counterAttr += 1; } if (`checkBox -q -v chkSpecularColorA`) { $attributes[$counterAttr] = "specularColor"; $counterAttr += 1; } if (`checkBox -q -v chkReflectivityA`) { $attributes[$counterAttr] = "reflectivity"; $counterAttr += 1; } if (`checkBox -q -v chkReflectedColorA`) { $attributes[$counterAttr] = "reflectedColor"; $counterAttr += 1; } if (`checkBox -q -v chkAnisotropicReflectivity`) { $attributes[$counterAttr] = "anisotropicReflectivity"; $counterAttr += 1; } $numberOfAttr = size($attributes); print $attributes; int $i; int $j; string $outMat; string $inMat; string $extra = ""; for($i=0;$i<$numberOfSlaves;$i++) { for ($j=0;$j<$numberOfAttr;$j++) { if (`attributeExists $attributes[$j] $slaveMats[$i]`) { $outMat = ($masterMat + "." + $attributes[$j]); $inMat = ($slaveMats[$i] + "." + $attributes[$j]); connectAttr -f $outMat $inMat; } } } print ("Connected Attributes: " + $numberOfAttr + " ; Connected Materials: " + $numberOfSlaves); } global proc alienCrow() { string $masterMat = ""; string $slaveMat = ""; if (`window -ex alienCrow`) deleteUI alienCrow; window -title "Alien Crow" alienCrow; formLayout rcl1; separator -style "in" sep1; textFieldButtonGrp -l "master" -cw 1 120 -text $masterMat -buttonLabel "Pick" -bc "pickMasterMat()" masterMat; separator -style "in" sep2; text -en true -label "slave(s)" slaveTxt; textScrollList -numberOfRows 5 -w 238 -ams false slaveMat; button -l "Pick" -c pickSlaveMat pickSlaveBtn; button -l "Del" -w 31 -c delSlaveMat delSlaveBtn; separator -style "in" sep3; text -en true -label "common attributes" txtCommon; checkBox -l "diffuse" -v false chkDiffuse; checkBox -l "translucence" -v false chkTranslucence; checkBox -l "translucence depth" -v false chkTranslucenceDepth; checkBox -l "translucence focus" -v false chkTranslucenceFocus; separator -style "in" sep5; text -en true -label "blinn attributes" txtBlinn; checkBox -l "eccentricity" -v false chkEccentricity; checkBox -l "specular rollOff" -v false chkSpecularRollOff; checkBox -l "specular color" -v false chkSpecularColor; checkBox -l "reflectivity" -v false chkReflectivity; checkBox -l "reflected color" -v false chkReflectedColor; separator -style "in" sep6; text -en true -label "anisotropic attributes" txtAni; checkBox -l "angle" -v false chkAngle; checkBox -l "spread x" -v false chkSpreadX; checkBox -l "spread y" -v false chkSpreadY; checkBox -l "roughness" -v false chkRoughness; checkBox -l "fresnel index" -v false chkFresnelIndex; checkBox -l "specular color" -v false chkSpecularColorA; checkBox -l "reflectivity" -v false chkReflectivityA; checkBox -l "reflected color" -v false chkReflectedColorA; checkBox -l "anisotropic reflectivity" -v false chkAnisotropicReflectivity; separator -style "in" sep7; rowLayout -nc 3 rl1; button -l "Connect" -align "center" -c connect -w 60 but1; button -l "Reset" -align "center" -c doReset -w 60 but2; button -l "Exit" -align "center" -c "evalDeferred \"deleteUI alienCrow\";" -w 60 but3; setParent..; separator -style "in" sep8; formLayout -e //layout object selection -af sep1 "top" 10 -af sep1 "left" 0 -af sep1 "right" 0 -af masterMat "left" -73 -ac masterMat "top" 10 sep1 -ac sep2 "top" 10 masterMat -af sep2 "left" 0 -af sep2 "right" 0 -af slaveTxt "left" 3 -ac slaveTxt "top" 10 sep2 -ac slaveMat "left" 8 slaveTxt -ac slaveMat "top" 10 sep2 -ac pickSlaveBtn "left" 2 slaveMat -ac pickSlaveBtn "top" 10 sep2 -ac delSlaveBtn "left" 2 slaveMat -ac delSlaveBtn "top" 5 pickSlaveBtn -ac sep3 "top" 15 slaveMat -af sep3 "left" 0 -af sep3 "right" 0 -ac txtCommon "top" 9 slaveMat -af txtCommon "left" 10 -ac chkDiffuse "top" 15 sep3 - af chkDiffuse "left" 10 -ac chkTranslucence "top" 0 chkDiffuse - af chkTranslucence "left" 10 -ac chkTranslucenceDepth "top" 0 chkTranslucence - af chkTranslucenceDepth "left" 10 -ac chkTranslucenceFocus "top" 0 chkTranslucenceDepth - af chkTranslucenceFocus "left" 10 -ac sep5 "top" 15 chkTranslucenceFocus -af sep5 "left" 0 -af sep5 "right" 0 -ac txtBlinn "top" 9 chkTranslucenceFocus -af txtBlinn "left" 10 -ac chkEccentricity "top" 15 sep5 - af chkEccentricity "left" 10 -ac chkSpecularRollOff "top" 0 chkEccentricity - af chkSpecularRollOff "left" 10 -ac chkSpecularColor "top" 0 chkSpecularRollOff - af chkSpecularColor "left" 10 -ac chkReflectivity "top" 0 chkSpecularColor - af chkReflectivity "left" 10 -ac chkReflectedColor "top" 0 chkReflectivity - af chkReflectedColor "left" 10 -ac sep6 "top" 15 chkReflectedColor -af sep6 "left" 0 -af sep6 "right" 0 -ac txtAni "top" 9 chkReflectedColor -af txtAni "left" 10 -ac chkAngle "top" 15 sep6 - af chkAngle "left" 10 -ac chkSpreadX "top" 0 chkAngle - af chkSpreadX "left" 10 -ac chkSpreadY "top" 0 chkSpreadX - af chkSpreadY "left" 10 -ac chkRoughness "top" 0 chkSpreadY - af chkRoughness "left" 10 -ac chkFresnelIndex "top" 0 chkRoughness - af chkFresnelIndex "left" 10 -ac chkSpecularColorA "top" 0 chkFresnelIndex - af chkSpecularColorA "left" 10 -ac chkReflectivityA "top" 0 chkSpecularColorA - af chkReflectivityA "left" 10 -ac chkReflectedColorA "top" 0 chkReflectivityA - af chkReflectedColorA "left" 10 -ac chkAnisotropicReflectivity "top" 0 chkReflectedColorA - af chkAnisotropicReflectivity "left" 10 -ac sep7 "top" 10 chkAnisotropicReflectivity -af sep7 "left" 0 -af sep7 "right" 0 -ac rl1 "top" 10 sep7 -af rl1 "left" 30 -af rl1 "right" 0 -ac sep8 "top" 10 rl1 -af sep8 "left" 0 -af sep8 "right" 0 rcl1; showWindow alienCrow; }