Skip to content

Instantly share code, notes, and snippets.

@Roumenov
Last active February 25, 2020 09:19
Show Gist options
  • Save Roumenov/4b5e852325235e3bbf268679d335529e to your computer and use it in GitHub Desktop.
Save Roumenov/4b5e852325235e3bbf268679d335529e to your computer and use it in GitHub Desktop.
metaRig test setup.. also messing with what kind of objects I can pass to red9 for instancing r9MetaClass
"""
metaRig test setup
also messing with what kind of objects I can pass to red9 for instancing r9MetaClass
skinned_mesh
"""
import Red9.core.Red9_Meta as r9Meta
import maya.cmds as cmds
#make a new blank mClass MayaNode
character_name = pm.ls(sl = True)[0].name()
print character_name
root = r9Meta.MetaClass(character_name)
root.delAttr('potionomicsCharacterRoot')
root.addAttr('mClass', value = 'MetaRig', attrType = 'string')
root.addAttr('mClassGrp', value = 'MetaRig', attrType = 'string')
root.addAttr('mNodeID', value = 'mSystem', attrType = 'string')
root.addAttr('rigType', value = 'character', attrType = 'string')
root.addAttr('mSystemRoot', value = True, attrType = 'bool')
#root.mNodeID = 'mSystem'
attr = root.getAttr('mSystemRoot')
print attr
for item in cmds.ls(sl=1):
item_meta_instance = r9Meta.MetaClass(item)
item_meta_instance.addAttr('noExport', attrType = 'messageSimple')
if item.hasAttr('noExport'):
print item
#item_meta_instance = r9Meta.MetaClass(item)
item_meta_instance.delAttr('jointSkin')
#item_meta_instance.addAttr('jointSkin')
else:
item_meta_instance = r9Meta.MetaClass(item)
item_meta_instance.addAttr('noExport')
pass
item = cmds.ls(sl=1)[0]
type(item)
item_meta_instance = r9Meta.MetaClass(item)
item_meta_instance.addAttr('noExport')
root.select()
meta_name = 'MetaRig_' + character_name
meta_face_name = 'MetaFace_' + character_name
mRig=r9Meta.MetaRig()
mRig.rigType = 'character'
mRig.rename(meta_name)
#mRig.mNodeID = 'mSystem'#mNodeID is put what gets slapped onto the next objects' attrs
mRig.connectChild(root, attr='exportSkeletonRoot', srcAttr = 'export')
mRig.addChildMetaNode(root, attr='exportSkeletonRoot')
mRig.addAttr('mSystemRoot', value = True, attrType = 'bool')
n1 = r9Meta.MetaClass('sylv_skin_GRP')#...let's make one via meta call
node = r9Meta.MetaClass('Saffron_MainHipC')
node.addAttr(attr = 'metaParent', attrType = 'message' )
spine_name = character_name.join('Spine')
spine= mRig.addMetaSubSystem('Spine', 'Centre', nodeName='SpineSystem', attr='SpineSystem')
spine.addAttr('controls', attrType = 'messageSimple')
spine.addRigCtrl()
spine.addRigCtrl('Saffron_MainHipC','Hips', mirrorData={'side':'Centre','slot':3})
print(spine)
#mRig.delAttr('Facial')
facial=mRig.addChildMetaNode('MetaFacialRig',attr='Facial',nodeName='FACIAL') #NEW generic method in BaseClass
@markj3d
Copy link

markj3d commented Sep 30, 2019

If you're wanting to create an mRig node then there's no need to add the attrs, just make an instance of the MetaRig class as these are all bound on instantiation. By default the class creates a Network node in the scene and thats the mrig setup for you ;) The mClass, mClassGrp, mNodeID attrs in particular are treated slightly differently in the code so I'd never make these manually..

mrig=r9Meta.MetaRig(name='my_character')

@Roumenov
Copy link
Author

Hey forgot to reply forever ago but it's super cool to see that the man himself goes around to give input! I was stumbling around a lot trying to figure out how it all works and appreciate the feedback. Really great work you've done with the whole system. The more I learn, the more impressed I am. <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment