View Full Version : UI command trouble

03-31-2007, 10:52 PM

If you create a fast simple sss shader and go to the light linking/ lights part in the attribute editor, you'll see : lights[0] and then a mappable area.. If you map a light to it and then go back to that section, there will be lights[0] and right under it lights[1]..

If anyone knows how to do that, I'd greatly appreciate the help as I am very new to mel.


04-01-2007, 11:04 AM
Here you go:

string $skinShader = "misss_fast_skin_maya1";
string $lightShapeName = "directionalLightShape1";

int $size = `getAttr -s ($skinShader + ".lights" )`;
connectAttr ($lightShapeName+".message") ($skinShader + ".lights[" + $size + "]") ;

Basically you need to specify the light and the shader node. Then it checks how many lights are already connected to the shader and the connects it to a "free slot". This is not a 100 % failure proof method but should work okay. Remember you need to connect the light`s shape name to the shader.
Hope this helps

CGTalk Moderation
04-01-2007, 11:04 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.