from pyfbsdk import *
def findAnimationNode( pName, pNode ):
lResult = None
lName = pName.split( '/' )
for lNode in pNode.Nodes:
if lNode.Name == lName[0]:
if len( lName ) > 1:
lResult = findAnimationNode( pName.replace( '%s/' % lName[0], '' ), lNode )
else:
lResult = lNode
return lResult
def copyAnimation(pSrc, pDst ):
for pName in [ 'Lcl Translation/X','Lcl Translation/Y','Lcl Translation/Z', 'Lcl Rotation/X','Lcl Rotation/Y','Lcl Rotation/Z']:
lSrcNode = findAnimationNode( pName, pSrc.AnimationNode )
lDstNode = findAnimationNode( pName, pDst.AnimationNode )
if lSrcNode and lSrcNode.FCurve and lDstNode:
lDstNode.FCurve.KeyReplaceBy(lSrcNode.FCurve)
lSrc = FBFindModelByName( 'SRC' )
lDst = FBFindModelByName( 'DST' )
if lSrc and lDst:
copyAnimation(lSrc, lDst)