Archive for the 'Tools' Category

Tue, Oct 16th, 2012
posted by jjburton 12:10 PM

Sorry for the delays. Been busy on gigs and the Morpheus Kickstarter. Been wresting with matrices and space distances and maya. Api worldSpace returns are usually in cm though the docs fail to specify. More on this and more another time. Back to the build.


Build notes(apologies, this is only from the last couple of weeks. Older changes may not be reflected):

  • General
    • started moving some reporting info to a debugReport flag toggle to keep the script editor a little clearer
    • Need to start doing some unit testing stuff
  • classes.ObjectFactory
    • Added flag to doParent, if False is passed into it, it will parent to world
  • classes.ContextFactory
    • clickSurface renamed to click Mesh
      • fixed various bugs
      • clamping works now
      • follicle creation added
      • locator and joint sizing
      • added implementation to tdTools
  • classes.ControlFactory(NEW)
    • subclass to ObjectFactory to handle control specific things
    • + verifyAimControls – necessary controls for a control to be aimed
    • + verifyRotateOrderControl – rotate order control, and connects
  • cgm.geo
    • added returnClosestUVToPos – standalone api tool for clickMesh
  • classes.SetFactory
    • Added cgm tag copying on duplication
  • cgmSetMenu
    • Added autohide options
    • Added a cap on loaded sets
  • cgm.distance
    • + returnPositoniDataDistanceSortedList(startPos,posList)
    • massive rework to returnObjectSets, not sorts scene sets
    • returnMayaInfo – added ‘currentUnit’
    • returnReferencePrefix – fixed to allow for reference chains – ref1:ref2
  • setTools/setToolsLib
    • added version on window
    • rewrote for stored instance method for speed improvements
    • Added multi setting for qss sets
    • Moved all set sorting to
    • reworked doGroupLocal
    • Fixed rename
    • added ability to duplicated referenced sets
    • Various bug fixes
  • cgm.tdTools
    • Added version to window
    • Added a better rotation order to the master anim
    • Made control creation to use ControlFactory instead of ObjectFactory to get base control settings in
    • NEW FEATURE – Click Mesh
      • lots of options, play with it and see:)
  • cgm.attributes
    • Bug fixes in doGetAttr and doCopyAttr
  • cgm.joints
    • Added default options to orientJoint
  • cgm.lists
    • Added returnReplacedNameList
  • cgm.nodes
    • createNamedNode
    • added follicle
    • createPoseBuffer – fixed call bug
    • createNamedNode – added condition node to list of known nodes
Sat, Oct 13th, 2012
posted by jjburton 01:10 PM

So saw some questions on these enigmas around and wanted to attempt to shed some light on them.

optionVars are maya devices for saving information between maya sessions, from say one tool session to another or any other wide variety of things. By default you use them like something like this:

If you decided you wanted to play with optionVars. They’re awesome but can be a bugger to get working the way you want them. We use them to save settings between gui sessions and even to send info to some stand alone functions.
import maya.cmds as mc
case = ‘int’
if not mc.optionVar(exists =’optionVarTest’):#if it doesn’t exist, make it
if case == ‘int’:
mc.optionVar(iv=(,0))#creates an int one
elif case == ‘float’:
mc.optionVar(fv=(,0))#creates a float one
elif case == ‘string’:
mc.optionVar(sv=(,”))#creates a string one

mc.optionVar(q=’optionVarTest’)#To get a value

If you want to add to a string one you have to remember it’s a string one and use a different flag than a int or float one. It got confusing to us, so we decided to go a different route.

We wrote a class wrapper for dealing with them that made it easier for us to get a handle on so that we call them at the top of any gui with something like:
from cgm.lib.classes.OptionVarFactory import *

self.OptionVarInstance = OptionVarFactory(‘cgmVar_Name’, defaultValue = 0)

That initializes the option var to an instance that can be appended, rebuilt, culled purged, cleared, call, converted or whatever in any of our tools.

