예제 #1
0
        public static List <List <Curve> > getSmothMeshEdgesPerFace(MFnMesh mayaMesh, bool createInMaya = false)
        {
            MCommandResult ptcResult = new MCommandResult();
            MCommandResult teResult  = new MCommandResult();

            int numPoly = mayaMesh.numPolygons;

            List <List <Curve> > curveObjects    = new  List <List <Curve> >(numPoly);
            MStringArray         ptcResultStr    = new MStringArray();
            MStringArray         teResultStr     = new MStringArray();
            MStringArray         teResultStrFlat = new MStringArray();

            List <Curve> tempCurveArray = null;

            if (createInMaya)
            {
            }
            else
            {
                for (int i = 0; i < numPoly; i++)
                {
                    MGlobal.executeCommand($"polyListComponentConversion -te {mayaMesh.name}.f[{i}]", teResult);
                    teResult.getResult(teResultStr);
                    MGlobal.clearSelectionList();

                    foreach (var ters in teResultStr)
                    {
                        MGlobal.selectByName(ters, MGlobal.ListAdjustment.kAddToList);
                    }
                    MGlobal.executeCommand($"ls -sl -fl", teResult);
                    teResult.getResult(teResultStrFlat);

                    tempCurveArray = new List <Curve>((int)teResultStrFlat.length);

                    foreach (var e in teResultStrFlat)
                    {
                        MGlobal.executeCommand($"polyToCurve -name deleteMe11232204332AA -form 2 -degree 3 -conformToSmoothMeshPreview 1 {e}", ptcResult);
                        ptcResult.getResult(ptcResultStr);
                        tempCurveArray.Add(DMCurve.CurveFromMfnNurbsCurveFromName(ptcResultStr[0], MSpace.Space.kPostTransform.ToString()));
                        try
                        {
                            MGlobal.deleteNode(DMInterop.getDependNode(ptcResultStr[0]));
                        }
                        catch
                        {
                            MGlobal.displayWarning("getSmothMeshEdges: unable to delete temp object");
                        }
                    }

                    curveObjects.Add(tempCurveArray);
                }
            }


            return(curveObjects);
        }
예제 #2
0
 public static void SelectComponent(string targetDagName, ConstantValue.PolySelectType pst, bool selectAll = false)
 {
     if (selectAll)
     {
         MGlobal.clearSelectionList();
         MGlobal.executeCommand(string.Format("doMenuComponentSelectionExt(\"{0}\", \"{1}\", 0)", targetDagName, ConstantValue.ComponentSelectionExt(pst)));
         SelectAll();
     }
     else
     {
         MGlobal.executeCommand(string.Format("doMenuComponentSelectionExt(\"{0}\", \"{1}\", 0)", targetDagName, ConstantValue.ComponentSelectionExt(pst)));
     }
 }