|
defaultPointLight is actually a maya script, rather than a base MEL command. I would think you got the script you are using by copying from the script editor… which is OK, but you might have better results using the pointLight command directly.
Your problem is that you are overwriting the default name pointLight1 each time you run the script. Only the first time you run it will the button be named pointLight1 when created.
I will attempt to make a script for you, and while the placement values may not be exactly what you want for each new light, you can probably modify this yourself to get it right.
string $pLightName = `pointLight -intensity 55.0 -rgb 0.8820000291 0.866271019 0.7876260281 -decayRate 2 -useRayTraceShadows 1 -shadowColor 0.0 0.0 0.0 -shadowSamples 2 -discRadius 0.1 -name "Point_A"`; setAttr ($pLightName+".rayDepthLimit") 4; move -r -os -wd 0 4.662165 0;
This will create a new light every time, starting with Point_A, then Point_A1, Point_A2 and so on. Edit the name in the script if you want to start with Point1 or something else, Maya will always add a digit on the end so each light has a unique name.
Note how I did this… I created a variable $pLightName which receives the name of the newly created light after the pointLight command makes it (and that name is passed as the -name parameter, so the rename is not needed. The setAttr command uses the actual new light name instead of pointLightShape1 name (so you don’t have your command overwriting a different light every time). Several of the parameter you were using setAttr on can be included in the pointLight command, so I put them there. Since the light is selected when it is made, there was no need to use the select command to select it again.
I tested it here and it makes and moves the lights where the code specifies. That is always the same place, you can edit the script to move it somewhere else, I just copied your code location.
You can find the documentation on the pointLight command in the technical documentation section of the Maya docs if you want to adjust some of the parameters, but I used the long names in teh command so it would be more obvious what everything does.
<* Wes *>
|