Wed, Sep 21st, 2016
posted by jjburton 11:09 AM

More vids on specific tool pages. See links inline

Sometimes you just gotta ship something.

For a LONG time now, I’ve been struggling to get Morpheus 2 where I wanted it. Having a small window to get something done because of personal stuff, I wanted to get something done. It’s also been way too long since we’ve released a ‘solid’ tool build so wanted to do that here.

I’ll keep this post updated with new builds as they become more stable until the next major release.

  • Build – 09.22.2016
    • Path fixes that may have been causing some folks issues
    • Soft selection evaluation base functions in
    •  math
      • Most math functions now work with soft select evaluation
      • Added Reset to Targets to Base section
      • Added CopyTo to Target Math section
  • Build – 09.21.2016

So, I made a new tool encompassing a chunk of the tech from Morpheus 2’s development into a manner that is more user friendly. An overview of some of the tech added:

  • Versions — Things should be working from Maya 2011 – 2017
    • 2017
      • Worked on resolving a host of issues. From gui hard crashing to zoo.path stuff mentioned in a blog post last month.
  • Help — cgmTools>Help
    • Added Report issue — link to bit bucket report issue form. Please use this to re port issues.
    • Get Builds — link to page to download wip builds
  • cgmMeshTools — cgmTools>rigging>cgm.meshTools.
    •  MeshMath
      • Symmetry evaluation implemented
      • Base to targed functions/selections
      • Lots of math functions for working with mesh targets – normally blendshape work.
    • Ray Casting
      • ClickMesh
        • Added Nurbs Support
        • Added Snap support – Select targets, activate and snap stuff to any geo you have loaded as targets or in the scene. This is something I wanted to do way back when I first started playing with rayCasting and I’m happy to check that box
        • Follicles on nurbs now work
      • Curve Slice — Lathe curves from objects within mesh objects
      • Curve Wrapping — More advanced curve lathing
      • Implemented multi surface casting to most functions
    • Utils
      • Proximity Mesh/Query — Create proximity mesh or selections from one mesh to another
  • Snap Making Menu — cgmTools>Hotkeys>Snap Tools
    • Added the rayCasting snap
  • cgmMeta
    • A lot of the optimization from last month is in the build.
  • Web documentation
    • Check the side bar here to find the new tool sections (meshTools, cgmMMSnap)
  • cgmHotkeyer
    • Back with Maya 2016, zoo’s hotkey setup no longer worked because of Maya changes. We wrote our own and all hotkey setup uses that now.
  • Other stuff – as the last post released build was years ago, there is a HUGE amount of tools and functions implemented.



Be Sociable, Share!
Wed, Sep 7th, 2016
posted by jjburton 11:09 AM

Been struggling on this one. The problem at hand is one of trying to get transformed blendshape targets baked down from one mesh to another. This path happened to be a dead end but hope it is useful for other purposes.

There are times when it is useful to see the difference in two meshes, or add/subtract the difference between two. In general, mesh math (as we’ll call it).

There are a few new calls:

  • cgm.core.lib.geo_Utils
    • meshMath_values — this call does the math portion of mesh math
    • meshMath
  • modes
    • add : (target + source) * multiplier
    • subtract : (target – source) * multiplier
    • multiply : (target * source) * multiplier
    • average: ((target + source) /2 ) * multiplier
    • difference: delta
    • addDiff: target + (delta * multiplier)
    • subtractDiff: target + (delta * multiplier)
    • blend: pretty much blendshape result if you added as a target using multiplier as weight
    • copyTo: resets to target to the source
  • multiplier — Multiplier value to throw in the mix with the other math
  • space — object,world
  • resultMode
    • new: apply new duplicate of target
    • modify: modify the existing target
    • values: just get the values

I’ll be adding this to a gui with other controls down the road.

Be Sociable, Share!
Fri, Sep 2nd, 2016
posted by jjburton 09:09 PM

So I got a message from a user on Thursday saying that cgmToolbox didn’t work in Maya 2017. Got around to installing 2017 and yup – borked. Spent the evening on Thursday identifying this issue and Friday was fix day.

If you don’t care about what was wrong and just want the bottom line — cgmToolbox should be working in 2017 Maya with the new build I’ll be pushing to the repository shortly.

If you do care…

NOTE – If you use use zooToolbox and specifically zooPy.path.Path (or zoo.Path as I’ll call it), this post would behoove you to look at unless you like stumbling down the same rambling trail others have tread.

Been using zoo stuff for well over 5 years now and Hamish(creator of zooTools) is out of the game last I knew so I decided I had best fix the problem as googling the topic got jack squat and my usual sounding boards hadn’t come across it yet.