The defaultValue flag sets the value only if the optionVar doesn’t exist. We did that so that if a specific tool is reset and has it’s flags wiped. It builds again with the default ‘factory’ settings. It also converts on the fly so if you pass a string to a non string optionVar, it converts it to a string, and so on.

Settings are called and set via commands like:
v = 1 # pretty straight forward
self.OptionVarInstance.form # type of option var it is
self.OptionVarInstance.value # to call value
self.OptionVarInstance.set(v) # to set
self.OptionVarInstance.toggle() # only works on ints for bool type functionality
self.OptionVarInstance.append(v) # makes list and/or appends
self.OptionVarInstance.remove(v) # removes an item
self.OptionVarInstance.clear() # clears it
self.OptionVarInstance.purge() # deletes it

We also flag all of our optionVar’s with a ‘cgmVar’ so that we can easily do a full wipe of our variables when needed for testing.

You’re welcome to give it a try if you like or take part of it it works for you and run with it or join us and help make it better. It’s in the cgmTool box from cgMonks – cgm/lib/classes/OptionVarFactory

Have a great weekend!

Fri, Sep 14th, 2012
posted by jjburton 08:09 AM

Where we’re at in the tag animation. Been busy around here…

  • Bokser and I were both away some on vacation time and are starting a new gig this week so it’ll be slow on the update front
  • Lookin to post the Morpheus 2.0 Kickstarter teaser vid next week. Lookin forward to it
  • Hopin to get back to the rigger soon, it should would be handy about now
  • Guild Wars 2 is awesome
Fri, Aug 17th, 2012
posted by jjburton 03:08 PM

New build for some testers wanting to play with cgm.clickSurface…



  • retooledclickIntersections,clickSurface ,clickMidPoint into one class handler with a mode argument
  • clickSurface
    • added setMode
    • added reset
    • Modified tool to make it more interactive. Doesn’t commit till you release the button
    • Added a dragUpdate mode to allow ‘drawing stuff’
    • fixed some bugs
Wed, Aug 15th, 2012
posted by jjburton 10:08 AM

Been a bit. Trip to LA, Keith making Squirrely move through space and all, Siggraph, sleep…


Lessons Learned

  1. Store import objects to message attributes during a script to make sure you always have it’s name
  2. If you think a nested list is sounded good, see if a dictionary will work better
  3. Looking at code a year after writing it is painful….so very painful…
  4. Document your code!
  5. I appear to be close the edge of my current abilities in this current endevour and am more than ready to get back to rigging characters. This modular rigger may well break me:)
  6. Push auxilary keywords out of the def declaration for classes that will push keywords through
  7. Don’t use “”” in the body of code for commenting, it makes it harder to comment out sections
  8. Took another stab at the bridge concept to no avail:
    It doesn’t look like a singleton is what I’m looking for but the ability to intialize a super class from side a class and then see that instance from other instances. 



