Beispiel #1
0
 def getShapes(self):
     shapes = cmds.ls(self.assignation, shapes=True, long=True)
     assign = list(set([i.split('.')[0] for i in self.assignation])) # CLEAN THIS MESS
     assign = list(tdLib.flatten([tdLib.getShapes(i) for i in assign])) # CLEAN THIS MESS
     shapes = shapes + assign
     if not shapes:
         raise NoAssignation('No shapes assigned to that shader')
     return shapes
Beispiel #2
0
 def getShapes(self):
     shapes = cmds.ls(self.assignation, shapes=True, long=True)
     assign = list(set([i.split('.')[0]
                        for i in self.assignation]))  # CLEAN THIS MESS
     assign = list(tdLib.flatten([tdLib.getShapes(i)
                                  for i in assign]))  # CLEAN THIS MESS
     shapes = shapes + assign
     if not shapes:
         raise NoAssignation('No shapes assigned to that shader')
     return shapes
selection = cmds.ls(sl=True, dagObjects=True)
selection = cmds.ls(selection, shapes=True)


for sel in selection:
    try:
        ncloth = tdLib.getFirstItem(cmds.listConnections(sel + '.inMesh', source=True, shapes=True))
        shape = tdLib.getFirstItem(cmds.listConnections(ncloth + '.inputMesh', source=True, shapes=True))
        OBJS.append(shape)
        OBJSCOPY.append(sel)
    except TypeError:
        pass


shadingGroups = list(tdLib.flatten([tdLib.getSGsFromShape(i) for i in OBJS]))
shaders = [tdLib.getMaterialFromSG(i) for i in shadingGroups]
assignation = {}
for i in shaders:
    assignation[i] = tdLib.getShaderAssignation(i)


objs = {}
for i, u in zip(OBJS, OBJSCOPY):
    objs[i] = u

assignationNew = {}
for shader, assign in assignation.iteritems():
    assignationNew[shader] = []
    for ass in assign:
        splitted = ass.split('.')[0]