There are two ways you can add a custom rig camera to a scene.
Writing a MEL or Python script procedure
It is best to create a rig using Python scripting.
All your rig nodes must be parented under one camera, directly or through any number of transforms. This camera serves as the root of your rig, and as the center camera. It is not possible to use instancing inside the rig structure.
The creation procedure should take no arguments, and must return an array of three strings. The first is the root node of the rig, and the second and third are the left and right cameras, respectively.
See StereoRig Manager in the Commands documentation for examples: stereoRigManager
Registering your custom rig
The Custom Stereo Rig Editor window appears.
maya.app.stereo.stereoCameraComplexRig.createRig.
Each custom rig can assign a callback that is called whenever that rig is attached to a camera set. A camera set holds onto the layers of a multi-camera rig, and contains slots that hold information pertinent to each layer. After a rig has been created and assigned to a layer of the multi-rig, this callback is executed to let the custom rig know that this has happened and allow for any custom actions to occur. This occurs for each layer in the multi-rig.
After all mult-rigs have been created, one final callback is sent to the same method to indicate that Maya has finished creating the multi-rig. The syntax of the callback contains the following flags:
Per-layer: <nameOfCallback> -cameraSet <multiRigName> <rigNodeName>
Final callback: <nameOfCallbak> -cameraSet <multiRigName> -allDone 1
For more information about multi-camera rigs, see Create a multi-camera rig and Multi-Camera Rig Tool.
You can now access your custom rig in by selecting Panels > Stereo > New Stereo Camera (<Your custom rig>).
You can also register your custom rig by using the stereoRigManager command. Refer to the stereoRigManager commands documentation for examples on how to register a custom rig, query the default rig, or delete a rig using this command.
Maya ships with a default stereo rig enabled. The source code is available in the python module: …\Python\Lib\site-packages\maya\app\stereo. Within this directory, you can also find the following code examples:
…\scripts\others\stereoCameraSimpleRig.mel creates the simplest rig, where a camera is used for both the right and center eye. A left camera is parented underneath.
These scripts are used in the stereoRigManager example.
If you have an existing rig, or if you need to create a rig outside of Maya, you can make an existing rig compliant with Maya’s requirements. However, all cameras must be parented under a common transform, called the rig root.
Call this Python code:
import maya.cmds as cmds from maya.app.stereo import stereoCameraRig
# Make sure the stereo plug-in is loaded cmds.loadPlugin("stereoCamera", quiet=True) stereoCameraRig.makeStereoCameraRig(rigRoot, rigTypeName, leftCam, rightCam)
where rigRoot, leftCam and rightCam are the names of the root transform, and the left and right camera pair. rigNameType is a user defined string used to identify the rig type.
If you have a rig with multiple left and right camera pairs, you can change the default left and right pair, used for interactive display.
Call this Python code:
import maya.cmds as cmds from maya.app.stereo import stereoCameraRig# Make sure the stereo plug-in is loaded cmds.loadPlugin("stereoCamera", quiet=True)stereoCameraRig.setStereoPair(rigRoot, leftCam, rightCam)