Build Notes

  • AttrFactory
    • Added lock flag ability on  call
    • Can now pass list values directly into compound attributes (vectors)
  • ObjectFactory
    • getNameTagsFromObject – copies cgm name tags from a target object
    • setDrawingOverrideSettings – added to easily set drawing overrides
  • Limb.module & ModuleFactory
    • getPartBaseDistance – gets base distance for a module with a start point and a mesh group
    • getGeneratedInitialPositionData – get’s split info for starting positions for controls to be built from
  • cgm.attributes
    • doGetAttr – fixed a bug I introduced with double attributes
    • doDeleteAttr – added a check for children attributes
    • doCopyAttr – added connectTargetToSource option
    • returnUserAttrsToDict – fixed a logic break down
  • cgm.dictionary
    • Added validateDirection – returns a validated direction from a dictionary of check terms
    • Added validateDirectionVector – to get back a valid vector from either string or vector call. False if not valid
  • cgm.distance
    • returnClosestPoint(startPos,posList) – pretty self explanatory
  • cgm.modules
    • doPurgeNull – fixed
  • cgm.position
    • moveAimObjects – aim a list of objects one to another with settings
    • Added some assertion checks
    • Modified most of the functions to allow string calls for vectors
  • cgm.rigging
    • zeroTransformMeObject – Fixed a bug introduced from some NameFactory work a few weeks back
  • cgm.constraints
    • Added – returnNormalizedWeightsByDistance = better distance weight tool whereby giving greater weight to closer objects
  • ModuleFactory
    • Added axis
    • Added returnOverrideColors
    • Added getState – simple state check for module
    • getCoreNames – generate core names for a module
  • DraggerContextFactory (NEW)
    • screenToWorld(startX,startY) – converts a screen space dragger context click to world space
    • findMeshIntersection(mesh,raySource,rayDir) – Return the closest point on a surface from a raySource and rayDir
    • class ContextualPick – class version of draggerContext to do magic with
    • class clickIntersections – class function to get intersected points on a mesh from a point in space and a vector
    • class clickSurface – class function to get surface points on a mesh from a draggerContext thingy
  • PuppetFactory
    • Added temp bridge to facilitate faster loads
    • Worked on aiming logic for templates
    • getState – checks the state of a puppet which happens to be the min state of it’s modules
    • doSize – working on batch template stuff for rigger
    • getOrderedModules
    • getOrderedParentModules – get’s an ordered list of parent modules by heirarchy and stores a dictionary of module children indexed to module name as well as stores rootModules to self
  • cgm.PuppetBox
    • Added temp bridge to facilitate faster loads
    • Setup initial if checks for state for buttons, help and report stuff
    • Added puppet state checking for the report at the top
    • Added axis setting per module via pop up menu
    • Added copy axis from parent module
      • currently just working with master module
Mon, Aug 6th, 2012
posted by jjburton 10:08 AM

This week we’ve got a great little demo by one of Josh’s good friends –  talented animator and teacher, Keith Osborn. He put together nice little demonstration for how to use cgm.locinator to bake animation of a character from local space to world space and back. In this case, Keith takes a cycled animation cycle of ole’ Squirrely and animates the master translate, then plots that animation through the scene. Enough explanations, just give it a watch!

Work has been plugging a long in the meantime – mainly on the rigger – just don’t have enough to show that makes sense. Josh is out in LA visiting David and we’ve been making plans for Morpheus 2.0 and for the next year of development. Super exciting:)


Mon, Jul 23rd, 2012
posted by jjburton 09:07 AM

Good week last week on the rigger. Plugging along…


