Ejemplo n.º 1
0
    def renameRigid(self):
        selection = pm.selected()
        out = flatList([pm.PyNode(x).getShapes() for x in selection])
        nRigids = flatList([x.outputs(type='nRigid') for x in out])

        for rigids, sel in zip(nRigids, selection):
            pm.rename(rigids, '{}__nRigid__'.format(sel))
Ejemplo n.º 2
0
    def renameCloth(self):
        selection = pm.selected()
        out = flatList([pm.PyNode(x).getShapes() for x in selection])
        nCloths = flatList([x.outputs(type='nCloth') for x in out])

        for cloth, sel in zip(nCloths, selection):
            pm.rename(cloth, '{}__nCloth__'.format(sel))
Ejemplo n.º 3
0
 def keyBls(self):
     all_bls = flatList([adb.findBlendShape(str(x)) for x in pm.selected()])
     weight_name = flatList([pm.PyNode(x).getTarget() for x in all_bls])
     all_weight_name = [
         weight_name[index] for index in range(0, len(pm.selected()))
     ]
     for bls, w_name in zip(all_bls, all_weight_name):
         pm.setKeyframe('{}.{}'.format(bls, w_name))
     sys.stdout.write('Blendshapes Keyed!!! \n')
Ejemplo n.º 4
0
    def getOutputs(self):
        """
        get outputs from a selection based on the type.
        """
        selection = pm.selected()
        out = flatList([pm.PyNode(x) for x in selection])
        out_shape = flatList([pm.PyNode(x).getShapes() for x in selection])
        all_outs = out + out_shape
        _output = list(set(flatList([x.outputs() for x in all_outs])))

        print(_output)
        return _output
Ejemplo n.º 5
0
    def _addControls(self):
        """ add controls to the follicules """
        oJoints = pm.selected()
        create_ctrls = flatList(sl.makeCtrls(sl.ball_shape))

        # get the scale of the joint to add 0.5 on the scale of the controller
        [
            x.scaleX.set((pm.PyNode(oJoints[0]).radius.get()) + 0.5)
            for x in create_ctrls
        ]
        [
            x.scaleY.set((pm.PyNode(oJoints[0]).radius.get()) + 0.5)
            for x in create_ctrls
        ]
        [
            x.scaleZ.set((pm.PyNode(oJoints[0]).radius.get()) + 0.5)
            for x in create_ctrls
        ]

        for joints, ctrls in zip(oJoints, create_ctrls):
            pm.parent(ctrls, pm.PyNode(joints).getParent())

        for joints, ctrls in zip(oJoints, create_ctrls):
            pm.parent(joints, ctrls)

        [
            pm.makeIdentity(x, n=0, s=1, r=1, t=1, apply=True, pn=1)
            for x in create_ctrls
        ]

        return create_ctrls
Ejemplo n.º 6
0
 def deleteSetup(self):
     """Delete the Setup"""
     groups = self.getJointsGrp
     pm.parent(self.getJoints, w=True)
     pm.delete(groups)
     child = [x.getChildren() for x in self.getJoints]
     children = flatList(child)
     pm.delete(children)
     adb.ChainParent(self.getJoints)
     for joint in self.getJoints:
         pm.PyNode(joint).rename(
             str(joint).replace('_fk__ctrl__', '__jnt__'))
Ejemplo n.º 7
0
 def getJointsGrp(self):
     parent = [pm.PyNode(x).getParent() for x in self.getJoints]
     parent_list = flatList(parent)
     return parent_list
Ejemplo n.º 8
0
 def fromSelected(cls):
     """ Return the list of Blendshapes from selected mesh"""
     bls = flatList([findBlendShape(x) for x in pm.selected()])
     return [cls(bs) for bs in bls]
Ejemplo n.º 9
0
 def ActiveBLS(value):
     all_bls = flatList([adb.findBlendShape(str(x)) for x in selection])
     [pm.PyNode(x).setWeight(0, value) for x in all_bls]
     sys.stdout.write('blendshapes set to {} \n'.format(self.bls_value))