Initially I thought Autodesk had gone and changed something and blew up my stuff but at the end of the day it turned out to be the fact that the python that 2017 is running updated the python str class. It just so happens that zoo.Path runs that as a subclass and was overloading some built in calls (find and replace specifically). Anyway, there is a walk generator for path stuff that pushing an instance of the zoo.Path into it rather than a ‘native’ string. Part of that (new to 2017) walker calls on ‘replace’ and so breaks because it needs to replace the path separator which zoo.Path specifically avoids in it’s overload.  zoo.Path’s replace is ONLY for replacing tokens between the separators.

Long story short, that raises an error of ‘/’ cannot be indexed because the find call (in zoo.Path) is specifically removing in it’s searching.

Interesting tidbits:

  • With 2017, os.path.sep is now ‘\\’ up till 2017, it’s been ‘\’ at least all the way back to Maya 2011. On windows at least
  • Something changed with the os.walk generator to make it not work as it did before 2017. Maybe it used to str(arg) stuff in the process and now just passes through the string. Whatever the reason, it broke.
  • import sys || sys.version — gives you your python version. If you’re curious 2017’s is 2.7.11

Some code changes

  • zooPy.path.Path — If you have old versions of zoo installed and trying to run stuff in 2017. It’s gonna break on you if it hasn’t already. You can use this or do your own patch:)
    • osPath — call to return a os.path.sep joined version of the path. Path natively works with ‘/’ and the new double ‘//’ messes with stuff
    • _list_filesystem_items — changed the walk creator to use a osPath string to stop the failing
  • Cleaned out a bunch of stuff from __init__ files. — I’d had some built in calls for listing files and getting other info back before I knew the right way to do it or at least a better one.
  • cgmToolbox
    • clean_scriptPaths/clean_pluginPaths — The call that was breaking stuff were my path setup stuff. As such, the env for these guys got a little borked during the troubleshooting. This was a quick attempt at fixing stuff. As an experiment, this may or may not be reworked.
      • Check all paths for valid paths (will add to the env without failing)
      • Removed a bunch of .git stuff that some other scripts I’d used from someone else apparently added.
      • Acts as a report for what’s there if you didn’t know as it reports all good ones
  • core.cgmPy.os_Utils
    • get_lsFromPath — reworked from the __init__ cleanup. Accepts file paths now and just gets the director they’re in for searching

Now I can get back to cgmBlendshape for Morphy 2. Wrote some fun mesh math stuff toward that end earlier in the week as well but that’s a post for another day…:)


Be Sociable, Share!
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:

Here’s meta code. Simpler. Clearer. Much faster to write.

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:)


Be Sociable, Share!
Thu, Jul 21st, 2016
posted by jjburton 02:07 PM

As I was prepping Morpheus Rig for public dev release I found some pretty awful slowdowns in our code base. As I’m also working on an Intro to Meta course for Rigging Dojo, it seemed like a good time to resolve some of those issues.

So that was most of this week.

Before digging in,  a little foundation. Our code base is a meta data system that relies heavily on red9’s MetaClass and caching in order to function. So when I dug into issues I needed to find if they were on our end or optimizations that could happen in red9 itself.

How does one start to analyze where the slow downs are and fixing them? I’m sure there are more intelligent and efficient ways but being mostly a self taught coder I decided to lean on my junior high science lesson of using the scientific method – namely devising questions and seeking to answer them with simple direct tests. So to start I came up with some questions I wanted to answer.


  • Does scene size have an effect on certain calls?
  • Does cache size have an effect?
  • Are there things that when iterated on increase the speed at which the next exact same call happen?
  • Are there ways to make failed metaclass nodes fail sooner, with fewer errors and clearer ones to boot?


  • Unit tests in our code base made speed checking and function breaking much easier than not having that
  • Simple setup for iteration tests where I could easily change what was being called and then being able to check speed differentials between functions based on a given scene size of objects or iterating new objects every round

Here’s a sample test call (warning – it’s a bit messy):

Here’s the output…

