コード例 #1
0
ファイル: createClipCmd.cs プロジェクト: meshdgp/MeshDGP
		void parseArgs(MArgList args)
		{
			string arg = "";
			MSelectionList list = new MSelectionList();
			bool charNameUsed = false;
			string charName;
			const string charFlag = "-c";
			const string charFlagLong = "-char";

			for (uint i = 0; i < args.length; i++)
			{
				arg = args.asString(i);
				if (arg == charFlag || arg == charFlagLong)
				{
					// get the char name
					//
					if (i == args.length - 1)
					{
						arg += ": must specify a character name";
						throw new ArgumentException(arg, "args"); 
					}
					i++;
					charName = args.asString(i);
					list.add(charName);

					charNameUsed = true;
				}
				else
				{
					arg += ": unknown argument";
					throw new ArgumentException(arg, "args"); 
				}
			}

			if (charNameUsed)
			{
				// get the character corresponding to the node name
				//
				MItSelectionList iter = new MItSelectionList(list);
				for (; iter.isDone; iter.next())
				{
					MObject node = new MObject();
					iter.getDependNode(node);
					if (node.apiType == MFn.Type.kCharacter)
					{
						fCharacter = node;
						break;
					}
				}

				if (fCharacter.isNull)
				{
					throw new ApplicationException("Unable to get the character corresponding to the node name.");
				}
			}
		}
コード例 #2
0
        void parseArgs(MArgList args)
        {
            string         arg          = "";
            MSelectionList list         = new MSelectionList();
            bool           charNameUsed = false;
            string         charName;
            const string   charFlag     = "-c";
            const string   charFlagLong = "-char";

            for (uint i = 0; i < args.length; i++)
            {
                arg = args.asString(i);
                if (arg == charFlag || arg == charFlagLong)
                {
                    // get the char name
                    //
                    if (i == args.length - 1)
                    {
                        arg += ": must specify a character name";
                        throw new ArgumentException(arg, "args");
                    }
                    i++;
                    charName = args.asString(i);
                    list.add(charName);

                    charNameUsed = true;
                }
                else
                {
                    arg += ": unknown argument";
                    throw new ArgumentException(arg, "args");
                }
            }

            if (charNameUsed)
            {
                // get the character corresponding to the node name
                //
                MItSelectionList iter = new MItSelectionList(list);
                for (; iter.isDone; iter.next())
                {
                    MObject node = new MObject();
                    iter.getDependNode(node);
                    if (node.apiType == MFn.Type.kCharacter)
                    {
                        fCharacter = node;
                        break;
                    }
                }

                if (fCharacter.isNull)
                {
                    throw new ApplicationException("Unable to get the character corresponding to the node name.");
                }
            }
        }
コード例 #3
0
        public void parseArgs(MArgList args)
        {
            string arg;
            string fileName     = "";
            string fileFlag     = "-f";
            string fileFlagLong = "-file";

            // Parse the arguments.
            for (uint i = 0; i < args.length; i++)
            {
                try
                {
                    arg = args.asString(i);
                }
                catch (Exception e)
                {
                    MGlobal.displayInfo(e.Message);
                    continue;
                }

                if (arg == fileFlag || arg == fileFlagLong)
                {
                    // get the file name
                    //
                    if (i == args.length - 1)
                    {
                        arg += ": must specify a file name";
                        throw new ArgumentException(arg, "args");
                    }
                    i++;
                    fileName = args.asString(i);
                }
                else
                {
                    arg += ": unknown argument";
                    throw new ArgumentException(arg, "args");
                }
            }

            file = File.Open(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite);

            if (file == null)
            {
                string openError = "Could not open: ";
                openError += fileName;
                throw new InvalidOperationException(openError);
            }
        }
