View Full Version : How to I turn off my selection light sources ?
05 May 2010, 03:09 AM
I design a window and two buttons .
button names are "Off Spot Lights" and " Off Point Lights".
This is my Mel Script :
rowColumnLayout -nc 2 ;
button -label "Off Spot Lights";
button -label "Off point Lights";
I have some light sources in my viewport and I selected them.
I want to write a command for these buttons .
I want to turn off "illuminates by default" parameter only for it's light type when I click on it's button.
Such as I want to turn off "illuminates by default" parameter in attribute editor only for my spot lights when I click on "Off Spot Lights" button.
Sorry for my english.
global proc turnOffLight(string $type)
string $lights = `ls -sl -dag -typ $type`;
for ($light in $lights)
string $lightTransform = `listRelatives -ni -p $light`;
string $lightSet = `listConnections -s 0 -d 1 -p 1 -t "objectSet" $lightTransform`;
if (`strcmp "" $lightSet`)
disconnectAttr ($lightTransform+".instObjGroups") $lightSet;
turnOffLight("spotLight"); // turns off illuminate by Default for spot lights
turnOffLight("pointLight"); // turns off illuminate by Default for point lights
turnOffLight("directionalLight"); // turns off illuminate by Default for directional lights
turnOffLight("ambientLight"); // turns off illuminate by Default for ambient lights
turnOffLight("areaLight"); // turns off illuminate by Default for area lights
// you can assign these commands to a button or something.
05 May 2010, 12:44 AM
thank you EJ , you are king of scripting.
05 May 2010, 12:45 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.