A little script to add the light annotations

Inspired by my Friend Al Torres, I wrote a script to add annotations to all the lights in the scene.

Also, if lights’ names have been changed by usrs, re-run the script will update the annotations.

Since it’s very small script, and I don’t want people bother too much to install pymel, I wrote it with default python for Maya script.       This scriptif for usr has a lot of lights in the scene and might have a hard time to remember which light is for what…

Also, name the lights properly before using this script will be a good choice.

create annotations and updated names

annotations added and updated

Here is the script:

ling_addLights_annotation

Copy the codes and run in scripts editor. Hope this will help

Update: The last version of script has some bug: if a light in the scene has more than one children node, the script will not working due to my cheesy approach of finding the annotation node. For example:


Sometimes when duplicating the light an annoying camera node will be created

annoying camrea with the light

Sometimes Maya attaches a camera node to a light when duplicating it, the refined version of the script will delete the camera nodes attached to the light. Also, the script will check each children node of a light, make sure there is an annotation node in it. If yes, just update the light’s name when necessary. If not, create the annotaion.

Here is the refined version: ling_annotation_refine

Leave a Reply