Create plug-in lights with the Light Editor

All plug-in lights can be created in the Light Editor. After loading the plug-in, Maya automatically adds the plug-in light to the Light Editor with a default icon. You can then create plug-in lights in the scene by clicking the light icon.

All plug-in lights are automatically added, provided that the plug-in node uses the light classification string.

To verify that your plug-in node uses the light classification string, run the following MEL command:

getClassification <nodeType>

For example, getClassification pointLight returns drawdb/light/pointLight:light.

light in the returned string denotes light classification.

drawdb/light/<light type> denotes a Viewport 2.0 light classification. If a plug-in uses one of the existing internal classifications (such as drawdb/light/directionalLight), then Maya will automatically use the corresponding shader for lighting as well as the internal Viewport 2.0 geometry evaluator for UI drawing in the viewport.

Note: If the Light Editor is already open when you load your plug-in, you must close and re-open the editor to refresh its display before you can see the plug-in light creation icon.

Customize the display of your plug-in light in the Light Editor

Create a template file to customize the plug-in light attributes shown in the editor, the creation MEL command, and the icon used.

Customization is possible but not required. If no icon is provided, then a default one is used. If no MEL command is provided, then the command:

shadingNode -asLight <lighttype>

is executed to create the light source.

Sample template files can be found in the ../scripts/AETemplates folder of your installation directory and are prefixed with LE; for example: LEspotLightTemplate.mel for spotlights.

Plug-in example

The Developer Kit example apiDirectionalLightShape is a sample plug-in that allows the creation of plug-in nodes using the light as well as internal drawdb classifications. The node attributes have been made to match Maya’s point, area, directional and spotlight types. Sample light editor templates are provided with the plug-in; for example, LEapiDirectionalLightShapeTemplate.mel and can be found in the ../scripts/AETemplates folder of your installation directory.

The following example illustrates a scene in which three types of plug-in light nodes have been created. Each light is listed with a different set of attributes, and with custom icons. Two of the plug-in lights are selected, as shown in the viewport.

The Light Editor displays columns for all attributes listed in the various templates. However, the attribute can only be modified for a light if that attribute exists in the xml template file for the specific light type. In this example, Emit Diffuse is a column in the Light Editor because it is in the LEapiDirectionalLightShapeTemplate.mel template file. Meanwhile, because Emit Diffuse is not in the LEdirectionalLightTemplate.mel template file, this attribute cannot be edited for native directional lights via the Light Editor.