There are two ways you can add a custom rig camera to a scene.
Writing a MEL or Python script procedure
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
The Custom Stereo Rig Editor window appears.
You can now access your custom rig in by selecting Panels > Stereo > New Stereo Camera (<Your custom rig>).
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.
Making an existing rig Maya compliant
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.
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.
Change the default left and right camera pair
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.
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)