protected void initTests(MPx3dModelView view)
        {
            MGlobal.displayInfo("exampleCameraSetViewCmd::initTests");

            clearResults(view);

            //	Add every camera into the scene. Don't change the main camera,
            //	it is OK that it gets reused.
            //
            MFnCameraSet cstFn      = new MFnCameraSet();
            MObject      cstObj     = cstFn.create();
            MDagPath     cameraPath = null;

            MItDag dagIterator = new MItDag(MItDag.TraversalType.kDepthFirst, MFn.Type.kCamera);

            for (; !dagIterator.isDone; dagIterator.next())
            {
                cameraPath = new MDagPath();

                MFnCamera camera;

                try
                {
                    dagIterator.getPath(cameraPath);
                    camera = new MFnCamera(cameraPath);
                }
                catch (Exception)
                {
                    continue;
                }

                fCameraList.append(cameraPath);

                cstFn.appendLayer(cameraPath, MObject.kNullObj);

                MGlobal.displayInfo(camera.fullPathName());
            }

            view.setCameraSet(cstObj);
            view.refresh();
        }
		protected void initTests(MPx3dModelView view)
		{
			MGlobal.displayInfo("exampleCameraSetViewCmd::initTests");

			clearResults(view);

			//	Add every camera into the scene. Don't change the main camera,
			//	it is OK that it gets reused.
			//
			MFnCameraSet cstFn = new MFnCameraSet();
			MObject cstObj = cstFn.create();
			MDagPath cameraPath = null;
			
			MItDag dagIterator = new MItDag(MItDag.TraversalType.kDepthFirst, MFn.Type.kCamera);
			for (; !dagIterator.isDone; dagIterator.next())
			{
				cameraPath = new MDagPath();

				MFnCamera camera;

				try
				{
					dagIterator.getPath(cameraPath);
					camera = new MFnCamera(cameraPath);
				}
				catch (Exception)
				{
					continue;
				}

				fCameraList.append(cameraPath);

				cstFn.appendLayer(cameraPath, MObject.kNullObj);

				MGlobal.displayInfo(camera.fullPathName());
			}

			view.setCameraSet(cstObj);
			view.refresh();
		}
        // Parses the given command line arguments and executes them.
        //
        public override void doIt(MArgList args)
        {
            parseArgs(args);

            bool nothingSet = (!createdUsed && !appendCameraUsed && !appendCameraAndSetUsed && !deleteLayerUsed && !cameraUsed &&
                        !layerUsed && !helpUsed && !setUsed && !layerTypeUsed && !numLayersUsed);

            if (nothingSet)
            {
                throw new ArgumentException("A flag must be used. testCameraSet -help for available flags", "args");
            }

            if (helpUsed)
            {
                MGlobal.displayInfo("testExCameraSet -help");
                MGlobal.displayInfo("\ttestExCameraSet tests the functionality of the exCameraSet node.");
                MGlobal.displayInfo("");
                MGlobal.displayInfo("\t-h -help : This message is printed");
                MGlobal.displayInfo("\t-a -active [true/false]: Set/get whether a particular layer is active");
                MGlobal.displayInfo("\t-ac -appendCamera <cameraName>: Append a new camera layer to the cameraSet using the specified camera");
                MGlobal.displayInfo("\t-acs -appendCameraAndSet <cameraName> <setName>: Append a new camera layer to the cameraSet using the specified camera and set");
                MGlobal.displayInfo("\t-cam -camera [<cameraName>]: Set/get the camera for a particular layer");
                MGlobal.displayInfo("\t-c -create : Create a new cameraSet node");
                MGlobal.displayInfo("\t-d -deleteLayer <layerIndex>: Delete the layer at the given index");
                MGlobal.displayInfo("\t-nl -numLayers: Returns the number of layers defined in the specified cameraSet");
                MGlobal.displayInfo("\t-l -layer <layerIndex>: Specifies the layer index to be used when accessing layer information");
                MGlobal.displayInfo("\t-lt -layerType [<layerTypeName>]: Set/get the layer type for a particular layer.  Possible values are Mono, Left, and Right.");
                MGlobal.displayInfo("\t-s -set [<setName>]: Set/get the set for a particular layer");
                MGlobal.displayInfo("\t-e -edit : Perform an edit operation");
                MGlobal.displayInfo("\t-q -query : Perform a query operation");
                MGlobal.displayInfo("");
            }

            uint nObjs = list.length;
            if (nObjs == 0)
            {
                if (createdUsed)
                {
                    // Create a new cameraSet node.
                    //
                    MFnDependencyNode dirFn = new MFnDependencyNode();
                    string noName = "";
                    try
                    {
                        MObject dirObj = dirFn.create(exCameraSet.type_id, noName);
                        MGlobal.select(dirObj, MGlobal.ListAdjustment.kReplaceList);
                    }
                    catch (System.Exception ex)
                    {
                        throw new ApplicationException("Could not create a cameraSet node", ex);
                    }
                    return;
                }

                if (appendCameraUsed || appendCameraAndSetUsed || deleteLayerUsed || editUsed || cameraUsed ||
                setUsed || layerTypeUsed || activeUsed || numLayersUsed)
                {
                    throw new ArgumentException("Must specify a cameraSet node", "args");
                }
            }
            else
            {
                if (createdUsed)
                {
                    throw new ArgumentException("-create cannot have any object specified", "args");
                }

                if (appendCameraUsed)
                {
                    if (nObjs != 1)
                    {
                        throw new ArgumentException("-appendCamera must have a single cameraSet node specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-appendCamera must have a valid exCameraSet node specified", "args");
                    }

                    // Get a dag path to the specified camera.
                    //
                    MSelectionList camList = new MSelectionList();
                    camList.add(camName);
                    MDagPath camPath = new MDagPath();
                    camList.getDagPath(0, camPath);
                    if (!camPath.isValid)
                    {
                        throw new ArgumentException("-appendCamera must have a valid camera node specified", "args");
                    }

                    // Call the MFnCameraSet method to append the layer.
                    //
                    MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                    dirFn.appendLayer(camPath, MObject.kNullObj);

                    return;
                }

                if (appendCameraAndSetUsed)
                {
                    if (nObjs != 1)
                    {
                        throw new ArgumentException("-appendCameraAndSet must have a single cameraSet node specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-appendCameraAndSet must have a valid exCameraSet node specified", "args");
                    }

                    // Get a dag path to the specified camera.
                    //
                    MSelectionList camList = new MSelectionList();
                    camList.add(camName);
                    MDagPath camPath = new MDagPath();
                    camList.getDagPath(0, camPath);
                    if (!camPath.isValid)
                    {
                        throw new ArgumentException("-appendCameraAndSet must have a valid camera node specified", "args");
                    }

                    // Get the specified set node.
                    //
                    MSelectionList setList = new MSelectionList();
                    setList.add(setName);
                    MObject setObj = MObject.kNullObj;
                    setList.getDependNode(0, setObj);
                    if (setObj == MObject.kNullObj)
                    {
                        throw new ArgumentException("-appendCameraAndSet must have a valid set node specified", "args");
                    }

                    // Call the MFnCameraSet method to append the layer.
                    //
                    MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                    dirFn.appendLayer(camPath, setObj);

                    return;
                }

                if (deleteLayerUsed)
                {
                    if (nObjs != 1)
                    {
                        throw new ArgumentException("-deleteLayer must have a single cameraSet node specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-deleteLayer must have a valid exCameraSet node specified", "args");
                    }

                    // Call the MFnCameraSet method to delete the layer.
                    //
                    MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                    dirFn.deleteLayer((uint)cameraLayer);

                    return;
                }

                if (numLayersUsed)
                {
                    if (queryUsed)
                    {
                        // Get the specified cameraSet node.
                        //
                        MObject dirNode = MObject.kNullObj;
                        if (!getExCameraSetNode(dirNode))
                        {
                            throw new ArgumentException("-numLayers must have a valid exCameraSet node specified", "args");
                        }

                        // Call the MFnCameraSet method to get the number of layers.
                        //
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                        uint numLayers = dirFn.numLayers;
                        setResult((int)numLayers);
                    }
                    else
                    {
                        throw new ArgumentException("-numLayers requires the query flag to be used", "args");
                    }

                    return;
                }

                if (cameraUsed)
                {
                    if ((nObjs != 1) || (!layerUsed))
                    {
                        throw new ArgumentException("-camera must have a cameraSet node and layer specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-camera must have a valid exCameraSet node specified", "args");
                    }

                    if (editUsed)
                    {
                        // Get a dag path to the specified camera.
                        //
                        MSelectionList camList = new MSelectionList();
                        camList.add(camName);
                        MDagPath camPath = new MDagPath();
                        camList.getDagPath(0, camPath);
                        if (!camPath.isValid)
                        {
                            throw new ArgumentException("-camera must have a valid camera node specified", "args");
                        }

                        // Call the MFnCameraSet method to set the camera.
                        //
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                        dirFn.setLayerCamera((uint)cameraLayer, camPath);
                    }
                    else if (queryUsed)
                    {
                        // Call the MFnCameraSet method to get the camera.
                        //
                        MDagPath camPath = new MDagPath();
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);

                        dirFn.getLayerCamera((uint)cameraLayer, camPath);
                        MObject camNode = camPath.node;
                        MFnDependencyNode nodeFn = new MFnDependencyNode(camNode);
                        setResult(nodeFn.name);
                    }
                }

                if (setUsed)
                {
                    if ((nObjs != 1) || (!layerUsed))
                    {
                        throw new ArgumentException("-set must have a cameraSet node and layer specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-set must have a valid exCameraSet node specified", "args");
                    }

                    if (editUsed)
                    {
                        // Get the specified set node.
                        //
                        MObject setObj = MObject.kNullObj;
                        if (setName != "")
                        {
                            MSelectionList setList = new MSelectionList();
                            setList.add(setName);
                            setList.getDependNode(0, setObj);
                            if (setObj == MObject.kNullObj)
                            {
                                throw new ArgumentException("-set must have a valid set node specified", "args");
                            }
                        }

                        // Call the MFnCameraSet method to set the set node.
                        //
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                        dirFn.setLayerSceneData((uint)cameraLayer, setObj);
                    }
                    else if (queryUsed)
                    {
                        // Call the MFnCameraSet method to get the set node.
                        //
                        MObject setObj = new MObject();
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);

                        dirFn.getLayerSceneData((uint)cameraLayer, setObj);
                        MFnDependencyNode nodeFn = new MFnDependencyNode(setObj);
                        setResult(nodeFn.name);
                    }
                }

                if (layerTypeUsed)
                {
                    if ((nObjs != 1) || (!layerUsed))
                    {
                        throw new ArgumentException("-layerType must have a cameraSet node and layer specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-layerType must have a valid exCameraSet node specified", "args");
                    }

                    MFnDependencyNode nodeFn = new MFnDependencyNode(dirNode);

                    exCameraSet exDir = nodeFn.userNode as exCameraSet;

                    if (editUsed)
                    {
                        // Get the specified layer type.
                        //
                        int pt = -1;
                        if (layerTypeVal == "Mono")
                            pt = 0;
                        else if (layerTypeVal == "Left")
                            pt = 1;
                        else if (layerTypeVal == "Right")
                            pt = 2;
                        else
                        {
                            throw new ArgumentException("-layerType must have a valid type specified", "args");
                        }

                        // Call the exCameraSet method to set the layer type.
                        //
                        exDir.setLayerType((uint)cameraLayer, pt);
                    }
                    else if (queryUsed)
                    {
                        // Call the exCameraSet method to get the layer type.
                        //
                        try
                        {
                            int lt = exDir.getLayerType((uint)cameraLayer);
                            if (lt == 0)
                                setResult("Mono");
                            else if (lt == 1)
                                setResult("Left");
                            else if (lt == 2)
                                setResult("Right");
                        }
                        catch (System.Exception ex)
                        {
                            throw new ApplicationException("exCameraSet node does not have a valid layer type", ex);
                        }
                    }
                }

                if (activeUsed)
                {
                    if ((nObjs != 1) || (!layerUsed))
                    {
                        throw new ArgumentException("-active must have a cameraSet node and layer specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-active must have a valid exCameraSet node specified", "args");
                    }

                    if (editUsed)
                    {
                        // Call the MFnCameraSet method to set the set node.
                        //
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                        dirFn.setLayerActive((uint)cameraLayer, activeVal);
                    }
                    else if (queryUsed)
                    {
                        // Call the MFnCameraSet method to get the active value.
                        //
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                        activeVal = dirFn.isLayerActive((uint)cameraLayer);
                        setResult(activeVal);
                    }
                }

            }
            return;
        }