Lessons of the week

  1. I’m getting really really good at hard crashing Maya
  2. FrameLayout within a FormLayout no worky.
  3. Instead of being an idiot and reinitializing the same object for multiple classes, just link it
  4. So a pretty big annoyance with instanced gui’s is that they lose direct access to the root maya python space aside from doing a mel.eval. So I think I have a working way to linking to that with a bridge class if you will.
  5. When initializng objects and attributes, if an object is going to have more than one attribute, intialize it as an ObjectFactory instance before passing into into the AttrFactory so each instance of the AttributeFactory is linked back to the base object (in case of name changes). It also enable simple data storing when an ObjectFactory obj is initialized
  6. You can attach ui elements that have to do with a particular instance back to that instance. For example, if I want to connect a text field instance from baseMelUI, I could do self.Module[i].textField = MelTextField(whatever). Then I can call it back from another function as in self.Module[i].textField(edit=True, ***). Nifty 
    1. On second thought, not sure this is a grand idea
  7. Need to ensure to pass through verify functions to children modules
  8. Spent way too much time trying to track down a maya crash bug. I’m not sure why but maya doesn’t seem to like deleting and adding UI elements on the fly as it doesn’t crash till it finishes the functions and is going to update the gui. So instead of that, i’m just sticking with storing vital ui components to dictionaries stored to the gui and indexed to the modules index
  9. BaseMelUI bug – Seems to be an issue with getMenuItems and getSelectedIdx for MelOptionMenu
  10. Need to be careful with Callbacks, shouldn’t pass instances into them that could no longer be valid after a change somewhere else
  • General
    • added a connect to wing fuction in the Dev tab
    • Lots of general work with naming
  • AttrFactory
    • Modified to be allowed to pass an ObjectFactory instance through as the object name
    • Changed reporting to generally be shortNames rather than long to make things a bit neater in the script editor
  • ObjectFactory
    • Added option on doName to rename the heirarchy below as well
    • Removed the requirement of an object existing on call, it not creates a null with that name if nothing exists
    • Made you able to pass object factory instances into:
      • doParent
      • copyPivot
      • copyRotateOrder
  • cgm.dictionary
    • added gui DirectionColors
  • ModuleFactory
    • Added forceNew keyword arg to make it add a new one for certain gui fuctions
    • added moduleType as an instanced attr
    • added changeBaseName – module based base name changer
      • Changed changeBaseName(self,string) to a more general version…changeCGMTag(self,tag,string)
    • added setParentModule – connects module to parent module
    • Added masterClass storage
    • Rewrote after discovering better way of passing through ObjectFactory instances to save memory and ease
  • PuppetFactory
    • Functions
      • puppet
        • delete
      • module
        • addModule – updated to work with dict
        • remove
        • delete
        • change tag and rename/reinitaiize
    • Decided to index module instances via their index on the buffer object rather than by name to avoid having to keep checking for name changes.
    • Issues with naming from doing scene unique on some stuff fixed
    • Added changeModuleBaseName function
    • Rewrote after discovering better way of passing through ObjectFactory instances to save memory and ease
  • Limb.module
    • Rewrote after discovering better way of passing through ObjectFactory instances to save memory and ease
    • Added some more default options for Limbs
    • Added master class verify and intialize before doing subclass version
    • Added masterClass storage
  • cgm.puppetBox and cgm.puppetBoxLib
    • Updated add module to work off a simple string
    • Added – uiModuleUpdateFrameLabel(self,index)
    • Added – uiUpdateIntAttrFromField(self,fieldsDict,attrClassInstance,index)
    • Added a delete function to the menu and lib
    • Added verify and initialze functions to gui
    • Reworked the per module stuff to not call instances on callbacks
    • Color change links to direction now
    • Direction and Postion option menu’s work now
  • NameFactory
    • retooled iteration logic to better account for ‘claimed’ iterators
Mon, Jul 16th, 2012
posted by jjburton 08:07 AM

New build for the week. Lots of work last week on the underpinning classes for the new rigger which we’re dubbing ‘cgm.puppetBox’ for now. Need help running down a bug with cgm.setTools. If you have any info on hard mayra crashes stemming from it, please forward as we’re unable to replicate it.


  • cgm.puppetBox
    • Added a frame layout for axis stuff
    • Got modules start
  • AttrFactory
    • Make axis setup work priority wise
    • fixed bug whereby self.children wasn’t declared
    • made doStore set the self.value as well when storing
    • made it properly store a value on initialization if a message attr
    • couple of bug fixes on string formatting
  • NameFactory
    • Fixed returnRawGeneratedName and returnObjectGeneratedNameDict to allow more than one ignore tag
  • cgm.rigging
    • doParentReturnName – added a simple check to see if the object is already parented to avoid maya reporting it
  • BufferFactory
    • removed the cgmType default labeling on call to let this be used with any transform
  • guiFactory
    • Added frame layout to our standared gui templates
    • doPrint ReportStart – added label option to make it clearer in the script edito
    • returnRawTagInfo – Removed assertion, cleaned up string formatting because I realize now I was an idiot back when
  • cgm.modules
    • createInfoNull-Fixed for unique name on creation of null
  • ObjectFactory
    • Added reference checking and checks on certain functions
  • Modulefactory
    • Initial creation, reworking master class from Limb
    • self repairing initialization
    • added initialization for referenced assets
  • Limb
    • module – Initial creation utilzing the ModuleFactory master class
  • PuppetFactory
    • Reworked setAxis functions to prioritize setting, conflicts will be changed. Priority order is aim,up,out
    • Added add module feature
    • Added ModuleFactory and BufferFactory as callable for certain features
    • Made it work with referenced puppets