コード例 #4
0
        public override void doIt(MArgList args)
        {
            CSharpInterpreter.MayaRootPath = @"D:\Program Files\Autodesk\Maya2015";

            var script = args.asString(0);

            MGlobal.displayInfo(script);
            var scriptArgs = new string[args.length];

            for (uint i = 1; i < args.length; ++i)
            {
                scriptArgs[i - 1] = args.asString(i);
                MGlobal.displayInfo(scriptArgs[i - 1]);
            }
            new CSharpInterpreter(script).Execute(scriptArgs);
        }
コード例 #5
0
        public override void doIt(MArgList args)
        {
            uint last = args.length;
            if (last > 0)
            {
                for (uint i = 0; i < last; i++)
                {
                    string argStr = args.asString(i);

                    if (argStr == "add")
                    {
                        if (added)
                            continue;

                        MEventMessage.Event[UndoString] += undoCB;
                        MEventMessage.Event[RedoString] += redoCB;
                    }
                    else if (argStr == "remove")
                    {
                        if (added)
                        {
                            MEventMessage.Event[UndoString] -= undoCB;
                            MEventMessage.Event[RedoString] -= redoCB;
                            added = false;
                        }
                    }
                    else
                    {
                        throw new ArgumentException("Failure condition", "args");
                    }
                }
            }

            return;
        }
コード例 #6
0
        private void parseArgs(MArgList args, ref MItDag.TraversalType traversalType,
                               MFn.Type filter, ref bool quiet)
        {
            string       arg                  = "";
            const string breadthFlag          = "-b";
            const string breadthFlagLong      = "-breadthFirst";
            const string depthFlag            = "-d";
            const string depthFlagLong        = "-depthFirst";
            const string cameraFlag           = "-c";
            const string cameraFlagLong       = "-cameras";
            const string lightFlag            = "-l";
            const string lightFlagLong        = "-lights";
            const string nurbsSurfaceFlag     = "-n";
            const string nurbsSurfaceFlagLong = "-nurbsSurfaces";
            const string quietFlag            = "-q";
            const string quietFlagLong        = "-quiet";

            for (uint i = 0; i < args.length; i++)
            {
                arg = args.asString(i);
                if (arg == breadthFlag || arg == breadthFlagLong)
                {
                    traversalType = MItDag.TraversalType.kBreadthFirst;
                }
                else if (arg == depthFlag || arg == depthFlagLong)
                {
                    traversalType = MItDag.TraversalType.kDepthFirst;
                }
                else if (arg == cameraFlag || arg == cameraFlagLong)
                {
                    filter = MFn.Type.kCamera;
                }
                else if (arg == lightFlag || arg == lightFlagLong)
                {
                    filter = MFn.Type.kLight;
                }
                else if (arg == nurbsSurfaceFlag || arg == nurbsSurfaceFlagLong)
                {
                    filter = MFn.Type.kNurbsSurface;
                }
                else if (arg == quietFlag || arg == quietFlagLong)
                {
                    quiet = true;
                }
                else
                {
                    arg += ": unknown argument";
                    throw new ArgumentException(arg, "args");
                }
            }
        }
