def _build_(self): try:#>>> First IK to FK i_ikMatch = cgmRigMeta.cgmDynamicMatch(dynObject=self.mi_controlIK, dynPrefix = "FKtoIK", dynMatchTargets=self.mi_locBlend) except Exception,error:raise StandardError,"[ik to fk fail]{%s}"%(error) try:#>>> FK to IK #============================================================================ i_fkMatch = cgmRigMeta.cgmDynamicMatch(dynObject = self.mi_controlFK, dynPrefix = "IKtoFK", dynMatchTargets=self.mi_locBlend) except Exception,error:raise StandardError,"[fk to ik fail! | error: %s"%(error) #>>> Register the switches try: self.mi_dynSwitch.addSwitch('snapToFK',[self.mi_settings.mNode,'blend_FKIK'], 0, [i_fkMatch]) self.mi_dynSwitch.addSwitch('snapToIK',[self.mi_settings.mNode,'blend_FKIK'], 1, [i_ikMatch]) self.mi_eyeLookDynSwitch.addSwitch('snapToFK',[self.mi_settings.mNode,'blend_FKIK'], 0, [i_fkMatch]) self.mi_eyeLookDynSwitch.addSwitch('snapToIK',[self.mi_settings.mNode,'blend_FKIK'], 1, [i_ikMatch]) except Exception,error:raise StandardError,"[switch setup fail]{%s}"%(error)
def _build_(self): try: #>>> First IK to FK i_ikMatch = cgmRigMeta.cgmDynamicMatch( dynObject=self.mi_controlIK, dynPrefix="FKtoIK", dynMatchTargets=self.mi_locBlend) except Exception, error: raise StandardError, "[ik to fk fail]{%s}" % (error)
i_rig.buildModule.build_matchSystem(i_rig) #eyelids ------------------------------------------------------------------------ m1 = cgmMeta.asMeta('l_eyelids_part') i_rig = Rig.go(m1,forceNew=False,autoBuild = False)#call to do general rig i_rig.buildModule.build_rigSkeleton(i_rig) i_rig.buildModule.build_shapes(i_rig) i_rig.buildModule.build_controls(i_rig) i_rig.buildModule.build_rig(i_rig) i_rig.buildModule.build_matchSystem(i_rig) #>>>Scratch... m1.getMessage('rigNull',simple=False) import cgm.core.cgm_RigMeta as cgmRigMeta cgmRigMeta.cgmDynamicMatch(dynObject='l_knee_ik_anim',dynPrefix = "FKtoIK",dynMatchTargets='l_knee_blend_jnt') n1 = cgmRigMeta.cgmDynamicSwitch() n1.addSwitch() Rig.get_report(spine) m1.doRig() m1.rigDelete() reload(Rig) import cgm.core.lib.attribute_utils as ATTR reload(ATTR) m1 = cgmMeta.asMeta('l_leg_part') ATTR.get_message('M1_puppetNetwork','masterControl',simple = True) m1.modulePuppet.hasAttr('masterControl') m1.modulePuppet.masterControl m1.modulePuppet.getMessage('masterControl') cgmMeta.asMeta('l_leg_rigNull_dynSwitchSystem').getMessage('dynStoredAttr_0',simple=False)
'l_l_hip_fk_anim_dynMatchDriver', 'l_l_knee_fk_anim_dynMatchDriver', 'l_l_ankle_fk_anim_dynMatchDriver', 'l_l_ball_fk_anim_dynMatchDriver' ]) a.setSwitchAttr(['left_leg_settings_anim', 'blend_FKIK']) a.setSwitchAttr(['left_leg_settings_anim', 'asfasdf']) a.setDynOwner('asdaf') a.addSwitch('FKtoIK', ['left_leg_settings_anim', 'blend_FKIK'], 1, ['l_l_hip_fk_anim_dynMatchDriver']) a.getMessage('dynSwitchAttr') a = cgmRigMeta.cgmDynamicSwitch('test_dynSwitchSystem') a.go(1) #>>> Dynamic Match #======================================================= b = cgmRigMeta.cgmDynamicMatch('l_ankle_ik_anim_dynMatchDriver') b.doMatch() dynObject = 'nurbsSphere1' dynMatchTargets = [u'pCube1', u'pCube2'] dynSnapTargets = ['worldCenter_loc'] dynNull = 'nurbsSphere1_dynMatchDriver' dynObject = 'drivenJoint' drivenObject = 'matchJoint' matchObject = 'matchJoint_loc' matchTarget = 'matchJoint_loc' a = cgmRigMeta.cgmDynamicMatch(dynObject=dynObject) a.addDynIterTarget(drivenObject=drivenObject, matchObject=matchObject,
except Exception, error: raise StandardError, "[dynSwitch fail]{%s}" % (error) def _build_(self): try: #>>> First IK to FK i_ikMatch = cgmRigMeta.cgmDynamicMatch( dynObject=self.mi_controlIK, dynPrefix="FKtoIK", dynMatchTargets=self.mi_locBlend) except Exception, error: raise StandardError, "[ik to fk fail]{%s}" % (error) try: #>>> FK to IK #============================================================================ i_fkMatch = cgmRigMeta.cgmDynamicMatch( dynObject=self.mi_controlFK, dynPrefix="IKtoFK", dynMatchTargets=self.mi_locBlend) except Exception, error: raise StandardError, "[fk to ik fail! | error: %s" % (error) #>>> Register the switches try: self.mi_dynSwitch.addSwitch( 'snapToFK', [self.mi_settings.mNode, 'blend_FKIK'], 0, [i_fkMatch]) self.mi_dynSwitch.addSwitch( 'snapToIK', [self.mi_settings.mNode, 'blend_FKIK'], 1, [i_ikMatch]) self.mi_eyeLookDynSwitch.addSwitch(
def build(self):#================================================================================ #Base info mi_moduleParent = False if self._go._mi_module.getMessage('moduleParent'): mi_moduleParent = self._go._mi_module.moduleParent mi_controlIK = self._go._i_rigNull.controlIK ml_controlsFK = self._go._i_rigNull.msgList_get('controlsFK') ml_rigJoints = self._go._i_rigNull.msgList_get('rigJoints') ml_blendJoints = self._go._i_rigNull.msgList_get('blendJoints') mi_settings = self._go._i_rigNull.settings ml_fkJoints = self._go._i_rigNull.msgList_get('fkJoints') ml_ikJoints = self._go._i_rigNull.msgList_get('ikJoints') mi_dynSwitch = self._go._i_dynSwitch #>>> Get the joints if self._go._partType == 'finger': ml_fkToDo = ml_fkJoints[1:] ml_ikToDo = ml_ikJoints[1:] ml_blendToDo = ml_blendJoints[1:] ml_fkControlsToDo = ml_controlsFK[1:] else:#thumb ml_fkToDo = ml_fkJoints ml_ikToDo = ml_ikJoints ml_fkControlsToDo = ml_controlsFK ml_blendToDo = ml_blendJoints log.info([i_jnt.getShortName() for i_jnt in ml_fkToDo]) #>>> First FK to IK ================================================================== i_ikMatch = cgmRigMeta.cgmDynamicMatch(dynObject=mi_controlIK, dynPrefix = "FKtoIK", dynMatchTargets=ml_blendJoints[-2]) i_ikMatch.addPrematchData({'fingerSpin':0}) i_ikMatch.addDynIterTarget(drivenObject = ml_ikToDo[1],#seg 1 matchObject = ml_blendToDo[1], drivenAttr= 't%s'%self._go._jointOrientation[0], minValue=0.001, maxValue=30, maxIter=15, driverAttr='lengthUpr') i_ikMatch.addDynIterTarget(drivenObject =ml_ikToDo[2],#seg2 matchObject= ml_blendToDo[2],#Make a new one drivenAttr='t%s'%self._go._jointOrientation[0], minValue=0.001, maxValue=30, maxIter=15, driverAttr='lengthLwr') i_ikMatch.addDynIterTarget(drivenObject =ml_ikToDo[3],#seg2 matchObject= ml_blendToDo[3],#Make a new one drivenAttr='t%s'%self._go._jointOrientation[0], minValue=0.001, maxValue=30, maxIter=15, driverAttr='length') i_ikMatch.addDynIterTarget(drivenObject = ml_ikToDo[1],#knee matchTarget = ml_blendToDo[1],#Make a new one minValue=-179, maxValue=179, maxIter=75, driverAttr='fingerSpin') """ i_ikHandMatch.addDynAttrMatchTarget(dynObjectAttr='ikScale', matchAttrArg= [ml_blendJoints[-2].mNode,'s%s'%self._go._jointOrientation[0]], )""" #>>> IK to FK #============================================================================ i_fk_match1 = cgmRigMeta.cgmDynamicMatch(dynObject = ml_fkControlsToDo[0], dynPrefix = "IKtoFK", dynMatchTargets=ml_blendToDo[0]) i_fk_match1.addDynIterTarget(drivenObject =ml_fkToDo[1], matchObject = ml_blendToDo[1], drivenAttr='t%s'%self._go._jointOrientation[0], minValue=0.001, maxValue=30, maxIter=15, driverAttr='length') i_fk_match2 = cgmRigMeta.cgmDynamicMatch(dynObject = ml_fkControlsToDo[1], dynPrefix = "IKtoFK", dynMatchTargets=ml_blendToDo[1]) i_fk_match2.addDynIterTarget(drivenObject =ml_fkToDo[2], matchObject = ml_blendToDo[2], drivenAttr='t%s'%self._go._jointOrientation[0], minValue=0.001, maxValue=30, maxIter=15, driverAttr='length') i_fk_match3 = cgmRigMeta.cgmDynamicMatch(dynObject = ml_fkControlsToDo[2], dynPrefix = "IKtoFK", dynMatchTargets=ml_blendToDo[2]) i_fk_match3.addDynIterTarget(drivenObject =ml_fkToDo[-1], matchObject = ml_blendToDo[-1], drivenAttr='t%s'%self._go._jointOrientation[0], #matchAttr = 't%s'%self._go._jointOrientation[0], minValue=0.001, maxValue=30, maxIter=15, driverAttr='length') """ i_fkBallMatch = cgmRigMeta.cgmDynamicMatch(dynObject = ml_controlsFK[3], dynPrefix = "IKtoFK", dynMatchTargets=ml_blendJoints[3]) i_fkWristMatch.addDynAttrMatchTarget(dynObjectAttr='fkScale', matchAttrArg= [ml_blendJoints[-2].mNode,'s%s'%self._go._jointOrientation[0]], ) """ #>>> Register the switches mi_dynSwitch.addSwitch('snapToFK',[mi_settings.mNode,'blend_FKIK'], 0, [i_fk_match1,i_fk_match2,i_fk_match3]) mi_dynSwitch.addSwitch('snapToIK',[mi_settings.mNode,'blend_FKIK'], 1, [i_ikMatch]) return True