Mon, Jul 9th, 2012
posted by jjburton 02:07 PM
Most of the work stemmed from getting back to work on the modular rigger. Afraid it’s gonna be a long slog…:)
  • cgm.NameFactory
    • Made the simple do namer work better. Added a fastIterate option (default is True). Now if sceneUnique is false it doesn’t look in the scene for the name
    • fixed various bugs this introduced
  • Fixed a bunch of broken links stemming from attributes.deleteAttr changing to attributes.doDeleteAttr
  • cgm.controlBuilder
    • Fixed a problem from a function call change
  • cgm.PuppetFactory
    • Started the rigger, currently this is what it’s going to be called
    • Moved the size template maker to this class
    • Set up the class as self repairing for structure
  • cgm.Thingamarig
    • Started the tool, still VERY early. This week…
      • Puppet creation
      • Geo assignment
      • Axis picking
      • name changing
      • size template creation
  • cgm.AttrFactory
    • Added enum command on initialization call
    • Added initialValue keyword for a value ONLY set on creation
  • cgm.attributes
    • Doc fixes, and some bug fixes
    • + addPickAxisAttr(obj,name) – easy axis picker attribute
Mon, Jul 2nd, 2012
posted by jjburton 09:07 AM


  • cgm.locinator
    • Made update reselect initial selection on a buffer mode update
  • cgm.snapMM
    • Added buffer tools
    • Added attrTool launcher
  • cgm.animTools
    • Added buffer tools to it
    • Made update reselect initial selection on a buffer mode update
  • cgm.attrTools
    • Made it try to load selection on call
    • Added softMin/Max options
    • Added right click menu on connection report to select them
  • cgm.AttrFactory
    • doCopyTo – used to copy values and connections between attributes
    • doDuplicateTo – used to duplicate an attribute from one object to another
    • doTransferTo – used for actually moving an attribute from one object to another
    • added soft mins and maxes and parent/children/siblings storage
    • Added soft max,min storage
    • Added storing of family info – parent,children, siblings
    • Added some better settings copying over
    • Added children command pass through commands to (doKeyable,doLocked,doHidden,set)
  • cgm.attributes
    • Had to do a bit of migration after discovering that copyAttr doesn’t work on objects without transforms
    • doBreakConnection
      • Modified to deither take (obj,attr) or (obj.attr) format
      • Updated to be able to correctly find parent connections (ie. translateX connected via translate)
    • returnObjAttrSplit – simple attr splitter since it’s a pretty common task
    • returnDriven/DriverAttribute commands to correctly find parent connections
    • returnAttrFamilyDict(obj,attr) = returns parent, children, sibling attributes in a dict format or false
    • doAddAttr(obj,attrName,attrType,*a, **kw) – generalized attr creation call
    • validateRequestedAttrType(attrType) – verifies an attr type call against an attrType Dict
    • returnStandardAttrFlags(obj,attr) – returns a dict of ‘keyable’,’locked’,’hidden’ states of an attribute
    •  returnMatchNameAttrsDict(obj,target,[attrs]) looks for name matches between attributes regardless of alias
    • returnNumericAttrSettingsDict
    • returnCompatibleAttrs(sourceObj,sourceAttr,target) –
    • validateAttrTypeMatch – simple match return to see if attribute type matches
    •  returnObjectsAttributeByTypeDict(obj,types=[]) – returns dict of attributes by type key
    •  doCopyAttr –
      • toObject(string) – obj to copy to
      • toAttr(string) — name of the attr to copy to . Default is None which will create an  attribute of the fromAttr name on the toObject if it doesn’t exist
      • values(bool) — copy values. default True
      • incomingConnections(bool) — default False
      • outGoingConnections(bool) — default False
      • keepSourceConnections(bool)– keeps connections on source. default True
      • copyAttrSettings(bool) — copy the attribute state of the fromAttr (keyable,lock,hidden). default True
      • connectSourceToTarget(bool) useful for moving attribute controls to another object. default False