def getJointChain(_topJoint): error.assertType(_topJoint, ["", u'']) error.assertMayaType(_topJoint, "joint") jointList = cmds.listRelatives(_topJoint, ad=True, type="joint") jointList.append(_topJoint) jointList.reverse() return jointList
def aimWrist(self, _fkWrist, _blendControlAttrs): error.assertType(_fkWrist, ["", u'']) error.assertList(_blendControlAttrs, ["", u'']) assert len(_blendControlAttrs) == 2, "_blendControls must contain two elements" # Make sure wrist is aimed right # create fix control that always aims as fk should. # this is used to help blend between ik and fk if (self.m_rigWrist): group = cmds.group(n="%s_wrist_blendFix_GRP" %(self.m_name), em=True) cmds.parent(group, self.m_group) rc.orientControl(group, self.m_wristCtrl) cmds.pointConstraint(self.m_joints.m_wrist, group, mo=1) # Create up locator wristAimFix = cmds.spaceLocator(n="%s_wristAimFix_LOC" %(self.m_name))[0] rc.addToLayer(self.m_sceneData, "hidden", wristAimFix) cmds.parent(wristAimFix, self.m_joints.m_elbow2, r=1) aimOffset = 1 if self.m_isMirrored: aimOffset *= -1 cmds.setAttr("%s.t%s" %(wristAimFix, self.m_twistAxis), aimOffset) aim = cmds.aimConstraint( self.m_joints.m_elbow2, group, worldUpType = "object", worldUpObject = wristAimFix, mo = True )[0] orient = cmds.orientConstraint( _fkWrist, "%s_SDK" %(self.m_wristCtrl), mo= True )[0] orient = cmds.orientConstraint( group, "%s_SDK" %(self.m_wristCtrl), mo= True )[0] cmds.setAttr("%s.interpType" %(orient), 2) cmds.connectAttr( _blendControlAttrs[0], "%s.%sW0" %(orient, _fkWrist) ) cmds.connectAttr( _blendControlAttrs[1], "%s.%sW1" %(orient, group) )