Issues and Solutions

  • General
    • It doesn’t appear to be the iterating itself that is causing the slowdown but some other process
    • Reloading meta resets the slowdown to base (after the file new/open fix)
  •  cgm
    • cgmNode was much slower than a MetaClass node
      • Short version – I had a list.extend() when I should have had a if a not in list:list.append()
      • Long Version – Tracked down an issue where everytime cgmNode was called ( a lot), it was micrscopically increasing the speed of the next call. On a subclass to r9Meta.MetaClass I was extending the UNMANAGED class list with some attributes on my root subclass’s __init__ doing so was adding duplicate attributes to that list any time my subclass was substantiated after initial reload of Meta. That fact caused some of the subfunctions to add that number of steps everytime they called. So long story short, every time my subclass substantiated after a meta reload it got minisculely slower. However, when that call happens tens/hundreds of thousands of times, it added up.
      • Also was curious if having properties or too many functions would cause a slow down in substantiation speeds and the answer is, not really.
      • I was was also concerned that use of a function class I’d been experimenting with was causing slow down and I didn’t come to a full answer on this one yet.
      • autofill flag – There is a flag in MetaClass for autofilling attrs for auto completion to work. Turns out it’s a pretty big hit. Changed our autofill to off and it’s considerably faster than MetaClass.
        • 1000 joint test – red9.MetaClass(autofilldefault) – 2.0699s | cgmNode – .8944s  | validateObjArg – 1.5777s
        • 1000 joint test – red9.MetaClass(autofill – False) – 1.s | cgmNode – .8944s | validateObjArg – 1.5777s
    • validateObjArg was dog slow
      • Completely rewrote this
      • Decided to go at it a different way and found some nice savings
      • for meta node conversion  — Post rewrite – 1000 node conversion test – red9 – 238.129s | cgm – 8.965s
  • red9
    • Reloading red9 introduced an appended file new/open check everytime. This a growing list of errors in the script editor and increased file new/open times.
      • Code change suggested to red9
    • 3 issues in one – 1) A single meta node that had been deleted generated up to 6 errors on an empty scene. This of course grows the bigger the scene is. and 2)error messages were non specific in nature providing no insight to what errors were happening . 3) a corrupted node can made the cache break when called
      • Proposed two additional MetaClass attrs to store _LastDagPath and _lastUUID – these are displayed when a node fails to know what failed
      • Proposed allowing failed nodes to attempt to auto remove themselves from the cache when they fail
      • Proposed some changes that immediately raise an exception rather than keeping processing to get to a failed node state as quickly as possible
    • convertMClassType gets slower the denser the scene
      • rewrote cgmMeta.valiateObjArg. Will talk to Mark on this one.
    • Hierarchical depth has a direct influence on substantiation speeds
      • Created test where for each iteration a new joint is created and parented to the last so at the end you have a 1000 joint chain
      • Base results- red9.MetaClass – start :.001s | end: .018s | total: 8.837s
      • Oddly enough, if you pass shortNames of the children joints on call instead of the .mNode strings (long name), it cuts the end per time from .018 to .010 for a total of 5.571s
      • Talking to Mark on this one.

Why should you care?

The end result of this pass is that a crazy 5 hour rig build anomaly for Morpheus was parred down to 40 minutes after the cgmNode fixes and 31 minutes after the cgmValidateObjArg rewrite. This is in 2011. Never versions of maya are more efficient and it will get better still as we more through optimizing more.

Note, none my optimizations are in red9’s core yet. Mark is on vacation and most of those fixes wouldn’t help anyone but a coder.





Be Sociable, Share!
Wed, May 4th, 2016
posted by jjburton 09:05 PM

To anyone who’s worked with coding blendshape stuff it can be tedious especially when you bring in inbetweens.  Thankfully, Autodesk is fixing a lot of that with 2016 extension 2 if you missed that update but there are still folks using older versions and it doesn’t resolve everything. We have to deal with them a good bit on Morpheus 2 and so we wrote a metaclass to deal with them.

Initial features of the cgmBlendshape metaclass that you can’t easily do with normal api or mc/cmd calls:

  • Most functions work off of index/weight or shape/selection format
  • Easy alias naming
  • Replacing shapes — change out shapes in place keeping inbetweens and connections intact
  • Extract shapes — extract shapes from index/weight calls and supporting multipliers to the delta difference
  • Shape restoration — replace deleted shapes on the fly. Recreate a shape from delta and base information and plug it back in for further editing
  • Subclass to cgmNode to all those functions carry over as well
  • Tested in 2011 and 2016
  • NOTE – this is  wip metaclass and will undergo lots of changes

