API Guide > Appendices >

# Appendix D: API and Devkit limitations

## Attribute of a user defined MPxData type

An attribute of a user defined MPxData type that is implemented as an attribute on a user defined node will fail to appear in the Outliner window.

## Using of MPlug::numElements() on the dagSetMembers[] attribute

Use of MPlug::numElements() on the dagSetMembers[] attribute of a shading engine node will return an incorrect number of elements.

Workaround

MPlug::numConnectedElements() should be used.

## Pixel data stored in off-screen color-index buffers using MPxGlBuffer cannot be read correctly

Pixel data stored in off-screen color-index buffers using MPxGIBuffer cannot be read correctly. The off screen buffer works as documented in RGB mode.

## Selecting multiple types of object components

When multiple types of object components are selected, e.g. edges and vertices, an MSelectionList that has been assigned the active selection list will contain only the final type of component selected. For example if edges were selected and then vertices were shift-selected the MSelectionList representing the active selection list will contain one MObject representing the vertex components.

Workaround

MItSelectionList list will differentiate between the different components selected and can be used to identify all of the various components selected.

## MItSelectionList::getDagPath()

MItSelectionList::getDagPath() will always return the original dagPath of an instanced node. For example, if two shape nodes are selected and their dagPaths are:

    pCube1|pCubeShape1
    pCube2|pCubeShape1

getDagPath() will return:

    pCube1|pCubeShape1
    pCube1|pCubeShape1

for each object in the list.

Workaround

MSelectionList::getDagPath() will return the correct dagPath for each object in the list.

## Creating a camera and immediately calling MFnCamera::setEyePoint

If one creates a camera and immediately calls MFnCamera::setEyePoint() as in the following:

    fnCamera.create ();
    fnCamera.setEyePoint ( MPoint (sceneCamera->eyePt[0], sceneCamera->eyePt[1], sceneCamera->eyePt[2]) );

it will fail because MFnCamera::create() does not correctly set the node's path pointer variable.

Workaround

Code similar to the following will get around this problem:

    MFnCamera fnCamera;
    MDagPath cameraPath;
    MDagPath::getAPathTo (fnCamera.create(), cameraPath);
    fnCamera.setObject (cameraPath);
    fnCamera.setEyePoint (...);

## Maya will crash if you unload a context plug-in

Maya will crash if you unload a context plug-in while instances of the contexts exist in the scene. This includes the devkit example context tool plug-ins such as the marqueeTool and the moveTool.

Workaround

To prevent the crash, remember the names of the context(s) that you create using the plug-in, and before unloading the plug-in, do a "file -f new" followed by a "deleteUI contextName".

## Maya will not recognize custom MEL command plug-ins at startup

In previous versions of Maya it may have been possible in a startup MEL script to call a custom MEL command which was implemented via an API plug-in. However, plug-ins were among the first objects loaded on Maya startup and this caused initialization problems. Since Maya 4.0, API plug-in loading occurs later in the Maya startup process, and any startup MEL scripts which relied on the plug-ins already being loaded will no longer work correctly.

Workaround

There are two options. Do one of the following:

- Load the plug-in manually in the startup script and then use "eval" to wrap all calls to the custom plug-in commands.
- In the startup script evalDeferred can be used to delay the call to the command so that the plug-ins get loaded first.