Recover animation from broken proxy managers


Sometimes the proxy managers in a scene will break and all the proxies will be spread out instead of being linked to a single reference.

Usually it’s better to go back to the last version of the scene since there is not a lot of changes between versions, but for this one, the last clean version was older than a week

Yes, one week. The scene was broken for more than a week, but the animator couldn’t see it because he never reopened its scene during that time. The status of Maya/the scene was unstable while the artist was working on it, and each time he saved, it was saved in that unstable state… thus why we couldn’t recover any version less than a week old.

So here I am with no proxy managers, no animation and a week of work vanished.

I first did a diff between the two files, and transferred every information about the proxy manager and the references that were missing in the broken file. It worked… sort of, I managed to get back the full animation of one of the three characters, and a partial animation for a second one. Secondly I though about doing a script that could reconnect all the anim curves to the original nodes just by using their names… but it used a slightly different solution:

# Select all anim curves then export only the nodes, no inputs
cmds.select(cmds.ls(type="animCurve"))
cmds.ls(sl=True)

# Reference the .ma done just before with the FOOBAR namespace, key every controller then...
newCurves = cmds.referenceQuery('FOOBARRN', nodes=True)
for i in newCurves:
    oldCurve = i.replace("FOOBAR:", "")
    if cmds.objExists(oldCurve):
        cmds.copyKey(i)
        cmds.pasteKey(oldCurve, option='replaceCompletely')[/python]

And…. TA-DAAAAAAAAAAAH!!!

Pro-tips: Close Maya at least once a day, save often, version your work!