View Full Version : Can't get the correct syntax

11 November 2007, 01:49 PM

I have this command from the script editor:

connectAttr -f physical_light1.message areaLightShape2.miLightShader;

I need to replace areaLightShape2 with my array variable $LightSetup[ ] but I just can't get the correct syntax.

Can any of you guys help out?

EDIT: Looking at this more closely I have other problems! What I am trying to do is put up a window that lists all arealights in a scene and gives the user a check box to tick for each light, which will connect a Mental Ray physical light node.

These 3 lines of MEL do just that;

mrCreateCustomNode -asUtility "" physical_light;
defaultNavigation -ce -source physical_light -destination areaLightShape1.miLightShader;
connectAttr -f physical_light1.message areaLightShape1.miLightShader;

But I need to have my $LightSetup instead of areaLightShape1. Also if there were 2 or more area lights in the scene then the 3rd line would be incorrect as it would always attach physical_light1. Damn this is to complicated for my basic MEL knowledge!



11 November 2007, 06:33 PM
current line snippet:
-destination areaLightShape1.miLightShader;

if $LightSetup is an array and you wish to use the first element:
-destination ($LightSetup[0]+".miLightShader");

if $LightSetup is only a string:
-destination ($LightSetup+".miLightShader");

CGTalk Moderation
11 November 2007, 06:33 PM
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.