Changing States Manually

MRS : Landing | Members | Queue | Forum | DocsLibrary | How

There are some occasions when it’s useful for us to be able to push states and changes manually.  Some of those times might be:

  • Getting to the nitty gritty when troubleshooting a problem
  • Testing new modules and changes

Error reporting is currently cleaner when you do it manually because of how the UI functions.

When we get to a MRS Maker’s Workshop on making your own rigBlocks, this whole section will get fleshed out in much more detail.

Loading CGM Python Modules

The first step is to load cgm modules locally so we can call them. There’s an easy way to do that via the ui.

Walking a module’s functions

Initialization

Before we can do anything else we must know how to instance our rigBlock.

A few notes:

  • We’ll be working in the script editor
  • Make sure you have a python tab up
  • In the script editor make sure the following are on:
    • [x] Show stack trace
    • [x] Line numbers in errors

So assuming we have a rigblock named:L_eye_eyeBlock

We can run this in the script editor

b1 = cgmMeta.asMeta('L_eye_eyeBlock')

Now we have a python object we can use to call pretty much everything else.

Basics

You should check out cgmNode and cgmObject to get further information on what’s available.

b1.mNode#...dag handle using red9's MetaClass as our super
b1.select()


#...getting the rigbLock's module...
b1.p_blockModule
b1.getBlockModule()#...get's our block's python module. 
#Often used in conjunction with this when we're working through things....
reload(b1.p_blockModule)# Do this a lot when I'm testing changes in the code base. 



Template to Skeleton

There’s two ways of doing this currently, you can use which syntax you prefer.

#...This code is to walk up and down the states.
b1.UTILS.changeState(b1,'define')
b1.UTILS.changeState(b1,'template')
b1.UTILS.changeState(b1,'prerig')
b1.UTILS.changeState(b1,'skeleton')


#You can query state by:
b1.getState()


There are specialized calls which I’ll get around to documenting as the code base solidifies.

Rig

I’ll loop back to hit this this later. There’s a lot to it. We utilize a rig class factory for processing the rig setup so that we can have a instance object to store to and do other data processing without bogging down our actual rigBlock metaClass.

Useful Nuggets

When you want to set log levels on a module.

import cgm.core.mrs.RigBlocks as RIGBLOCKS
RIGBLOCKS.log.setLevel(RIGBLOCKS.logging.DEBUG)#..debug mode on
RIGBLOCKS.log.setLevel(RIGBLOCKS.logging.INFO)#...info mode on

 

 

Josh Burton

[MRS Project Lead | CG Monks] Josh is an animator turned TD who hails from Oklahoma, pre-undergrad in the Marine Corps, animation basics at Savannah College of Art and Design, cut his teeth in gaming and commercials before co-founding CG Monks and more recently the CG Monastery. The Morpheus Rigging System is a culmination of years of R&D and he is now thrilled to see what users can create, collaborate and expand on with this open source MRS platform.