Samples/FCurve/CopyAnimation.py
12 def findAnimationNode( pName, pNode ):
14 lName = pName.split(
'/' )
15 for lNode
in pNode.Nodes:
16 if lNode.Name == lName[0]:
18 lResult = findAnimationNode( pName.replace(
'%s/' % lName[0],
'' ), lNode )
24 def copyAnimation(pSrc, pDst ):
25 for pName
in [
'Lcl Translation/X',
'Lcl Translation/Y',
'Lcl Translation/Z',
'Lcl Rotation/X',
'Lcl Rotation/Y',
'Lcl Rotation/Z']:
26 lSrcNode = findAnimationNode( pName, pSrc.AnimationNode )
27 lDstNode = findAnimationNode( pName, pDst.AnimationNode )
29 if lSrcNode
and lSrcNode.FCurve
and lDstNode:
30 lDstNode.FCurve.KeyReplaceBy(lSrcNode.FCurve)
37 lSrc.Translation.SetAnimated(
True)
38 lSrc.Rotation.SetAnimated(
True)
39 lSrc.Scaling.SetAnimated(
True)
41 lDst.Translation.SetAnimated(
True)
42 lDst.Rotation.SetAnimated(
True)
43 lDst.Scaling.SetAnimated(
True)
46 copyAnimation(lSrc, lDst)