I'm trying to write a tool, and I'm running into an issue with fprint writing the object name to the text file. All the light attributes work just fine, but the light name... not so much. Basically, this is what I'm doing:
Everything works great, except... whenever I try to include the object name, the name of the light, it craps out on me, and says it can't convert the type $string to string. What am I missing?
I need this to collect all of the light basic information:
Light name - currently failing.
Light Rotation - works fine.
Light color - works fine.
Light intensity - works fine.
Write it all to a text file - works fine until I try to add the light name.
Any help would be appreciated!
I think the problem is that when you use the listRelatives command to get the name of the light's transform node, that name gets stored as an array by default.
This is a pretty common behaviour in Maya: any command that could sometimes return an array of values will always return an array, even when it's just returning a single item. We humans tend to assume that if there's only one item in a response, it should be a regular string, not a single-item string array... but that's not how it works in Maya's 'mind'.
Try fprinting "$getLightSettings" and your script will probably work.