// LIGHT MANAGER V0.86 // // A MEL script that enables you to control large groups of lights from within a single GUI. // // There are many light parameters you can control within the GUI // // Written by Andrew Whitehurst 2005 // // Comments, bugs etc. to lightmanager AT gmail DOT com // // Full docs are at http://www.andrew-whitehurst.net/lightManager.html // // 0.86 - changelog - all procs now have "lightMan_" prefix. // 0.86 - changelog - intensity slider now not limited to 100 // 0.86 - changelog - made 5 attributes visible at once in the scroll menu list - see how we like it // global proc lightManager() { if (`window -exists lightManager`) deleteUI lightManager; // Check to see if lightManagerNode exists. If not make it. string $isNugget[] = `ls "lightManagerNode*"`; if ($isNugget[0] != "lightManagerNode"){ lightMan_buildNode(); } // MAKE THE ATTRIBUTES ON THE NODE UP TO DATE lightMan_updateNode(); // BUILD THE GUI lightMan_buildWindow(); } global proc lightMan_buildWindow(){ //Define the variables used throughout the proc int $counter = 1; string $currentCommand; float $currentGrpIntensity = 0; int $currentGrpNumLights = 0; int $collapseLayout = 1; //Get the light groups information and write it to an array string $lightGroups[]; string $getLightGrpsFromNode = `getAttr lightManagerNode.lightGroupString`; int $noButtons = tokenize($getLightGrpsFromNode,",", $lightGroups); //Main window is built here window -width 500 -height 200 -title "Light Manager - v0.86" lightManager; if ($counter == $noButtons){ $collapseLayout = 0; } columnLayout -rowSpacing 2 -columnOffset "left" 10; while ($counter <= $noButtons) { $currentGrpNumLights = lightMan_getCurrentGrpNum($lightGroups[$counter-1]); $currentGrpIntensity = lightMan_getCurrentGrpInt($lightGroups[$counter-1]); string $popOn = "lightMan_setGrpPopState(\""+$lightGroups[$counter-1]+"\",1)"; string $popOff = "lightMan_setGrpPopState(\""+$lightGroups[$counter-1]+"\",0)"; $currentCommand = $lightGroups[$counter-1]+" - "+$currentGrpNumLights+" lights with a total intensity of "+$currentGrpIntensity; frameLayout -collapsable true -collapse `getAttr ("lightManagerNode."+$lightGroups[$counter-1]+"Popped")` -label $currentCommand -width 500 -height (17+((1-`getAttr ("lightManagerNode."+$lightGroups[$counter-1]+"Popped")`)*68)) -la "center" -li 10 -mw 5 -cc $popOn -ec $popOff; columnLayout -columnAttach "both" 1 -rowSpacing 2 -columnWidth 750; rowLayout -numberOfColumns 4 -columnWidth4 80 80 90 550; $currentCommand = "lightMan_deleteLightGrp(\""+$lightGroups[$counter-1]+"\")"; button -label "Delete" -align "center" -width 80 -height 30 -annotation ("Deletes the "+$lightGroups[$counter-1]+" group and it's contents") -command $currentCommand; $currentCommand = "lightMan_removeSelectedLights(\""+$lightGroups[$counter-1]+"\")"; button -label "Remove" -align "center" -width 80 -height 30 -annotation ("Removes all selected lights from the "+$lightGroups[$counter-1]+" group") -command $currentCommand; $currentCommand = "lightMan_selectLightGrp(\""+$lightGroups[$counter-1]+"\")"; button -label "Sel All" -align "center" -width 80 -height 30 -annotation ("Selects all the lights in the "+$lightGroups[$counter-1]+" group") -command $currentCommand; $currentCommand = "lightMan_setCol(\""+$lightGroups[$counter-1]+"\")"; colorSliderGrp -rgb `getAttr ("lightManagerNode."+$lightGroups[$counter-1]+"ColR")` `getAttr ("lightManagerNode."+$lightGroups[$counter-1]+"ColG")` `getAttr ("lightManagerNode."+$lightGroups[$counter-1]+"ColB")` -cc $currentCommand -width 540 -height 30 -annotation ($lightGroups[$counter-1]+" group light colour")($lightGroups[$counter-1]+"Col"); setParent ..; rowLayout -numberOfColumns 4 -columnWidth4 80 80 90 550; $currentOnCommand = "hideLightGrp(\""+$lightGroups[$counter-1]+"\")"; $currentOffCommand = "lightMan_showLightGrp(\""+$lightGroups[$counter-1]+"\")"; checkBox -label "Hide Grp" -width 80 -height 30 -annotation ("Hides and templates the "+$lightGroups[$counter-1]+" group and it's contents")-onCommand $currentOnCommand -offCommand $currentOffCommand -value `getAttr ("lightManagerNode."+$lightGroups[$counter-1]+"GrpHidden")`; $currentCommand = "lightMan_renameLightGrp(\""+$lightGroups[$counter-1]+"\")"; button -label "Rename" -align "center" -width 80 -height 30 -annotation ("Rename the "+$lightGroups[$counter-1]+" group") -command $currentCommand; $currentCommand = "lightMan_addSelToLightGrp(\""+$lightGroups[$counter-1]+"\")"; button -label "Add Sel" -align "center" -width 80 -height 30 -annotation ("Adds currently selected lights to the "+$lightGroups[$counter-1]+" group") -command $currentCommand; $currentCommand = "lightMan_setInt(\""+$lightGroups[$counter-1]+"\")"; floatSliderGrp -field true -width 540 -value `getAttr ("lightManagerNode."+$lightGroups[$counter-1]+"Intensity")` -fmn -1000000000 -fmx 100000000 -pre 3 -ss 0.1 -annotation ($lightGroups[$counter-1]+" group light intensity") -cc $currentCommand ($lightGroups[$counter-1]+"Intensity"); setParent ..; setParent ..; $counter += 1; setParent ..; setParent ..; } $counter = 1; frameLayout -collapsable true -collapse 0 -label "Global Controls" -width 500 -height 270 -la "center" -li 10 -mw 5; columnLayout -columnAttach "both" 5 -rowSpacing 2 -columnWidth 750; separator -height 10 -style "in"; rowLayout -numberOfColumns 2 -columnWidth2 150 480; text -label "Create New Light Group" -font "boldLabelFont" -width 150; $currentCommand = "lightMan_addNewGrp(`textFieldButtonGrp -query -text newLightName`)"; textFieldButtonGrp -text "Group Name" -buttonLabel "Make Group" -height 30 -width 480 -cw1 480 -bc $currentCommand newLightName ; setParent ..; separator -height 10 -style "in"; rowLayout -numberOfColumns 2 -columnWidth2 170 460; text -label "Create New Light Attribute" -font "boldLabelFont" -width 170; $currentCommand = "lightMan_addNewAttr(`textFieldButtonGrp -query -text newAttrName`)"; textFieldButtonGrp -text "Attribute Name" -buttonLabel "Add Attr" -height 30 -width 460 -cw1 460 -bc $currentCommand newAttrName ; setParent ..; separator -height 18 -style "in"; rowLayout -numberOfColumns 5 - columnWidth5 140 150 40 70 80; text -label "Set All Selected Lights\'" -font "boldLabelFont" -width 140; string $currentAttr; string $attrGroups[]; string $getAttrGrpsFromNode = `getAttr lightManagerNode.attrList`; int $noAttr = tokenize($getAttrGrpsFromNode,",", $attrGroups); string $newAttrList = ""; for ($currentAttr in $attrGroups){ $newAttrList += " -append \""+$currentAttr+"\""; } eval ("textScrollList -numberOfRows 5 -width 150 -allowMultiSelection false "+$newAttrList+" -selectItem \"useDepthMapShadows\"-showIndexedItem 1 toDoList"); text -label " to be " -font "boldLabelFont" -width 40; floatField -width 60 toDoValue; $currentCommand = "lightMan_doGlobalAttrTweak()"; button -label "OK" -align "center" -width 80 -height 30 -annotation ("Sets the attributes as specified on the left") -command $currentCommand; //ADD GLOBAL TWEAK CONTROL HERE setParent ..; separator -height 10 -style "in"; rowLayout -numberOfColumns 4 -columnWidth4 120 120 120 120; $currentCommand = "lightMan_copySelLights()"; button -label "Copy Sel." -align "center" -width 120 -height 50 -annotation "Makes copies of the selected lights" -command $currentCommand; $currentCommand = "lightMan_scaleSelLights()"; button -label "Scale Sel." -align "center" -width 120 -height 50 -annotation "Scales all selected lights to unit size" -command $currentCommand;; $currentCommand = "lightMan_selAllLights()"; button -label "Select All" -align "center" -width 120 -height 50 -annotation "Selects all LightManager lights" -command $currentCommand; button -label "Update Stats" -align "center" -width 120 -height 50 -command "lightManager()" -annotation "Updates all the light data displayed in the GUI"; setParent ..; setParent ..; setParent ..; showWindow lightManager; } //PROCS RUN BY BUTTON PRESSES IN THE GUI global proc lightMan_selectLightGrp(string $currentGroup) { string $selectedNodes[] = `ls -l -lights -dag -allPaths`; string $currentObject; select -cl; for($currentObject in $selectedNodes){ if(`attributeExists "lightGroup" $currentObject`){ if(`getAttr($currentObject+".lightGroup")` == $currentGroup){ select -add $currentObject; } } } } global proc lightMan_deleteLightGrp(string $currentGroup) { $yesNo =`confirmDialog -message "Are you sure?" -button "Yes" -button "No" -defaultButton "Yes" -cancelButton "No" -dismissString "No"`; if($yesNo == "Yes"){ lightMan_selectLightGrp($currentGroup); pickWalk -d up; delete `ls -sl -dag -ap -l`; deleteAttr ("lightManagerNode."+$currentGroup+"ColR"); deleteAttr ("lightManagerNode."+$currentGroup+"ColG"); deleteAttr ("lightManagerNode."+$currentGroup+"ColB"); deleteAttr ("lightManagerNode."+$currentGroup+"Intensity"); deleteAttr ("lightManagerNode."+$currentGroup+"Popped"); deleteAttr ("lightManagerNode."+$currentGroup+"GrpHidden"); string $lightGroups[]; string $getLightGrpsFromNode = `getAttr lightManagerNode.lightGroupString`; int $noButtons = tokenize($getLightGrpsFromNode,",", $lightGroups); string $newList = ""; for ($currentObject in $lightGroups){ if($currentObject == $currentGroup){ $newList += ""; }else{ $newList += $currentObject+","; } } setAttr -type "string" lightManagerNode.lightGroupString $newList; lightMan_updateNode(); if (`window -exists lightManager`){ deleteUI lightManager; } lightMan_buildWindow(); } } global proc lightMan_renameLightGrp(string $currentGroup) { string $newName = $currentGroup; string $result = `promptDialog -message "Enter New Name:" -button "ok" -button "cancel" -defaultButton "ok" -cancelButton "cancel" -dismissString "cancel"`; if ($result == "ok"){ $newName = `promptDialog -query`; } int $counter = 1; string $lightGroups[]; string $getLightGrpsFromNode = `getAttr lightManagerNode.lightGroupString`; int $noButtons = tokenize($getLightGrpsFromNode,",", $lightGroups); //SPACE IN NAME AND DUPLICATE NAME ERROR CHECKING HERE string $checkNameArray[]; int $whiteSpaceQuery = tokenize($newName,$checkNameArray); if ($whiteSpaceQuery != 1){ error "This name has spaces in it. Please choose another."; $addName = $currentGroup; } while($counter <= $noButtons){ if ($lightGroups[$counter-1] == $newName){ error "This name is already in use. Please choose another."; $addName = $currentGroup; } $counter += 1; } lightMan_selectLightGrp($currentGroup); string $selectedNodes[] = `ls -l -selection -lights -dag -allPaths`; string $currentObject; for($currentObject in $selectedNodes){ setAttr -type "string" ($currentObject+".lightGroup") $newName; } renameAttr ("lightManagerNode."+$currentGroup+"ColR") ($newName+"ColR"); renameAttr ("lightManagerNode."+$currentGroup+"ColG") ($newName+"ColG"); renameAttr ("lightManagerNode."+$currentGroup+"ColB") ($newName+"ColB"); renameAttr ("lightManagerNode."+$currentGroup+"Intensity") ($newName+"Intensity"); renameAttr ("lightManagerNode."+$currentGroup+"Popped") ($newName+"Popped"); renameAttr ("lightManagerNode."+$currentGroup+"GrpHidden") ($newName+"GrpHidden"); string $lightGroups[]; string $getLightGrpsFromNode = `getAttr lightManagerNode.lightGroupString`; int $noButtons = tokenize($getLightGrpsFromNode,",", $lightGroups); string $newList = ""; for ($currentObject in $lightGroups){ if($currentObject == $currentGroup){ $newList += $newName; }else{ $newList += $currentObject; } $newList += ","; } setAttr -type "string" lightManagerNode.lightGroupString $newList; lightMan_updateNode(); if (`window -exists lightManager`){ deleteUI lightManager; } lightMan_buildWindow(); } global proc lightMan_addSelToLightGrp(string $currentGroup) { lightMan_updateLight($currentGroup); } global proc hideLightGrp(string $currentGroup) {; lightMan_selectLightGrp($currentGroup); string $selectedNodes[] = `ls -l -selection -lights -dag -allPaths`; string $currentObject; string $currentTransform; for($currentObject in $selectedNodes){ setAttr ($currentObject+".visibility") 0; setAttr ($currentObject+".template") 1; select $currentObject; pickWalk -d up; string $currentTransform[] = `ls -sl`; setAttr ($currentTransform[0]+".visibility") 0; setAttr ($currentTransform[0]+".template") 1; } setAttr ("lightManagerNode."+$currentGroup+"GrpHidden") 1; lightMan_selectLightGrp($currentGroup); } global proc lightMan_showLightGrp(string $currentGroup) { lightMan_selectLightGrp($currentGroup); string $selectedNodes[] = `ls -l -selection -lights -dag -allPaths`; string $currentObject; string $currentTransform; for($currentObject in $selectedNodes){ setAttr ($currentObject+".visibility") 1; setAttr ($currentObject+".template") 0; select $currentObject; pickWalk -d up; string $currentTransform[] = `ls -sl`; setAttr ($currentTransform[0]+".visibility") 1; setAttr ($currentTransform[0]+".template") 0; } lightMan_selectLightGrp($currentGroup); setAttr ("lightManagerNode."+$currentGroup+"GrpHidden") 0; } global proc lightMan_doGlobalAttrTweak() { string $toDoAttr[] = `textScrollList -query -selectItem toDoList`; float $toDoValue = `floatField -query -value toDoValue`; string $selectedNodes[] = `ls -l -sl -lights -dag -allPaths`; string $currentObject; select -cl; for($currentObject in $selectedNodes){ if(`attributeExists "lightGroup" $currentObject`){ setAttr ($currentObject+"."+$toDoAttr[0]) $toDoValue; } } select $currentObject; } global proc lightMan_copySelLights() { duplicate -rr -ic; } global proc lightMan_scaleSelLights() { string $selectedNodes[] = `ls -l -dag -ap -lights`; select -cl; string $currentObject; string $currentTransform[]; for($currentObject in $selectedNodes){ if(`attributeExists "lightGroup" $currentObject`){ select $currentObject; pickWalk -d up; string $currentTransform[] = `ls -sl -tail 1`; setAttr ($currentTransform[0]+".scaleX") 1; setAttr ($currentTransform[0]+".scaleY") 1; setAttr ($currentTransform[0]+".scaleZ") 1; } } } global proc lightMan_selAllLights() { string $selectedNodes[] = `ls -l -dag -ap -lights`; select -cl; string $currentObject; for($currentObject in $selectedNodes){ if(`attributeExists "lightGroup" $currentObject`){ select -add $currentObject; } } } global proc lightMan_setCol(string $currentGroup) { float $tempCol[] = `colorSliderGrp -q -rgb ($currentGroup+"Col")`; setAttr ("lightManagerNode."+$currentGroup+"ColR") $tempCol[0]; setAttr ("lightManagerNode."+$currentGroup+"ColG") $tempCol[1]; setAttr ("lightManagerNode."+$currentGroup+"ColB") $tempCol[2]; //SELECT ALL LIGHTS //CHECK IF NAME NODE MATCHES CURRENT GROUP AND SET NEW COLOUR IF IT DOES } global proc lightMan_setInt(string $currentGroup) { float $tempInt = `floatSliderGrp -q -v ($currentGroup+"Intensity")`; setAttr ("lightManagerNode."+$currentGroup+"Intensity") $tempInt; //SELECT ALL LIGHTS //CHECK IF NAME NODE MATCHES CURRENT GROUP AND SET NEW INTENSITY IF IT DOES } global proc lightMan_setGrpPopState(string $currentGroup, int $onOff) { setAttr ("lightManagerNode."+$currentGroup+"Popped") $onOff; } global proc lightMan_addNewGrp(string $newGroupName) { int $counter = 1; string $addName = $newGroupName; string $lightGroups[]; string $getLightGrpsFromNode = `getAttr lightManagerNode.lightGroupString`; int $noButtons = tokenize($getLightGrpsFromNode,",", $lightGroups); //SPACE IN NAME AND DUPLICATE NAME ERROR CHECKING HERE string $checkNameArray[]; int $whiteSpaceQuery = tokenize($addName,$checkNameArray); if ($whiteSpaceQuery != 1){ error "This name has spaces in it. Please choose another."; $addName = ""; } while($counter <= $noButtons){ if ($lightGroups[$counter-1] == $addName){ error "This name is already in use. Please choose another."; $addName = ""; } $counter += 1; } string $getLightGrpsFromNode = $getLightGrpsFromNode+","+$addName; setAttr -type "string" lightManagerNode.lightGroupString $getLightGrpsFromNode; lightMan_updateNode(); if (`window -exists lightManager`){ deleteUI lightManager; } lightMan_buildWindow(); } global proc lightMan_addNewAttr(string $newAttrName) { int $counter = 1; int $addAttrToLights = 1; string $addName = $newAttrName; string $lightAttrs[]; string $getLightAttrsFromNode = `getAttr lightManagerNode.attrList`; int $noButtons = tokenize($getLightAttrsFromNode,",", $lightAttrs); //SPACE IN NAME AND DUPLICATE NAME ERROR CHECKING HERE string $checkNameArray[]; int $whiteSpaceQuery = tokenize($addName,$checkNameArray); if ($whiteSpaceQuery != 1){ error "This name has spaces in it. Please choose another."; $addName = ""; $addAttrToLights = 0; } while($counter <= $noButtons){ if ($lightAttrs[$counter-1] == $addName){ error "This name is already in use. Please choose another."; $addName = ""; $addAttrToLights = 0; } $counter += 1; } if ($addAttrToLights != 0){ lightMan_selAllLights(); string $selectedNodes[] = `ls -sl -lights`; select -cl; string $currentObject; for($currentObject in $selectedNodes){ lightMan_safeAddFloatAttr($addName,$currentObject,0); } } string $getLightAttrsFromNode = $addName+","+$getLightAttrsFromNode; setAttr -type "string" lightManagerNode.attrList $getLightAttrsFromNode; lightMan_updateNode(); if (`window -exists lightManager`){ deleteUI lightManager; } lightMan_buildWindow(); } // UNDER THE BONNET PROCS TO GATHER DATA FOR THE GUI STATS global proc int lightMan_getCurrentGrpNum(string $currentGroup) { lightMan_selectLightGrp($currentGroup); string $getNumLights[] = `ls -sl`; int $getCurrentLightNum = size($getNumLights); return $getCurrentLightNum; } global proc float lightMan_getCurrentGrpInt(string $currentGroup) { lightMan_selectLightGrp($currentGroup); string $getNumLights[] = `ls -sl`; float $getCurrentLightInt = size($getNumLights)*`getAttr ("lightManagerNode."+$currentGroup+"Intensity")`; return $getCurrentLightInt; } // PROC TO BUILD THE LIGHTMANAGER NODE global proc lightMan_buildNode(){ scriptNode -n "lightManagerNode"; addAttr -longName lightGroupString -dt "string" "lightManagerNode"; setAttr -type "string" lightManagerNode.lightGroupString "default"; } // PROC TO CHECK EXISTENCE OF THEN ADD FLOAT ATTRIBUTE global proc lightMan_safeAddFloatAttr(string $currentAttr, string $currentNode, int $floatValue) { if (`attributeExists $currentAttr $currentNode ` == 0) { addAttr -longName $currentAttr -at double -dv $floatValue $currentNode; } } // PROC TO CHECK EXISTENCE OF THEN ADD BOOLEAN ATTRIBUTE global proc lightMan_safeAddBoolAttr(string $currentAttr, string $currentNode, int $boolValue) { if (`attributeExists $currentAttr $currentNode ` == 0) { addAttr -longName $currentAttr -at bool -dv $boolValue $currentNode; } } // PROC TO CHECK EXISTENCE OF THEN ADD STRING ATTRIBUTE global proc lightMan_safeAddStringAttr(string $currentAttr, string $currentNode, string $stringValue) { if (`attributeExists $currentAttr $currentNode` == 0) { addAttr -longName $currentAttr -dt "string" $currentNode; setAttr -type "string" ($currentNode+"."+$currentAttr) $stringValue; } } //PROC TO KEEP THE LIGHTMANAGERNODE UP TO DATE global proc lightMan_updateNode(){ $counter = 1; string $listOParams = "useDepthMapShadows,useRayTraceShadows,shadowRays,rayDepthLimit,rayDepth,decayRate,emitDiffuse,emitSpecular,lightRadius,castSoftShadows,dmapFilterSize,dmapResolution,dmapBias,receiveShadows,coneAngle,penumbraAngle,dropoff"; lightMan_safeAddStringAttr("attrList","lightManagerNode",$listOParams); string $lightGroups[]; string $getLightGrpsFromNode = `getAttr lightManagerNode.lightGroupString`; int $noButtons = tokenize($getLightGrpsFromNode,",", $lightGroups); string $currentAttr; while ($counter <= $noButtons) { // Check each node's existence and add it if needed $currentAttr = $lightGroups[$counter-1]+"ColR"; lightMan_safeAddFloatAttr($currentAttr,"lightManagerNode",1); $currentAttr = $lightGroups[$counter-1]+"ColG"; lightMan_safeAddFloatAttr($currentAttr,"lightManagerNode",1); $currentAttr = $lightGroups[$counter-1]+"ColB"; lightMan_safeAddFloatAttr($currentAttr,"lightManagerNode",1); $currentAttr = $lightGroups[$counter-1]+"Intensity"; lightMan_safeAddFloatAttr($currentAttr,"lightManagerNode",1); $currentAttr = $lightGroups[$counter-1]+"Popped"; lightMan_safeAddBoolAttr($currentAttr,"lightManagerNode",0); $currentAttr = $lightGroups[$counter-1]+"GrpHidden"; lightMan_safeAddBoolAttr($currentAttr,"lightManagerNode",0); $counter += 1; } } //PROC TO ADD ATTRIBUTES AND CONNECTIONS TO LIGHTS global proc lightMan_updateLight(string $currentGroup) { string $selectedNodes[] = `ls -l -selection -lights -dag -allPaths`; string $currentObject; for($currentObject in $selectedNodes){ lightMan_safeAddStringAttr("lightGroup", $currentObject, $currentGroup); setAttr -type "string" ($currentObject+".lightGroup") $currentGroup; if(`connectionInfo -isDestination ($currentObject+".colorR")`){ disconnectAttr `connectionInfo -sourceFromDestination ($currentObject+".colorR")` ($currentObject+".colorR"); } if(`connectionInfo -isDestination ($currentObject+".colorG")`){ disconnectAttr `connectionInfo -sourceFromDestination ($currentObject+".colorG")` ($currentObject+".colorG"); } if(`connectionInfo -isDestination ($currentObject+".colorB")`){ disconnectAttr `connectionInfo -sourceFromDestination ($currentObject+".colorB")` ($currentObject+".colorB"); } if(`connectionInfo -isDestination ($currentObject+".intensity")`){ disconnectAttr `connectionInfo -sourceFromDestination ($currentObject+".intensity")` ($currentObject+".intensity"); } connectAttr ("lightManagerNode."+$currentGroup+"ColR") ($currentObject+".colorR"); connectAttr ("lightManagerNode."+$currentGroup+"ColG") ($currentObject+".colorG"); connectAttr ("lightManagerNode."+$currentGroup+"ColB") ($currentObject+".colorB"); connectAttr -f ("lightManagerNode."+$currentGroup+"Intensity")($currentObject+".intensity"); select $currentObject; } lightMan_selectLightGrp($currentGroup); } //PROC TO REMOVE LIGHTS FROM THEIR GROUP BUT PRESERVE THEIR COLOUR AND INTENSITY VALUES global proc lightMan_removeSelectedLights(string $currentGroup) { string $selectedNodes[] = `ls -l -selection -lights -dag -allPaths`; string $currentObject; select -cl; for($currentObject in $selectedNodes){ if(`attributeExists "lightGroup" $currentObject`){ if(`getAttr($currentObject+".lightGroup")` == $currentGroup){ select -add $currentObject; } } } string $selectedNodes[] = `ls -sl`; float $tempColR = 0; float $tempColG = 0; float $tempColB = 0; float $tempIntensity = 0; for($currentObject in $selectedNodes){ $tempColR = `getAttr ($currentObject+".colorR")`; $tempColG = `getAttr ($currentObject+".colorG")`; $tempColB = `getAttr ($currentObject+".colorB")`; $tempIntensity = `getAttr ($currentObject+".intensity")`; disconnectAttr `connectionInfo -sourceFromDestination ($currentObject+".colorR")` ($currentObject+".colorR"); disconnectAttr `connectionInfo -sourceFromDestination ($currentObject+".colorG")` ($currentObject+".colorG"); disconnectAttr `connectionInfo -sourceFromDestination ($currentObject+".colorB")` ($currentObject+".colorB"); disconnectAttr `connectionInfo -sourceFromDestination ($currentObject+".intensity")` ($currentObject+".intensity"); setAttr ($currentObject+".colorR") $tempColR; setAttr ($currentObject+".colorG") $tempColG; setAttr ($currentObject+".colorB") $tempColB; setAttr ($currentObject+".intensity") $tempIntensity; deleteAttr ($currentObject+".lightGroup"); } }