Tuesday, 14 August 2012

MetaRig Class, looking for testers and feedback!


Going to do more on the MetaRig for Rig handling and finally look to integrate it into the whole tool chain over the next few weeks, hopefully I'll have a build with this all functional ready for testing soon. The idea is that you wire your rig to a MetaRig node and then no longer have to worry about setting the filters up in all the Red9 Ui's, they'll all just automatically pick up any MetaRigs in the scene and act appropriately.

Why, well with this setup it won't matter what rig you have, or how it's setup, this is just hidden data that binds up to anything you throw at it. It also means that via the api I'm doing you can just grab any controller in code in a very object oriented manner from the Python calls. So if you have a MetaRig node simply doing a dot complete on it will show you, and return all the controllers wired to it. It also means that all your code from that point on becomes completely generic.

From the Class Examples:

#MetaRigging!
#-----------------------------------------------------------
#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.
import Red9_Meta as r9Meta
mRig=r9Meta.MetaRig()
#add all given nodes to the 'RigCtrl' msglink
mRig.addGenericCtrls(cmds.ls(sl=True))  
mRig.getRigCtrls()  //returns : 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 MayaNode return all connected mNodes as mClass objects
mNode=r9Meta.GetConnectedMeta(cmds.ls(sl=True))[0]
 
#The above is the most basic use. Wiring all given nodes to a 
#single attr, the issue here is to find a specific controller 
#from the list? So we have a singular Add function which binds 
#the given node to a single message attr, suffixed with 'CTRL_' 
 
mRig.addRigCtrl('MyMaya_Ctrl_Hips', 'Hips'))
mRig.CTRL_Hips  //return : MyMaya_Ctrl_Hips
 
#Note that because of the autofill on the object, once you
#have a mClass Rig object you'll get a list of all the hooked 
#Controllers (added by this method) on completion in the 
#scriptEditor. Whats more mRig.getRigCtrls() will still give you 
#a full list of them back.

Also I'm going to bind up some extra data to each controller thats added for the mirror setups that I'm working on.

Looking for testers if you fancy getting involved let me know!

Red