Beispiel #1
0
    def setUpStretchyJointSegment(self, rootJoint, endJoint):
        
        ##  create polevector control
        poleVectorControl = cmds.spaceLocator(name = self.moduleName + ":" + util.stripNamespace(rootJoint)[1] + "_poleVectorLocator")[0]
        poleVectorControl_grp = cmds.group(poleVectorControl, name = self.moduleName + ":" + util.stripNamespace(rootJoint)[1] + "_poleVectorLocator_grp")
        cmds.setAttr(poleVectorControl + ".ty", -0.5)
        cmds.setAttr(poleVectorControl + ".v", 0)
        
        ## add stretch ik to joints
        stretchy_ik = util.stretchy_ik(rootJoint, endJoint, self.moduleName, poleVectorObject = poleVectorControl)
        
        rootLocator = stretchy_ik["rootLocator"]
        endLocator = stretchy_ik["endLocator"]
        ikHandle = stretchy_ik["ikHandle"]
        ##  parent objects
        doNotTouch_grp =stretchy_ik["doNotTouch_grp"]
        
        ##  determine the translation control names
        parentTranslationControl = self.moduleName + ":" + util.stripNamespace(rootJoint)[1] + "_translation_control"
        childTranslationControl = self.moduleName + ":" + util.stripNamespace(endJoint)[1] + "_translation_control"
        
        ##  point constraint root locator to root joint
        rootLocator_pointConstraint = cmds.pointConstraint(rootJoint, rootLocator, maintainOffset = False, name = rootLocator + "_pointConstraint")[0]
        ##  point constraint end locator to translation control
        endLocator_pointConstraint = cmds.pointConstraint(childTranslationControl, endLocator, maintainOffset = False, name = endLocator + "_childTranslationControlConstraint")[0]
        
        poleVectorControl_parentConstraint = cmds.parentConstraint(parentTranslationControl, poleVectorControl_grp, maintainOffset = False, name = rootLocator + "_poleVectorLocatorConstraint")[0]
        #cmds.parent(translation_controlGRP, self.controls_grp)

        return doNotTouch_grp, poleVectorControl_grp
Beispiel #2
0
    def loadJointRepresentation(self, joint):

        joint_representation = None
        jointChild = cmds.listRelatives(joint, children = True, type = "joint")

        if jointChild != None:

            jointChild = jointChild[0]
            path = environ.ControlObjectsPath + "joint_representation.ma"
            cmds.file(path, i = True, ignoreVersion = True,  renameAll=True, mergeNamespacesOnClash=True, namespace=':', options='v=0;')

            joint_representation = cmds.rename("jointRep_geo", self.moduleName + ":" + util.stripNamespace(joint)[1] + "_jointRepresentation_geo")
            cmds.parent(joint_representation, joint, a = True)

            cmds.setAttr(joint_representation + ".t", 0, 0, 0)
            cmds.setAttr(joint_representation + ".r", 0, 0, 0)
            cmds.connectAttr(jointChild + ".tx", joint_representation + ".sx")

            cmds.parent(joint_representation, world = True)

            joint_representation_parentConstraint = cmds.parentConstraint(joint,joint_representation,  maintainOffset = True, name = self.moduleName + ":" + util.stripNamespace(joint)[1] + "_jointRepParentConstraint")[0]

        return joint_representation
Beispiel #3
0
    def loadTranslationControl(self, joint):

        path = environ.ControlObjectsPath + "translation_control.ma"
        cmds.file(path, i = True, ignoreVersion = True,  renameAll=True, mergeNamespacesOnClash=True, namespace=':', options='v=0;')

        translation_control = cmds.rename("translation_control", self.moduleName + ":" + util.stripNamespace(joint)[1] + "_translation_control")
        translation_controlGRP = cmds.group(translation_control, n = self.moduleName + ":" + util.stripNamespace(joint)[1] + "_translation_controlGRP")

        cmds.parent(translation_controlGRP, self.moduleControl, a = True)

        cmds.xform(translation_controlGRP, ws = True, a = True, translation = (cmds.xform(joint, q = True, ws = True, a = True, translation = True)) )

        return translation_control