Beispiel #1
0
 def setAverageWeight(self, vtx):
     msh = vtx.split('.')[0]
     cmds.select(vtx)
     cmds.ConvertSelectionToEdges()
     cmds.ConvertSelectionToVertices()
     neighbors = cmds.ls(sl=1, flatten=1)
     neighbors.pop(neighbors.index(vtx))
     infList = {}
     skin = self.findRelatedSkinCluster(msh)
     for vert in neighbors:
         for jnt in cmds.skinCluster(skin, q=1, wi=1):
             amt = cmds.skinPercent(skin, vert, q=1, t=jnt)
             if amt > 0.0:
                 if jnt in infList: infList[jnt].append(amt)
                 else: infList[str(jnt)] = [amt]
     for inf in infList:
         total = None
         for w in infList[inf]:
             if not total: total = w
             else: total += w
         weight = total / len(infList[inf])
         cmds.skinPercent(self.currentSkin,
                          vtx,
                          tv=[str(inf), weight],
                          nrm=1)
Beispiel #2
0
 def Action_SelectBorder():
     maya_cmds.undoInfo(openChunk=True)
     try:
         maya_cmds.ConvertSelectionToEdges()
         maya_cmds.polySelectConstraint(mode=2, type=0x8000, where=1)
         mel_eval('resetPolySelectConstraint')
     except Exception as e:
         print >> stderr, str(e)
     maya_cmds.undoInfo(closeChunk=True)
Beispiel #3
0
def unwrapBySeams():

    # Variables and Selection
    unf = cmds.checkBox('unf', q=True, v=True)
    lyt = cmds.checkBox('lyt', q=True, v=True)
    selEdges = cmds.ls(sl=True)
    cmds.ConvertSelectionToShell()

    cmds.polyForceUV(unitize=True)
    cmds.ConvertSelectionToEdges()
    cmds.select(selEdges, d=True)
    cmds.polyMapSewMove()

    # Unfold if chosen
    if (unf == 1):
        cmds.unfold()

    # Layout if chosen
    if (lyt == 1):
        cmds.select(selEdges)
        cmds.ConvertSelectionToShell()
        cmds.ConvertSelectionToUVs()
        cmds.polyLayoutUV(sc=1, ws=True, rbf=2)
Beispiel #4
0
def selEdge(*args):
	cmds.ConvertSelectionToEdges()