コード例 #7
0
		public void parseArgs(MArgList args)
		{
			string arg;
			string fileName		= "";
			string fileFlag		= "-f";
			string fileFlagLong = "-file";

			// Parse the arguments.
			for ( uint i = 0; i < args.length; i++ ) 
			{
				try
				{
					arg = args.asString(i);
				}
				catch (Exception e) 
				{
					MGlobal.displayInfo(e.Message);
					continue;
				}
				
				if ( arg == fileFlag || arg == fileFlagLong ) 
				{
					// get the file name
					//
					if (i == args.length - 1) 
					{
						arg += ": must specify a file name";
						throw new ArgumentException(arg, "args"); 
					}
					i++;
					fileName = args.asString(i);
				}
				else 
				{
					arg += ": unknown argument";
					throw new ArgumentException(arg, "args"); 
				}
			}

			file = File.Open(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
	
			if (file == null)
			{
				string openError = "Could not open: ";
				openError += fileName;
				throw new InvalidOperationException(openError);
			}
		}
コード例 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args">order: windowName, lineIndex , buttonIndex</param>
        public override void doIt(MArgList args)
        {
            //Debug.Log("at least do it....");
            if (args.length != 3)
            {
                //Debug.Log("param count error:" + args.length);
                return;
            }
            string wName       = args.asString(0);
            int    lineIndex   = args.asInt(1);
            int    buttonIndex = args.asInt(2);

            //Debug.Log("name:" + wName + ",line:" + lineIndex + ",btn:" + buttonIndex);

            BasicWindow.ExcuteInDic(wName, lineIndex, buttonIndex);
        }
コード例 #9
0
        public override void doIt(MArgList args)
        {
            uint last = args.length;

            if (last > 0)
            {
                for (uint i = 0; i < last; i++)
                {
                    string argStr = args.asString(i);

                    if (argStr == "add")
                    {
                        if (added)
                        {
                            continue;
                        }

                        MEventMessage.Event[UndoString] += undoCB;
                        MEventMessage.Event[RedoString] += redoCB;
                    }
                    else if (argStr == "remove")
                    {
                        if (added)
                        {
                            MEventMessage.Event[UndoString] -= undoCB;
                            MEventMessage.Event[RedoString] -= redoCB;
                            added = false;
                        }
                    }
                    else
                    {
                        throw new ArgumentException("Failure condition", "args");
                    }
                }
            }

            return;
        }
コード例 #10
0
ファイル: scanDagCmd.cs プロジェクト: meshdgp/MeshDGP
		private void parseArgs( MArgList args,ref MItDag.TraversalType traversalType,
			MFn.Type filter, ref bool quiet)
		{
			string arg = "";
			const string breadthFlag = "-b";
			const string breadthFlagLong = "-breadthFirst";
			const string depthFlag = "-d";
			const string depthFlagLong = "-depthFirst";
			const string cameraFlag = "-c";
			const string cameraFlagLong = "-cameras";
			const string lightFlag = "-l";
			const string lightFlagLong = "-lights";
			const string nurbsSurfaceFlag = "-n";
			const string nurbsSurfaceFlagLong = "-nurbsSurfaces";
			const string quietFlag = "-q";
			const string quietFlagLong = "-quiet";

			for (uint i = 0; i < args.length; i++)
			{
				arg = args.asString(i);
				if ( arg == breadthFlag || arg == breadthFlagLong )
					traversalType = MItDag.TraversalType.kBreadthFirst;
				else if ( arg == depthFlag || arg == depthFlagLong )
					traversalType = MItDag.TraversalType.kDepthFirst;
				else if ( arg == cameraFlag || arg == cameraFlagLong )
					filter = MFn.Type.kCamera;
				else if ( arg == lightFlag || arg == lightFlagLong )
					filter = MFn.Type.kLight;
				else if ( arg == nurbsSurfaceFlag || arg == nurbsSurfaceFlagLong )
					filter = MFn.Type.kNurbsSurface;
				else if ( arg == quietFlag || arg == quietFlagLong )
					quiet = true;
				else {
					arg += ": unknown argument";
					throw new ArgumentException(arg, "args");
				}
			}
		}
コード例 #11
0
ファイル: helloCmd.cs プロジェクト: EricTRocks/Maya-devkit
 public override void doIt(MArgList argl)
 {
     MGlobal.displayInfo("Hello " + argl.asString(0) + "\n");
     return;
 }
コード例 #12
0
ファイル: helloCmd.cs プロジェクト: venerin/Maya-devkit
 public override void doIt(MArgList argl)
 {
     MGlobal.displayInfo("Hello " + argl.asString(0) + "\n");
     return;
 }
コード例 #13
0
        //public enum MPCType
        //{
        //    Test = 0,
        //    BindFinger_CTL_L = 1,
        //    BindFinger_CTL_R = 2,
        //    AddRPIK = 3,
        //    AddRPIKPole = 4,
        //    AddChildCtl = 5,
        //    AddParentCtl = 6,
        //    CreateCTL_CrysTal = 7,
        //    AddReverseFootBones = 8,
        //    BindReverseFootRPIK = 9,
        //    CreateJointsCurve = 10,
        //    MakeHairJointsChain = 11,

        //}

        public override void doIt(MArgList args)
        {
            Debug.Log("at least it enters");
            if (args.length == 0)
            {
                Debug.Log("no param!");
                return;
            }
            string cmdTypeStr = args.asString(0);
            string paramStr   = args.asString(1);
            bool   success    = InazumaToolEntrance.Execute(cmdTypeStr, paramStr);

            if (success)
            {
                Debug.Log("yep");
            }
            else
            {
                Debug.Log("nope");
            }



            //int type = args.asInt(0);

            //MPCType mpcType = (MPCType)type;


            //switch (mpcType)
            //{
            //    case MPCType.Test:
            //        {
            //            BasicFunc.PrintObjects(BasicFunc.GetSelectedList());

            //            break;
            //        }
            //    case MPCType.BindFinger_CTL_L:
            //        {
            //            BindHumanBody.BindFinger(BasicFunc.GetSelectedDagPath(0), "test", false);
            //            break;
            //        }
            //    case MPCType.BindFinger_CTL_R:
            //        {
            //            Debug.Log("oh my god it works333");
            //            break;
            //        }
            //    case MPCType.AddRPIK:
            //        {
            //            BindHumanBody.BindRPIK();
            //            break;
            //        }
            //    case MPCType.AddRPIKPole:
            //        {
            //            BindHumanBody.AddRPIKPole();
            //            break;
            //        }
            //    case MPCType.AddChildCtl:
            //        {
            //            BasicFunc.AddChildCircle(BasicFunc.GetSelectedDagPath(0));
            //            break;
            //        }
            //    case MPCType.AddParentCtl:
            //        {
            //            BasicFunc.AddParentCircle(BasicFunc.GetSelectedDagPath(0), true);
            //            break;
            //        }
            //    case MPCType.CreateCTL_CrysTal:
            //        {
            //            BasicFunc.CreateCTL_Crystal("ctl_sample");
            //            break;
            //        }
            //    case MPCType.AddReverseFootBones:
            //        {
            //            BindHumanBody.AddReverseFootBone();
            //            break;
            //        }
            //    case MPCType.BindReverseFootRPIK:
            //        {
            //            BindHumanBody.BindReverseFootRPIK();
            //            break;
            //        }
            //    case MPCType.CreateJointsCurve:
            //        {
            //            JointProcess.CreateJointsCurve(BasicFunc.GetSelectedList());
            //            break;
            //        }
            //    case MPCType.MakeHairJointsChain:
            //        {
            //            DynamicConverter.CurveToHair();

            //            //JointProcess.MakeJointsHairChain(BasicFunc.GetSelectedList());
            //            break;
            //        }
            //}
        }
コード例 #14
0
		public override void doIt(MArgList args)
		{
			MSelectionList list = new MSelectionList();

			if ( args.length > 0 ) {
				// Arg list is > 0 so use objects that were passes in
				//
				uint last = args.length;
				for ( uint i = 0; i < last; i++ ) {
					// Attempt to find all of the objects matched
					// by the string and add them to the list
					//
					string argStr = args.asString(i);
					list.add(argStr);
				}
			} else {
				// Get arguments from Maya's selection list.
				MGlobal.getActiveSelectionList(list);
			}

			MObject node = new MObject();
			MObjectArray nodePath = new MObjectArray();
			MFnDependencyNode nodeFn = new MFnDependencyNode();
			MFnDependencyNode dgNodeFnSet = new MFnDependencyNode();

			for (MItSelectionList iter = new MItSelectionList(list); !iter.isDone; iter.next()) {

				iter.getDependNode(node);

				//
				// The following code shows how to navigate the DG manually without
				// using an iterator.  First, find the attribute that you are
				// interested.  Then connect a plug to it and see where the plug
				// connected to.  Once you get all the connections, you can choose
				// which route you want to go.
				//
				// In here, we wanted to get to the nodes that instObjGroups connected
				// to since we know that the shadingEngine connects to the instObjGroup
				// attribute.
				//

				nodeFn.setObject( node );
				MObject iogAttr = null;
				try {
					iogAttr = nodeFn.attribute("instObjGroups");
				} catch (Exception) {
					MGlobal.displayInfo(nodeFn.name + ": is not a renderable object, skipping");
					continue;
				}

				MPlug iogPlug = new MPlug(node, iogAttr);
				MPlugArray iogConnections = new MPlugArray();

				//
				// instObjGroups is a multi attribute.  In this example, just the
				// first connection will be tried.
				//
				if (!iogPlug.elementByLogicalIndex(0).connectedTo(iogConnections, false, true)) {
					MGlobal.displayInfo(nodeFn.name + ": is not in a shading group, skipping");
					continue;
				}

				//
				// Now we would like to traverse the DG starting from the shadingEngine
				// since most likely all file texture nodes will be found.  Note the
				// filter used to initialize the DG iterator.  There are lots of filter
				// type available in MF.Type that you can choose to suite your needs.
				//
				bool foundATexture = false;
				for ( int i=0; i < iogConnections.length; i++ ) {

					MObject currentNode = iogConnections[i].node;

					//
					// Note that upon initialization, the current pointer of the
					// iterator already points to the first valid node.
					//
					MItDependencyGraph dgIt = new MItDependencyGraph(currentNode,
																	 MFn.Type.kFileTexture,
																	 MItDependencyGraph.Direction.kUpstream,
																	 MItDependencyGraph.Traversal.kBreadthFirst,
																	 MItDependencyGraph.Level.kNodeLevel);
					if (dgIt == null)
					{
						continue;
					}

					dgIt.disablePruningOnFilter();

					for ( ; !dgIt.isDone; dgIt.next() ) {

						MObject thisNode = dgIt.thisNode();
						dgNodeFnSet.setObject(thisNode);
						try {
							dgIt.getNodePath(nodePath);
						} catch (Exception) {
							MGlobal.displayInfo("getNodePath");
							continue;
						}

						//
						// append the starting node.
						//
						nodePath.append(node);
						dumpInfo( thisNode, dgNodeFnSet, nodePath );
						foundATexture = true;
					}
				}

				if ( !foundATexture ) {
					MGlobal.displayInfo(nodeFn.name + ": is not connected to a file texture");
				}
			}
			return;
		}
コード例 #15
0
        void parseArgs(MArgList args)
        {
            createdUsed = (args.flagIndex(kCreateFlag, kCreateFlagLong) != MArgList.kInvalidArgIndex);
            editUsed = (args.flagIndex(kEditFlag, kEditFlagLong) != MArgList.kInvalidArgIndex);
            queryUsed = (args.flagIndex(kQueryFlag, kQueryFlagLong) != MArgList.kInvalidArgIndex);
            helpUsed = (args.flagIndex(kHelpFlag, kHelpFlagLong) != MArgList.kInvalidArgIndex);
            numLayersUsed = (args.flagIndex(kNumLayersFlag, kNumLayersFlagLong) != MArgList.kInvalidArgIndex);

            // If flags are used which require no other information, return now.
            //
            if (createdUsed || helpUsed)
                return;

            uint maxArg = args.length - 1;
            uint activeIndex = args.flagIndex(kActiveFlag, kActiveFlagLong);
            uint appendCameraIndex = args.flagIndex(kAppendCameraFlag, kAppendCameraFlagLong);
            uint appendCameraAndSetIndex = args.flagIndex(kAppendCameraAndSetFlag, kAppendCameraAndSetFlagLong);
            uint cameraIndex = args.flagIndex(kCameraFlag, kCameraFlagLong);
            uint deleteLayerIndex = args.flagIndex(kDeleteLayerFlag, kDeleteLayerFlagLong);
            uint layerIndex = args.flagIndex(kLayerFlag, kLayerFlagLong);
            uint layerTypeIndex = args.flagIndex(kLayerTypeFlag, kLayerTypeFlagLong);
            uint setIndex = args.flagIndex(kSetFlag, kSetFlagLong);

            activeUsed = (activeIndex != MArgList.kInvalidArgIndex);
            appendCameraUsed = (appendCameraIndex != MArgList.kInvalidArgIndex);
            appendCameraAndSetUsed = (appendCameraAndSetIndex != MArgList.kInvalidArgIndex);
            cameraUsed = (cameraIndex != MArgList.kInvalidArgIndex);
            deleteLayerUsed = (deleteLayerIndex != MArgList.kInvalidArgIndex);
            layerUsed = (layerIndex != MArgList.kInvalidArgIndex);
            layerTypeUsed = (layerTypeIndex != MArgList.kInvalidArgIndex);
            setUsed = (setIndex != MArgList.kInvalidArgIndex);

            // Process each flag.
            //
            bool maxArgUsed = false;
            if (activeUsed)
            {
                if (editUsed)
                {
                    activeVal = args.asBool((activeIndex + 1));
                    if ((layerTypeIndex + 1) == maxArg)
                        maxArgUsed = true;
                }
            }

            if (appendCameraUsed)
            {
                camName = args.asString((appendCameraIndex + 1));
                if ((appendCameraIndex + 1) == maxArg)
                    maxArgUsed = true;
            }

            if (appendCameraAndSetUsed)
            {
                camName = args.asString((appendCameraAndSetIndex + 1));
                setName = args.asString((appendCameraAndSetIndex + 2));
                if ((appendCameraAndSetIndex + 2) == maxArg)
                    maxArgUsed = true;
            }

            if (cameraUsed)
            {
                if (editUsed)
                {
                    camName = args.asString(cameraIndex + 1);
                    if ((cameraIndex + 1) == maxArg)
                        maxArgUsed = true;
                }
            }

            if (deleteLayerUsed)
            {
                cameraLayer = args.asInt(deleteLayerIndex + 1);
                if ((deleteLayerIndex + 1) == maxArg)
                    maxArgUsed = true;
            }

            if (layerUsed)
            {
                cameraLayer = args.asInt(layerIndex + 1);
                if ((layerIndex + 1) == maxArg)
                    maxArgUsed = true;
            }

            if (layerTypeUsed)
            {
                if (editUsed)
                {
                    layerTypeVal = args.asString(layerTypeIndex + 1);
                    if ((layerTypeIndex + 1) == maxArg)
                        maxArgUsed = true;
                }
            }

            if (setUsed)
            {
                if (editUsed)
                {
                    setName = args.asString(setIndex + 1);
                    if ((setIndex + 1) == maxArg)
                        maxArgUsed = true;
                }
            }

            // If all of the arguments have been used, get the cameraSet node from the selection list.
            // Otherwise, get it from the last argument.
            //
            if (maxArgUsed)
                MGlobal.getActiveSelectionList(list);
            else
                list.add(args.asString(maxArg));
        }
コード例 #16
0
        public override void doIt(MArgList args)
        {
            MSelectionList list = new MSelectionList();

            if (args.length > 0)
            {
                // Arg list is > 0 so use objects that were passes in
                //
                uint last = args.length;
                for (uint i = 0; i < last; i++)
                {
                    // Attempt to find all of the objects matched
                    // by the string and add them to the list
                    //
                    string argStr = args.asString(i);
                    list.add(argStr);
                }
            }
            else
            {
                // Get arguments from Maya's selection list.
                MGlobal.getActiveSelectionList(list);
            }

            MObject           node        = new MObject();
            MObjectArray      nodePath    = new MObjectArray();
            MFnDependencyNode nodeFn      = new MFnDependencyNode();
            MFnDependencyNode dgNodeFnSet = new MFnDependencyNode();

            for (MItSelectionList iter = new MItSelectionList(list); !iter.isDone; iter.next())
            {
                iter.getDependNode(node);

                //
                // The following code shows how to navigate the DG manually without
                // using an iterator.  First, find the attribute that you are
                // interested.  Then connect a plug to it and see where the plug
                // connected to.  Once you get all the connections, you can choose
                // which route you want to go.
                //
                // In here, we wanted to get to the nodes that instObjGroups connected
                // to since we know that the shadingEngine connects to the instObjGroup
                // attribute.
                //

                nodeFn.setObject(node);
                MObject iogAttr = null;
                try {
                    iogAttr = nodeFn.attribute("instObjGroups");
                } catch (Exception) {
                    MGlobal.displayInfo(nodeFn.name + ": is not a renderable object, skipping");
                    continue;
                }

                MPlug      iogPlug        = new MPlug(node, iogAttr);
                MPlugArray iogConnections = new MPlugArray();

                //
                // instObjGroups is a multi attribute.  In this example, just the
                // first connection will be tried.
                //
                if (!iogPlug.elementByLogicalIndex(0).connectedTo(iogConnections, false, true))
                {
                    MGlobal.displayInfo(nodeFn.name + ": is not in a shading group, skipping");
                    continue;
                }

                //
                // Now we would like to traverse the DG starting from the shadingEngine
                // since most likely all file texture nodes will be found.  Note the
                // filter used to initialize the DG iterator.  There are lots of filter
                // type available in MF.Type that you can choose to suite your needs.
                //
                bool foundATexture = false;
                for (int i = 0; i < iogConnections.length; i++)
                {
                    MObject currentNode = iogConnections[i].node;

                    //
                    // Note that upon initialization, the current pointer of the
                    // iterator already points to the first valid node.
                    //
                    MItDependencyGraph dgIt = new MItDependencyGraph(currentNode,
                                                                     MFn.Type.kFileTexture,
                                                                     MItDependencyGraph.Direction.kUpstream,
                                                                     MItDependencyGraph.Traversal.kBreadthFirst,
                                                                     MItDependencyGraph.Level.kNodeLevel);
                    if (dgIt == null)
                    {
                        continue;
                    }

                    dgIt.disablePruningOnFilter();

                    for ( ; !dgIt.isDone; dgIt.next())
                    {
                        MObject thisNode = dgIt.thisNode();
                        dgNodeFnSet.setObject(thisNode);
                        try {
                            dgIt.getNodePath(nodePath);
                        } catch (Exception) {
                            MGlobal.displayInfo("getNodePath");
                            continue;
                        }

                        //
                        // append the starting node.
                        //
                        nodePath.append(node);
                        dumpInfo(thisNode, dgNodeFnSet, nodePath);
                        foundATexture = true;
                    }
                }

                if (!foundATexture)
                {
                    MGlobal.displayInfo(nodeFn.name + ": is not connected to a file texture");
                }
            }
            return;
        }
コード例 #17
0
        void parseArgs(MArgList args)
        {
            createdUsed   = (args.flagIndex(kCreateFlag, kCreateFlagLong) != MArgList.kInvalidArgIndex);
            editUsed      = (args.flagIndex(kEditFlag, kEditFlagLong) != MArgList.kInvalidArgIndex);
            queryUsed     = (args.flagIndex(kQueryFlag, kQueryFlagLong) != MArgList.kInvalidArgIndex);
            helpUsed      = (args.flagIndex(kHelpFlag, kHelpFlagLong) != MArgList.kInvalidArgIndex);
            numLayersUsed = (args.flagIndex(kNumLayersFlag, kNumLayersFlagLong) != MArgList.kInvalidArgIndex);

            // If flags are used which require no other information, return now.
            //
            if (createdUsed || helpUsed)
            {
                return;
            }

            uint maxArg                  = args.length - 1;
            uint activeIndex             = args.flagIndex(kActiveFlag, kActiveFlagLong);
            uint appendCameraIndex       = args.flagIndex(kAppendCameraFlag, kAppendCameraFlagLong);
            uint appendCameraAndSetIndex = args.flagIndex(kAppendCameraAndSetFlag, kAppendCameraAndSetFlagLong);
            uint cameraIndex             = args.flagIndex(kCameraFlag, kCameraFlagLong);
            uint deleteLayerIndex        = args.flagIndex(kDeleteLayerFlag, kDeleteLayerFlagLong);
            uint layerIndex              = args.flagIndex(kLayerFlag, kLayerFlagLong);
            uint layerTypeIndex          = args.flagIndex(kLayerTypeFlag, kLayerTypeFlagLong);
            uint setIndex                = args.flagIndex(kSetFlag, kSetFlagLong);

            activeUsed             = (activeIndex != MArgList.kInvalidArgIndex);
            appendCameraUsed       = (appendCameraIndex != MArgList.kInvalidArgIndex);
            appendCameraAndSetUsed = (appendCameraAndSetIndex != MArgList.kInvalidArgIndex);
            cameraUsed             = (cameraIndex != MArgList.kInvalidArgIndex);
            deleteLayerUsed        = (deleteLayerIndex != MArgList.kInvalidArgIndex);
            layerUsed     = (layerIndex != MArgList.kInvalidArgIndex);
            layerTypeUsed = (layerTypeIndex != MArgList.kInvalidArgIndex);
            setUsed       = (setIndex != MArgList.kInvalidArgIndex);

            // Process each flag.
            //
            bool maxArgUsed = false;

            if (activeUsed)
            {
                if (editUsed)
                {
                    activeVal = args.asBool((activeIndex + 1));
                    if ((layerTypeIndex + 1) == maxArg)
                    {
                        maxArgUsed = true;
                    }
                }
            }

            if (appendCameraUsed)
            {
                camName = args.asString((appendCameraIndex + 1));
                if ((appendCameraIndex + 1) == maxArg)
                {
                    maxArgUsed = true;
                }
            }

            if (appendCameraAndSetUsed)
            {
                camName = args.asString((appendCameraAndSetIndex + 1));
                setName = args.asString((appendCameraAndSetIndex + 2));
                if ((appendCameraAndSetIndex + 2) == maxArg)
                {
                    maxArgUsed = true;
                }
            }

            if (cameraUsed)
            {
                if (editUsed)
                {
                    camName = args.asString(cameraIndex + 1);
                    if ((cameraIndex + 1) == maxArg)
                    {
                        maxArgUsed = true;
                    }
                }
            }

            if (deleteLayerUsed)
            {
                cameraLayer = args.asInt(deleteLayerIndex + 1);
                if ((deleteLayerIndex + 1) == maxArg)
                {
                    maxArgUsed = true;
                }
            }

            if (layerUsed)
            {
                cameraLayer = args.asInt(layerIndex + 1);
                if ((layerIndex + 1) == maxArg)
                {
                    maxArgUsed = true;
                }
            }

            if (layerTypeUsed)
            {
                if (editUsed)
                {
                    layerTypeVal = args.asString(layerTypeIndex + 1);
                    if ((layerTypeIndex + 1) == maxArg)
                    {
                        maxArgUsed = true;
                    }
                }
            }

            if (setUsed)
            {
                if (editUsed)
                {
                    setName = args.asString(setIndex + 1);
                    if ((setIndex + 1) == maxArg)
                    {
                        maxArgUsed = true;
                    }
                }
            }


            // If all of the arguments have been used, get the cameraSet node from the selection list.
            // Otherwise, get it from the last argument.
            //
            if (maxArgUsed)
            {
                MGlobal.getActiveSelectionList(list);
            }
            else
            {
                list.add(args.asString(maxArg));
            }
        }