Exemplo n.º 1
0
node.simpleChild  #will now return all connected nodes to the message attr

r9Meta.getConnectedMetaNodes(nodes,
                             source=True,
                             destination=True,
                             dataType='mClass')
'''
MetaRigging!
===============================================================
NOTE: For more detailed examples of the MetaRig see the MetaRig_Morpheus.py 
example in this folder.
This class is a wrapper of the main class aimed at managing complex
rigs and finding controllers. Simple concept, you make a blank mRig
node and just hook the controllers up to it.
'''
mRig = r9Meta.MetaRig()
mRig.addGenericCtrls(
    cmds.ls(sl=True))  #add all given nodes to the 'RigCtrl' msgLink
mRig.getRigCtrls()  #return all RigCtrls from above

#note that the default mClass connect will allow you to still add
#a list of nodes to a specific msg attr.
mRig.connectChildren(cmds.ls(sl=True), 'mirrorLeft')

#From a given Maya node return all connected mNodes as mClass objects
#note that this call can clamp to source or destination and has the same
#dataType flag as the getMetaNodes call
mNode = r9Meta.getConnectedMetaNodes(cmds.ls(sl=True))[0]
'''
The above is the most basic use. Wiring all given nodes to a single attr
the issue here is how do you find a specific controller from the list? 
Exemplo n.º 2
0
import Red9.core.Red9_Meta as r9Meta
import maya.cmds as cmds
#reload(r9Meta)
'''
####################################################################
#  METHOD 1:  ADDING CONTROLS : using the mRig Presets
####################################################################

Easy method, these basic types are defined for speed, but really the
method below is the one for more experienced people as it's completely
expandable and flexible. Saying that if you want these presets expanding
just let me know. They certainly stop you having to mess with the mirrorData!
'''

#make the base MRig
mRig = r9Meta.MetaRig(name='MORPHEUS')

#Left / Right Pairs
mRig.addFootCtrl('morpheusRig_v01_00:m_leg_IKleg_Cntrl_l_anim', 'Left')
mRig.addFootCtrl('morpheusRig_v01_00:m_leg_IKleg_Cntrl_r_anim', 'Right')
mRig.addKneeCtrl('morpheusRig_v01_00:m_leg_PV_Cntrl_l_anim', 'Left')
mRig.addKneeCtrl('morpheusRig_v01_00:m_leg_PV_Cntrl_r_anim', 'Right')
#note here we're supplying axis that determine which axis are managed in the mirror code
#without these the default axis set is used and inverted during mirror
mRig.addWristCtrl('morpheusRig_v01_00:m_arm_IK_Cntrl_l_anim',
                  'Left',
                  axis='translateX,translateY,translateZ')
mRig.addWristCtrl('morpheusRig_v01_00:m_arm_IK_Cntrl_r_anim',
                  'Right',
                  axis='translateX,translateY,translateZ')
mRig.addElbowCtrl('morpheusRig_v01_00:m_arm_PV_Cntrl_l_anim', 'Left')