Пример #1
0
    def doIt(self, args):
        dagPath = mt.selected_dagPath();
        meshFn = om.MFnMesh(dagPath);

        mel.eval("SelectVertexFaceMask");
        cmds.select(cl=True);

        vp1 = om.MPoint(); vp2 = om.MPoint(); vp3 = om.MPoint();

        (nFV, F) = mt.getTopology(meshFn);
        for kF in range(len(nFV)):
            if nFV[kF]==5:
                V = mt.face_vertices(dagPath, kF);
                maxAngle = 0.0;
                for kV in range(5):
                    meshFn.getPoint(V[(kV-1)%5], vp1)
                    meshFn.getPoint(V[kV],vp2);
                    meshFn.getPoint(V[(kV+1)%5], vp3);
                    a=vp1 - vp2; 
                    if a*a>0: a=a/a.length();
                    b=vp3 - vp2; 
                    if b*b>0: b=b/b.length();
                    angle = math.acos(a*b);
                    if angle>maxAngle:
                        T=V[kV]; maxAngle = angle;
                cmds.select(dagPath.fullPathName()+".vtxFace["+str(T)+"]["+str(kF)+"]", tgl=True);
Пример #2
0
    def doIt(self, args):
        dagPath = mt.selected_dagPath();
        meshFn = om.MFnMesh(dagPath);

        (nFV, F) = mt.getTopology(meshFn);

        mU = om.MFloatArray(len(F),0.5);
        mV = om.MFloatArray(len(F),0.5);
        mI = om.MIntArray(len(F),0);

        TU = [0.5, 0.5, 0,   0];
        TV = [0.5,   0, 0, 0.5];

        idx=0;
        vp1 = om.MPoint(); vp2 = om.MPoint(); vp3 = om.MPoint();

        for kF in range(len(nFV)):
                V = mt.face_vertices(dagPath, kF);
                FC = 0; maxV = 0;
                for kV in range(4):
                    if V[kV]>maxV:
                        FC=kV; maxV=V[kV];
                        
                for kFV in range(4):
                    mU[idx] = TU[(kFV-FC)%4];
                    mV[idx] = TV[(kFV-FC)%4];
                    mI[idx] = idx;
                    idx = idx + 1;
                continue;
                
        meshFn.clearUVs();
        meshFn.setUVs(mU, mV);
        meshFn.assignUVs(nFV, mI);
Пример #3
0
    def doIt(self, args):
        dagPath = mt.selected_dagPath();
        meshFn = om.MFnMesh(dagPath);

        mel.eval("SelectVertexMask");
        cmds.select(cl=True);

        tccNode = mt.get_TCC_DGnode(dagPath);
        T = om.MIntArray(meshFn.numVertices(), 0);
        if tccNode is not None:
            Tb = cmds.getAttr(tccNode.name()+".T");
            (nFV, F) = mt.getTopology(meshFn);
            for k in range(len(F)):
                T[F[k]] += Tb[k];

        polesArray = [];
        connectedEdges = om.MIntArray()
        vertexIter=om.MItMeshVertex(dagPath)
        while not vertexIter.isDone():
            vertexIter.getConnectedEdges(connectedEdges);
            valence = len(connectedEdges) + T[vertexIter.index()];
            if (not vertexIter.onBoundary()) and (valence!=4):
                polesArray.append(vertexIter.index());
            vertexIter.next()
            
        for k in polesArray:
            cmds.select(dagPath.fullPathName()+".vtx["+str(k)+"]", tgl=True);
Пример #4
0
    def doIt(self, args):
        dagPath = mt.selected_dagPath()
        meshFn = om.MFnMesh(dagPath)

        mel.eval("SelectVertexFaceMask")
        cmds.select(cl=True)

        vp1 = om.MPoint()
        vp2 = om.MPoint()
        vp3 = om.MPoint()

        (nFV, F) = mt.getTopology(meshFn)
        for kF in range(len(nFV)):
            if nFV[kF] == 5:
                V = mt.face_vertices(dagPath, kF)
                maxAngle = 0.0
                for kV in range(5):
                    meshFn.getPoint(V[(kV - 1) % 5], vp1)
                    meshFn.getPoint(V[kV], vp2)
                    meshFn.getPoint(V[(kV + 1) % 5], vp3)
                    a = vp1 - vp2
                    if a * a > 0: a = a / a.length()
                    b = vp3 - vp2
                    if b * b > 0: b = b / b.length()
                    angle = math.acos(a * b)
                    if angle > maxAngle:
                        T = V[kV]
                        maxAngle = angle
                cmds.select(dagPath.fullPathName() + ".vtxFace[" + str(T) +
                            "][" + str(kF) + "]",
                            tgl=True)
Пример #5
0
    def doIt(self, args):
        dagPath = mt.selected_dagPath()
        meshFn = om.MFnMesh(dagPath)

        mel.eval("SelectVertexMask")
        cmds.select(cl=True)

        tccNode = mt.get_TCC_DGnode(dagPath)
        T = om.MIntArray(meshFn.numVertices(), 0)
        if tccNode is not None:
            Tb = cmds.getAttr(tccNode.name() + ".T")
            (nFV, F) = mt.getTopology(meshFn)
            for k in range(len(F)):
                T[F[k]] += Tb[k]

        polesArray = []
        connectedEdges = om.MIntArray()
        vertexIter = om.MItMeshVertex(dagPath)
        while not vertexIter.isDone():
            vertexIter.getConnectedEdges(connectedEdges)
            valence = len(connectedEdges) + T[vertexIter.index()]
            if (not vertexIter.onBoundary()) and (valence != 4):
                polesArray.append(vertexIter.index())
            vertexIter.next()

        for k in polesArray:
            cmds.select(dagPath.fullPathName() + ".vtx[" + str(k) + "]",
                        tgl=True)
Пример #6
0
    def doIt(self, args):
        dagPath = mt.selected_dagPath()
        meshFn = om.MFnMesh(dagPath)

        mel.eval("SelectVertexMask")
        cmds.select(cl=True)

        tccNode = mt.get_TCC_DGnode(dagPath)
        T = om.MIntArray(meshFn.numVertices(), 0)
        if tccNode is not None:
            Tb = cmds.getAttr(tccNode.name() + ".T")
            (nFV, F) = mt.getTopology(meshFn)
            for k in range(len(F)):
                T[F[k]] += Tb[k]

        vertexIter = om.MItMeshVertex(dagPath)
        while not vertexIter.isDone():
            idx = vertexIter.index()
            if T[idx] > 0:
                cmds.select(dagPath.fullPathName() + ".vtx[" + str(idx) + "]", tgl=True)
            vertexIter.next()
Пример #7
0
    def doIt(self, args):
        dagPath = mt.selected_dagPath()
        meshFn = om.MFnMesh(dagPath)

        mel.eval("SelectVertexMask")
        cmds.select(cl=True)

        tccNode = mt.get_TCC_DGnode(dagPath)
        T = om.MIntArray(meshFn.numVertices(), 0)
        if tccNode is not None:
            Tb = cmds.getAttr(tccNode.name() + ".T")
            (nFV, F) = mt.getTopology(meshFn)
            for k in range(len(F)):
                T[F[k]] += Tb[k]

        vertexIter = om.MItMeshVertex(dagPath)
        while not vertexIter.isDone():
            idx = vertexIter.index()
            if T[idx] > 0:
                cmds.select(dagPath.fullPathName() + ".vtx[" + str(idx) + "]",
                            tgl=True)
            vertexIter.next()