This class was created with two purposes in mind:
- To share some of the many lessons learned over the past several years working with red9’s great code base
- To provide a basic foundation of knowledge for those wanting to delve into MRS (Morpheus Rigging System) continued development.
In 2009 David Hunt's GDC Presentation on Modular Procedural Rigging introduced the concept of MetaData rigging and the advantages of such a system. Building this from scratch at each studio is not piratical and creates lots of duplicate work, this is where red9 tools come in. This course will help you understand MetaData in Maya and help you start to build smart aware rigs and let you create a better rig pipeline at your studio.
About Red9:
Red9 StudioTools have been born out of frustration at Autodesks reluctance to add some of these core features and workflows into Maya itself. Why OpenSource, well I want to give something back to the industry as I feel damn sorry for studios without the benefit of a large R&D department to craft pipelines around them. The Studio Pack is designed to speed up a modern animation pipeline.
Class example:
Some might wonder what reason you might want to use red9’s code base or what benefits in particular you might find. The easiest way to give a quick example would be to provide a code example of a typical rigging task but with and without meta. Let’s look at something one does pretty regularly while rigging – do some stuff on a given joint chain."
First, open up Maya and make an amazing joint chain. If it’s not amazing, that’s okay – start over and do it again.
Here’s some standard code based on a selected joint chain:
def jointStuff_standard():
l_joints = mc.ls(sl = 1)
for jnt in l_joints:#Validation loop before doing stuff...
if not mc.objectType(jnt) == 'joint':
raise ValueError,"Not a joint: {0}".format(jnt)
for i,jnt in enumerate(l_joints):
#First we're gonna create a curve at each joint. Name, parent and snap it ...
jnt = mc.rename(jnt,"ourChain_{0}_jnt".format(i))#...gotta catch stuff when you rename it
str_crv = mc.circle(normal = [1,0,0], ch = 0)[0]
str_crv = mc.parent(str_crv,jnt)[0]#...gotta catch stuff when you parent it
str_crv = mc.rename(str_crv, '{0}_crv'.format(jnt))#...everytime it changes
mc.delete(mc.parentConstraint(jnt, str_crv, maintainOffset = False))
#Now we wanna add a locator at each joint - matching, position,orientation,rotation order
loc = mc.spaceLocator(n = "{0}_loc".format(jnt))[0]
ro = mc.getAttr('{0}.rotateOrder'.format(jnt))
mc.setAttr('{0}.rotateOrder'.format(loc),ro)
mc.delete(mc.parentConstraint(jnt, loc, maintainOffset = False))
#Now if we wanna store data on each object one to another...
mc.addAttr (jnt, ln='curveObject', at= 'message')
mc.connectAttr ((str_crv+".message"),(jnt+'.curveObject'))
mc.addAttr (str_crv, ln='targetJoint', at= 'message')
mc.connectAttr ((jnt+".message"),(str_crv+'.targetJoint'))
mc.addAttr (loc, ln='source', at= 'message')
mc.connectAttr ((jnt+".message"),(loc+'.source'))
#...the contains none of the built in checking and verifying built in to metaData and if you tried to
#...run this on message attributes that existed or were locked or 15 other scenerios, it would fail
Here’s meta code. Simpler. Clearer. Much faster to write.
def jointStuff_meta():
ml_joints = cgmMeta.validateObjListArg(mc.ls(sl=1), mayaType = 'joint')
#...gets us a validated meta data list of our selection
for i,mJnt in enumerate(ml_joints):
mJnt.rename("ourChain_{0}_jnt".format(i))
mi_crv = r9Meta.MetaClass( mc.circle(normal = [1,0,0], ch = 0)[0])
mc.parent(mi_crv.mNode, mJnt.mNode)
mi_crv.rename('{0}_crv'.format(mJnt.p_nameBase))#...p_nameBase property cgmMeta only
mc.delete(mc.parentConstraint(mJnt.mNode, mi_crv.mNode, maintainOffset = False))
#...same data storage
mJnt.connectChildNode(mi_crv,'curveObject','targetJoint')
mJnt.doLoc()#..doLoc cgmMeta only
If this looks like something you’d like to delve into, check out the class. I wish there was a class like this out there when I started with the meta stuff 4 years ago. Hope you find it helpful:)