Before we get into the the specifics of the metaclass, here’s some general lessons learned on blendshapes working through this.

  • A blendshape target has several bits of important information
    • Index — this is it’s index in the blendshape node. Note – not necessarily sequential.
    • Weight — this is the value at which this shape is ‘on’. Usually it is 1.0. Inbetween shapes are between 0 and 1.0.
    • Shape — this is the shape that drives the blendshape channel
    • Dag — the dag node for the shape
    • Alias — the attribute corresponding to its index in the weight list. Typically it is the name of the dag node.
    • Plug — the actual raw attribute of the shape on the node. ‘BSNODE.w[index]’
    • Weight Index — follows a maya formula of index = wt * 1000 + 5000. So a 1.0 weight is a weight index of 6000.
  • The way maya stores info
    • Blendshape data is stored in these arrays in real time so that if you query the data and your base mesh isn’t zeroed out, the transformation happening is baked into that
    • The caveat to that is that targets that have their base geo deleted are ‘locked’ in to their respective data channels at the point they were when deleted. Their delta information is frozen.
    • BlendshapeNode.inputTarget[0].inputTargetGroup[index].inputTargetItem[weightIndex]
      • inputTarget — this is most often 0.
      • inputTargetGroup — information for a particular shape index
      • inputTargetItem — information for a particular weight index
    • Sub items at that index
      • inputPointsTarget — the is the differential data of the point positions being transformed by a given shape target. It is indexed to the inputComponentsTarget array
      • inputComponentsTarget — these are the compents that are being affected by a given shape
      • inputGeomTarget — this is the geo affecting a particular target shape
  • Replacing blendshapes – you can 1) use a copy geo function if the point count is exact to change the shape to what you want or 2) make a function to do it yourself. There’s not a great way to replace a shape except to rebuild that whole index or the node itself. We made a function to do that
  • Once a blendshape node is created with targets, the individual targets are no longer needed and just take up space. Especially when you have the easy ability to extract shapes.
  • Getting a base for calculating delta information. As the blendshapes are stored as delta off of the base, the best way I could find to get that delta was to turn off all the deformers on the base object, query that and then return on/connect the envelopes. I’m sure there’s more elegant solutions but I was unsuccessful in finding one.
    • Once you have that creating a new mesh from a an existing one is as simple as:
      • Taking base data
      • For components that are affected on a given index/weight: add the delta to base
      • duplicating the base and xform(t=vPos, absolute = True) each of the verts will give you a duplicate shape
  • Aliasing weight attributes – mc.aliasAttr(‘NEWNAME’, ‘BSNODE.w[index]’)

Here’s a dummy file I used for testing:

Here’s some code to play with the first iteration. You’ll need to grab the MorpheusDev branch on bitbucket if you wanna play with it till I push it to the main branch.

Be Sociable, Share!
Fri, Apr 22nd, 2016
posted by jjburton 12:04 PM



So, finally wrapped up my work for Morpheus 2 in regards to the wrap setups. As you can see from the last two trips on the rabbit trail(Step 1, Step 2), this wasn’t exactly a simple process.

The point of all of this is to be able to bake blendshapes reliably to nonconforming geo while affecting only the regions we want without having to go in and tweak things by hand. This will prove more and more useful as customization option expand. Why bother with this? Wrap deformers are exceedingly slow. Being able to replace them with skinning data and copying blendshapes between meshes will make your animations play faster and feel more interactive. The final solution was to create proximity geo which is localized to the area I want to affect the nonconforming target mesh. The proximesh is wrapped to the base driver and the target is wrapped to the proximesh.

target –[wraps to]—>> proximesh –[wraps to]–>> base

Here’s a general breakdown of the baking function:

  1. Given a source mesh that has the blendshapes and a nonconforming target mesh we want them on…
  2. Go through all blendshape channels on the source mesh and…
    1. Get their connections/values
    2. Break all connections/zero values so we have clean channels to push our specific shapes to our target mesh
  3. Generate a proximesh of the source with the area we want influencing our nonconforming mesh
  4. Generate a duplicate target mesh so we’re not messing with that mesh
  5. Wrap the proximesh to the source mesh
  6. Wrap the duplicate target mesh to the base mesh
  7. Go through all the blendshape channels on the source mesh and…
    1. Turn a channel on
    2. Duplicate our wrapped target mesh to create a new mesh with the blendshape data on it pushed through by the wrap
    3. If we’re going to cull no change shapes – check each generated shape against the target mesh to figure out when are not moving any verts and delete those offenders
  8. Go through all the original blendshape channels again and rewire them as they were before our function
  9. Delete the wraps and temporary geo
  10. If desired, create a new blendshape node with our final list of baked targets on our nonconforming base mesh
  11. If desired wire the new blendshape node to match the original one we baked from so the channels follow one another.

Easy peasy:)

