Wednesday, July 13, 2011

Lost Animation when loading Referenced Rigs

This is Particularly relevant to referenced Rigs which have characterSets.

So this has come up a few times on the forums and I've also had emails asking how to fix it so thought I'd drop some info up here. The issue is that at some point the referenceEdits that connect Animation Data to a referenced rig can get broken or corrupted. This means you can be animating away all day, saving incrementals as you go, completely unaware that when you load this scene in, all animation will be lost..or so it would seem.

see this post recently:

The issue is usually the referenceEdits themselves. What sometimes happens is that the 'connectAttr' block in the referenceEdits gets blanked. We have no idea why, neither does Autodesk, it's completely random. Its also more common on files that came from 2010 and have been loaded in 2011. It also was an issue with rigs that had characterSets on the early release of 2011 IF you were using AnimLayers. (pre hotfix2)

So what to look for?

If you open up the Reference Editor then go to file>referenceEdits. In there you should get a list of all the edits performed since that file was initially referenced in. It's basically a macro that the file load uses to reconstruct the file. So, take a look in the list, see if you still have a large 'connectAttr' block. These should be the connections from the characterSet (placeholder list) to the anim curves themselves. If these edits get corrupted then as I said, you can spend all day saving incremental saves which are all broken but you wouldn't have been aware of them until you reloaded the scenes and the reference list got re-passed.

Now there are some good things to help you. Firstly the fact that the connections aren't there doesn't mean that there's no link from the anim curves to the reference. What happens is that the curves will be left connected to the references RN reference node. If you graph the referenceNode in the hypershade you should still see the connected anim data. It's what happens when you unload a reference, the anim data is cast back to the referenceNode for safe keeping.

So, graph the data, see if it's there, look at the referenceEdit list, see if it is correct or not. If you have no 'ConnectAttrs' then its the same issues we have.

Fixing it is a different issue. Basically we need to write a little tool which spins through the characterSet plugs, then the animCurves left connected to the RN node, does a nameMatch, then reconnects the data. The following dropped into a Python script Tab should do it, just select the characterSet you want reconnected!

import pymel.core as pm
import maya.cmds as cmds

if not type=='character':
   raise StandardError('You must select a CharacterSet to reconnect')
if not refNode:
   raise StandardError('Given characterSet is not from a referenced file')


for plug in cSetPlugs[::2]:
   for anim in animCurves:
       if anim.split(':')[-1].endswith(plug):
           print '%s >> %s' % (anim,plug)
           pm.connectAttr('%s.output' % anim,'%s.%s' % (cSet,plug),force=True)

Simple but effective fix to get round the bug. I think in light of the amount of people posting things like this I'll follow this up with the Maya dev team again. We get this maybe once a month if that, actually probably less than that now we're all on 2011SAP release.

hope that helps folks. I know, referencing is like a black art, god knows I had enough help 7 or 8 years ago when we first started with referenced pipelines.... so thought I'd share the Bug work around.


Friday, July 8, 2011

MasterClass - FINISHED!

Autodesk MasterClass 'Live Animation Binding':

Damn that took a lot of work, hope its worth it and people actually find it interesting. So hopefully in the next few weeks it'll be up on the Area just before Siggraph, not sure when Autodesk start the advertising push so keep your eyes open for it. Think I deserve a beer now, might even treat myself to a nice bottle of single malt...