There are a few HUGE expectations here, mainly that the scene is clean and that the animCurves are still consistently named against the channel they were keyed against. As I said, this is a hack but it seems to be what a lot of people are in need of.
So the expectation is that an attr on a controller called NameSpace:L_Foot.translateX should be connected to NameSpace:L_Foot_translateX, or L_Foot_translateX depending on the flag stripNamespace thats in the code.
As I said, this is a really quick hack, but I figured what the hell. Oh and if the data went through AnimLayers....sorry, you're stuffed!
Mark
import maya.cmds as cmds nodes=cmds.ls(sl=True,l=True) chns=[] #Change this to False if the curves are not in the rootNamespace but #in the sameNamespace as the controllers. stripNamespace=True #build up the main lists animCurves=cmds.ls(type='animCurve',s=True) [chns.extend(cmds.listAnimatable(node)) for node in nodes] for chn in chns: if stripNamespace: animCurveExpected=chn.split(':')[-1].split('|')[-1].replace('.','_') else: animCurveExpected=chn.split('|')[-1].replace('.','_') if animCurveExpected in animCurves: if not cmds.isConnected('%s.output' % animCurveExpected,chn): print '%s >> %s' % (animCurveExpected,chn) cmds.connectAttr('%s.output' % animCurveExpected,chn,force=True)
Deja vu !
ReplyDeleteOOOOOOOOOWESOME! My animation is back! I changed the stripNamespace to False and that was it! AWESOMEEEEEEEEEEEE!! Thanks so much Mark!
ReplyDeleteI'm curious, what build of Maya are you running? As far as I know this bug has been quashed, we've certainly not had any reports of people round the studio suffering from it and most of the animators are on 2012 now.
ReplyDeleteI’m using 2012 whit no hot fix, is weird because it has happened quite a lot here, I don’t know if the rig is set up in a certain way that makes the bug more likely to happen.
DeleteThis comment has been removed by the author.
ReplyDeleteincredible!
ReplyDeleteThis just saved my shot!! Thanks man.
ReplyDelete2013 and I´m still having this problem, I´m using maya 2012. But how can I prevent this to keep happening, I´m sooo frustrated
ReplyDeleteI guess it all depends on your setup really. The main bug that was causing this has been fixed, are you saving as ma's or mb's?
ReplyDeleteMarkJ I can't thank you enough! You just saved my day!! I had this issue on Maya 2018. Thank you so much!!
ReplyDeleteWow, been a few years since I wrote this stuff, glad it's still coming in useful!
DeleteThis comment has been removed by the author.
DeleteThis comment has been removed by the author.
ReplyDelete