Exemplo n.º 1
0
    def createControlJnts(self):
        controlShape = controller.Controller(controlShape='circle',
                                             positionNode=self.jntChain[0],
                                             orientationNode=self.jntChain[0])
        pm.xform(controlShape, scale=(2, 4, 4))
        controlShape.makeIdentity(apply=True)

        for i, jnt in enumerate(self.jntChain):
            pm.select(jnt)
            self.fkJnts.append(pm.joint())
            self.fkJnts[-1].renameNode(name=self.TipName,
                                       index=chr(ord('A') + i))
            self.fkJnts[-1].addCon()
            self.fkJnts[-1].addTagPreset('bound')
            self.fkJnts[-1].addTag('FK')
            self.fkJnts[-1].renameShapeNodes()

            if i:
                self.fkJnts[-1].getParent().setParent(self.fkJnts[-2])

            shapes = jnt.listRelatives(shapes=True)
            if shapes:
                for shape in shapes:
                    shape.copyShapes(self.fkJnts[-1])
            else:
                pm.delete(
                    pm.pointConstraint(self.fkJnts[-1],
                                       controlShape,
                                       maintainOffset=False))
                controlShape.copyShapes(self.fkJnts[-1])

        pm.delete(controlShape)
        self.fkJnts[0].getParent().setParent(world=True)
        pm.delete(self.jntChain)
Exemplo n.º 2
0
 def addControls(self, controlShape, jnt, name, color):
     ctrl = controller.Controller(name=name,
                                  positionNode=jnt,
                                  color=color,
                                  controlShape=controlShape)
     ctrl.copyShapes(jnt)
     pm.delete(ctrl)
Exemplo n.º 3
0
 def create_and_parent_ctrl(self):
     ctrl = controller.Controller(name=self.TipName,
                                  controlShape='box',
                                  controlScale=self.ctrlSize,
                                  positionNode=self.grpPV,
                                  orientationNode=self.grpPV)
     ctrl.copyShapes(self.grpPV)
     pm.delete(ctrl)
     self.grpPV.renameShapeNodes()
Exemplo n.º 4
0
 def addTransControl(self):
     ctrl = controller.Controller(name=naming.truncLongName(self.trans),
                                   controlShape=0,
                                   controlScale=10,
                                   color=18,
                                   positionNode=self.trans,
                                   orientationNode=self.trans)
     ctrl.copyShapes(self.trans)
     pm.delete(ctrl)
     self.trans.renameShapeNodes()
Exemplo n.º 5
0
    def createControls(self):
        boxShape = controller.Controller(controlShape='box',
                                         positionNode=self.fkJnts[0],
                                         orientationNode=self.fkJnts[0])
        pm.xform(boxShape, scale=(2, 5, 5))
        for x in range(0, len(self.conJnts) + 1, 4):
            pm.delete(
                pm.pointConstraint(self.AJnts[x],
                                   boxShape,
                                   maintainOffset=False))
            boxShape.makeIdentity(apply=True)
            boxShape.copyShapes(self.AJnts[x])
            self.boxAControls.append(self.AJnts[x])
            self.AJnts[x].renameShapeNodes()

        pm.delete(boxShape)

        #glitch with pymel makes you create the control again to freeze the transformation
        boxShape = controller.Controller(controlShape='box',
                                         positionNode=self.fkJnts[0],
                                         orientationNode=self.fkJnts[0])
        pm.xform(boxShape, scale=(1.5, 3, 3))
        boxShape.makeIdentity(apply=True)
        for x in range(0, len(self.conJnts) + 1, 2):
            pm.delete(
                pm.pointConstraint(self.BJnts[x],
                                   boxShape,
                                   maintainOffset=False))
            boxShape.makeIdentity(apply=True)
            boxShape.copyShapes(self.BJnts[x])
            self.boxBControls.append(self.BJnts[x])
            self.BJnts[x].renameShapeNodes()
        for ctrl in self.boxAControls:
            ctrl.addTag('BoxA')
        for ctrl in self.boxBControls:
            ctrl.addTag('BoxB')

        pm.delete(boxShape)
Exemplo n.º 6
0
    def createAutoJnt(self):
        pm.select(self.fkJnts[-1])
        self.autoJnt = pm.joint()
        self.autoJnt.renameNode(name=self.TipName, base='%sAuto')
        self.autoJnt.addTagPreset('bound')
        self.autoJnt.addTag('ignorePointConstraint')
        self.autoJnt.addTag('ignoreOrientConstraint')

        autoControl = controller.Controller(controlShape='sun',
                                            positionNode=self.autoJnt,
                                            orientationNode=self.autoJnt)
        autoControl.makeIdentity(apply=True)
        autoControl.setParent(self.fkJnts[-1])
        autoControl.tx.set(3)
        autoControl.rz.set(90)
        self.autoJnt.addCon()
        autoControl.copyShapes(self.autoJnt)
        self.autoJnt.getParent().setParent(
            self.conJnts[-1].listRelatives(allDescendents=True)[0])
        pm.delete(autoControl)
        self.autoJnt.lockAndHide(attribute.STANDARD_ATTRIBUTES)
        self.autoJnt.radi.set(channelBox=False)