Archive for August, 2016

Mon, Aug 29th, 2016
posted by jjburton 02:08 PM


We’re pleased to announce our first on demand class with Rigging Dojo – Intro to Metadata. This is our first class of this type in general and we hope folks find it helpful. Click on the pic above or here….

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 Morpheus Rig 2’s continued development.

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.

Note — this exercise was painful to write as I’d forgotten most of the standard calls and ways to do stuff as so much is just built in now…

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 = = 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 = = [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.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 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(, mayaType = 'joint')#...gets us a validated meta data list of our selection
    for i,mJnt in enumerate(ml_joints):
        mi_crv = r9Meta.MetaClass( = [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.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:)