Example #4
0
        override public void doIt(MArgList args)
        // Parses the given command line arguments and executes them.
        //
        {
            parseArgs(args);

            bool nothingSet = (!createdUsed && !appendCameraUsed && !appendCameraAndSetUsed && !deleteLayerUsed && !cameraUsed &&
                               !layerUsed && !helpUsed && !setUsed && !layerTypeUsed && !numLayersUsed);

            if (nothingSet)
            {
                throw new ArgumentException("A flag must be used. testCameraSet -help for available flags", "args");
            }

            if (helpUsed)
            {
                MGlobal.displayInfo("testExCameraSet -help");
                MGlobal.displayInfo("\ttestExCameraSet tests the functionality of the exCameraSet node.");
                MGlobal.displayInfo("");
                MGlobal.displayInfo("\t-h -help : This message is printed");
                MGlobal.displayInfo("\t-a -active [true/false]: Set/get whether a particular layer is active");
                MGlobal.displayInfo("\t-ac -appendCamera <cameraName>: Append a new camera layer to the cameraSet using the specified camera");
                MGlobal.displayInfo("\t-acs -appendCameraAndSet <cameraName> <setName>: Append a new camera layer to the cameraSet using the specified camera and set");
                MGlobal.displayInfo("\t-cam -camera [<cameraName>]: Set/get the camera for a particular layer");
                MGlobal.displayInfo("\t-c -create : Create a new cameraSet node");
                MGlobal.displayInfo("\t-d -deleteLayer <layerIndex>: Delete the layer at the given index");
                MGlobal.displayInfo("\t-nl -numLayers: Returns the number of layers defined in the specified cameraSet");
                MGlobal.displayInfo("\t-l -layer <layerIndex>: Specifies the layer index to be used when accessing layer information");
                MGlobal.displayInfo("\t-lt -layerType [<layerTypeName>]: Set/get the layer type for a particular layer.  Possible values are Mono, Left, and Right.");
                MGlobal.displayInfo("\t-s -set [<setName>]: Set/get the set for a particular layer");
                MGlobal.displayInfo("\t-e -edit : Perform an edit operation");
                MGlobal.displayInfo("\t-q -query : Perform a query operation");
                MGlobal.displayInfo("");
            }

            uint nObjs = list.length;

            if (nObjs == 0)
            {
                if (createdUsed)
                {
                    // Create a new cameraSet node.
                    //
                    MFnDependencyNode dirFn  = new MFnDependencyNode();
                    string            noName = "";
                    try
                    {
                        MObject dirObj = dirFn.create(exCameraSet.type_id, noName);
                        MGlobal.select(dirObj, MGlobal.ListAdjustment.kReplaceList);
                    }
                    catch (System.Exception ex)
                    {
                        throw new ApplicationException("Could not create a cameraSet node", ex);
                    }
                    return;
                }

                if (appendCameraUsed || appendCameraAndSetUsed || deleteLayerUsed || editUsed || cameraUsed ||
                    setUsed || layerTypeUsed || activeUsed || numLayersUsed)
                {
                    throw new ArgumentException("Must specify a cameraSet node", "args");
                }
            }
            else
            {
                if (createdUsed)
                {
                    throw new ArgumentException("-create cannot have any object specified", "args");
                }

                if (appendCameraUsed)
                {
                    if (nObjs != 1)
                    {
                        throw new ArgumentException("-appendCamera must have a single cameraSet node specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-appendCamera must have a valid exCameraSet node specified", "args");
                    }

                    // Get a dag path to the specified camera.
                    //
                    MSelectionList camList = new MSelectionList();
                    camList.add(camName);
                    MDagPath camPath = new MDagPath();
                    camList.getDagPath(0, camPath);
                    if (!camPath.isValid)
                    {
                        throw new ArgumentException("-appendCamera must have a valid camera node specified", "args");
                    }

                    // Call the MFnCameraSet method to append the layer.
                    //
                    MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                    dirFn.appendLayer(camPath, MObject.kNullObj);

                    return;
                }

                if (appendCameraAndSetUsed)
                {
                    if (nObjs != 1)
                    {
                        throw new ArgumentException("-appendCameraAndSet must have a single cameraSet node specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-appendCameraAndSet must have a valid exCameraSet node specified", "args");
                    }

                    // Get a dag path to the specified camera.
                    //
                    MSelectionList camList = new MSelectionList();
                    camList.add(camName);
                    MDagPath camPath = new MDagPath();
                    camList.getDagPath(0, camPath);
                    if (!camPath.isValid)
                    {
                        throw new ArgumentException("-appendCameraAndSet must have a valid camera node specified", "args");
                    }

                    // Get the specified set node.
                    //
                    MSelectionList setList = new MSelectionList();
                    setList.add(setName);
                    MObject setObj = MObject.kNullObj;
                    setList.getDependNode(0, setObj);
                    if (setObj == MObject.kNullObj)
                    {
                        throw new ArgumentException("-appendCameraAndSet must have a valid set node specified", "args");
                    }

                    // Call the MFnCameraSet method to append the layer.
                    //
                    MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                    dirFn.appendLayer(camPath, setObj);

                    return;
                }

                if (deleteLayerUsed)
                {
                    if (nObjs != 1)
                    {
                        throw new ArgumentException("-deleteLayer must have a single cameraSet node specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-deleteLayer must have a valid exCameraSet node specified", "args");
                    }

                    // Call the MFnCameraSet method to delete the layer.
                    //
                    MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                    dirFn.deleteLayer((uint)cameraLayer);

                    return;
                }

                if (numLayersUsed)
                {
                    if (queryUsed)
                    {
                        // Get the specified cameraSet node.
                        //
                        MObject dirNode = MObject.kNullObj;
                        if (!getExCameraSetNode(dirNode))
                        {
                            throw new ArgumentException("-numLayers must have a valid exCameraSet node specified", "args");
                        }

                        // Call the MFnCameraSet method to get the number of layers.
                        //
                        MFnCameraSet dirFn     = new MFnCameraSet(dirNode);
                        uint         numLayers = dirFn.numLayers;
                        setResult((int)numLayers);
                    }
                    else
                    {
                        throw new ArgumentException("-numLayers requires the query flag to be used", "args");
                    }

                    return;
                }

                if (cameraUsed)
                {
                    if ((nObjs != 1) || (!layerUsed))
                    {
                        throw new ArgumentException("-camera must have a cameraSet node and layer specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-camera must have a valid exCameraSet node specified", "args");
                    }

                    if (editUsed)
                    {
                        // Get a dag path to the specified camera.
                        //
                        MSelectionList camList = new MSelectionList();
                        camList.add(camName);
                        MDagPath camPath = new MDagPath();
                        camList.getDagPath(0, camPath);
                        if (!camPath.isValid)
                        {
                            throw new ArgumentException("-camera must have a valid camera node specified", "args");
                        }

                        // Call the MFnCameraSet method to set the camera.
                        //
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                        dirFn.setLayerCamera((uint)cameraLayer, camPath);
                    }
                    else if (queryUsed)
                    {
                        // Call the MFnCameraSet method to get the camera.
                        //
                        MDagPath     camPath = new MDagPath();
                        MFnCameraSet dirFn   = new MFnCameraSet(dirNode);

                        dirFn.getLayerCamera((uint)cameraLayer, camPath);
                        MObject           camNode = camPath.node;
                        MFnDependencyNode nodeFn  = new MFnDependencyNode(camNode);
                        setResult(nodeFn.name);
                    }
                }

                if (setUsed)
                {
                    if ((nObjs != 1) || (!layerUsed))
                    {
                        throw new ArgumentException("-set must have a cameraSet node and layer specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-set must have a valid exCameraSet node specified", "args");
                    }

                    if (editUsed)
                    {
                        // Get the specified set node.
                        //
                        MObject setObj = MObject.kNullObj;
                        if (setName != "")
                        {
                            MSelectionList setList = new MSelectionList();
                            setList.add(setName);
                            setList.getDependNode(0, setObj);
                            if (setObj == MObject.kNullObj)
                            {
                                throw new ArgumentException("-set must have a valid set node specified", "args");
                            }
                        }

                        // Call the MFnCameraSet method to set the set node.
                        //
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                        dirFn.setLayerSceneData((uint)cameraLayer, setObj);
                    }
                    else if (queryUsed)
                    {
                        // Call the MFnCameraSet method to get the set node.
                        //
                        MObject      setObj = new MObject();
                        MFnCameraSet dirFn  = new MFnCameraSet(dirNode);

                        dirFn.getLayerSceneData((uint)cameraLayer, setObj);
                        MFnDependencyNode nodeFn = new MFnDependencyNode(setObj);
                        setResult(nodeFn.name);
                    }
                }

                if (layerTypeUsed)
                {
                    if ((nObjs != 1) || (!layerUsed))
                    {
                        throw new ArgumentException("-layerType must have a cameraSet node and layer specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-layerType must have a valid exCameraSet node specified", "args");
                    }

                    MFnDependencyNode nodeFn = new MFnDependencyNode(dirNode);

                    exCameraSet exDir = nodeFn.userNode as exCameraSet;

                    if (editUsed)
                    {
                        // Get the specified layer type.
                        //
                        int pt = -1;
                        if (layerTypeVal == "Mono")
                        {
                            pt = 0;
                        }
                        else if (layerTypeVal == "Left")
                        {
                            pt = 1;
                        }
                        else if (layerTypeVal == "Right")
                        {
                            pt = 2;
                        }
                        else
                        {
                            throw new ArgumentException("-layerType must have a valid type specified", "args");
                        }

                        // Call the exCameraSet method to set the layer type.
                        //
                        exDir.setLayerType((uint)cameraLayer, pt);
                    }
                    else if (queryUsed)
                    {
                        // Call the exCameraSet method to get the layer type.
                        //
                        try
                        {
                            int lt = exDir.getLayerType((uint)cameraLayer);
                            if (lt == 0)
                            {
                                setResult("Mono");
                            }
                            else if (lt == 1)
                            {
                                setResult("Left");
                            }
                            else if (lt == 2)
                            {
                                setResult("Right");
                            }
                        }
                        catch (System.Exception ex)
                        {
                            throw new ApplicationException("exCameraSet node does not have a valid layer type", ex);
                        }
                    }
                }

                if (activeUsed)
                {
                    if ((nObjs != 1) || (!layerUsed))
                    {
                        throw new ArgumentException("-active must have a cameraSet node and layer specified", "args");
                    }

                    // Get the specified cameraSet node.
                    //
                    MObject dirNode = MObject.kNullObj;
                    if (!getExCameraSetNode(dirNode))
                    {
                        throw new ArgumentException("-active must have a valid exCameraSet node specified", "args");
                    }

                    if (editUsed)
                    {
                        // Call the MFnCameraSet method to set the set node.
                        //
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                        dirFn.setLayerActive((uint)cameraLayer, activeVal);
                    }
                    else if (queryUsed)
                    {
                        // Call the MFnCameraSet method to get the active value.
                        //
                        MFnCameraSet dirFn = new MFnCameraSet(dirNode);
                        activeVal = dirFn.isLayerActive((uint)cameraLayer);
                        setResult(activeVal);
                    }
                }
            }
            return;
        }