Functions created while working through it:

  •  cgm.lib.deformers
    • proximityWrapObject — This was the solution in the end to getting rid of movement in the mesh in areas I didn’t want affected.
    • influenceWrapObject — See step one above. Dead end but might prove useful in the future
    • bakeBlendShapeNodesToTargetObject — Greatly expanded this during this little journey
      • Added wrapMethod — influence wrap and proximity wrap and associated flags
      • Added cullNoChangeGeo — removes baked targets that don’t move the base mesh within the given tolerance
  •  cgm.core.lib.geo_Utils
    • is_equivalent — Function comparing points of to pieces of geometry to see if their components match in object space. Useful for culling out empty blendshape targets that have been baked. Supports tolerance in checking as well
    • get_proximityGeo — In depth function for returning geo within range of a source/target object setup. Search by boundingbox and raycasting to find geo within the source. Can return objects,faces,edges,verts or proximity geo which is new geo from the targets that corresponds to the search return

Lessons Learned for wraps in general

  • The maya command call to create a node is mc.CreateWrap (in 2011 at least). I hope later versions made it easier as
  • The object you wrap your target two gets two attributes (dropoff and smoothness) that dicatate how the wrap on your target is affected. No idea why it took me this long in maya to notice that in the docs.
  • Simply using Maya wrapDeformer to wrap an object to another when the object to be wrapped doesn’t conform to the target geo is a bad idea. You’ll get movement in your wrap geo where you don’t want it.

Long story short. The wrap problem is resolved for Morpheus 2.0.

For now. 🙂

Be Sociable, Share!
Wed, Apr 20th, 2016
posted by jjburton 02:04 PM

So the rabbit trail from over the weekend proved to not be the answer to my original problem as hoped. Namely I was still getting geo movement from far off regions when baking blendshapes to non-similar geo (think a sphere placed on a body).

As such, my next plan to resolve this was to create a specific conforming geo piece to wrap to then wrap my nonconforming object to. To do this, I need a way to  find the geo closest to my geo I wanted to transfer the blendshapes too and so wrote a new function for this that would:

  • Search target geo against a source geo piece to find geo from each target within the source by two methods:
    • boundingBox.contains – by vert
    • rayCasting  – by the compass vectors to make sure it is completely within the sourceObject
  • Translate that data to verts,edges, faces
  • Have a method to expand that data:
    • selection traversing
    • softSelection radius

Lessons learned:

  • bounding box checking is much much faster so use that mode unless you just have to have a more precise idea of what verts are inside the mesh.
  • Not a lot of specific info I could find on some of these concepts and so wanted to share to save someone else time and deadends

Here’s part one of this issue which is housed at cgm.core.lib.geo_Utils.get_contained. There are too many dependencies to include them all but you can get this gist from the code.

Up next is setting up a new wrap setup with this data. Will post when that’s done.


Be Sociable, Share!
Sun, Apr 17th, 2016
posted by jjburton 07:04 PM

On yet another rabbit trail of problem solving on Morpheus 2.0, I came across an issue where wrap deformers weren’t working as needed. Namely transferring blendshapes from one mesh to another when the shape of the target mesh wasn’t like the original. Even geo changes in regions no where near the ‘to bake’ geo were affecting it.

So did some googling and came across a concept I’d not used before – namely using a mesh to deform another with a skinCluster.

Neat, so how do we do it?

  1. Get your target and source mesh ready
  2. Create a joint and skinCluster your target mesh to it
  3. Add the driving mesh to the skinCluster with the useGeometry flag ( sample code for this line below).
    1. polySmoothness flag. This controls the smoothness of the mesh deformation of the target mesh.
    2. A polySmoothness of 0 is the closest to a standard wrap deformer
    3. In my initial testing I found that this flag could only be set consistently on creation. Editing the flag could push the smoothness up but not down (in 2011 at least).
  4. Make sure the useComponents attribute on the skinCluster is set to True. If you don’t see the deformation doing anything this is the likely culprit.

I wrote a script to set this up but it’s still wip. It’s a function found here: cgm.lib.deformers.influenceWrapObject. Because of the issue noted in step 3.2, I added the polySmoothness as a creation flag.

This method of wrapping is much more localized than wrap deformers when the mesh isn’t close AND provides an easy way to paint weights for the deformation.


Be Sociable, Share!
Thu, Apr 14th, 2016
posted by jjburton 08:04 AM

This post is to remind us how to do this. J had a computer issue and had to reinstall Windows:)

  1. Follow this tutorial –
  2. Make some coffee, you earned it.

If you get the “server’s host key is not cached…” error when attempting to push from SourceTree:

  1. Command prompt
  2. Go to Program Files (x86)/PuTTY
  3. “plink -agent”
  4. Hit ‘y’


Be Sociable, Share!