1
2
3
4
5
6
7
8
9from pyfbsdk import *
10
11
12def findAnimationNode( pName, pNode ):
13 lResult = None
14 lName = pName.split( '/' )
15 for lNode in pNode.Nodes:
16 if lNode.Name == lName[0]:
17 if len( lName ) > 1:
18 lResult = findAnimationNode( pName.replace( '%s/' % lName[0], '' ), lNode )
19 else:
20 lResult = lNode
21 return lResult
22
23
24def 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 )
28
29 if lSrcNode and lSrcNode.FCurve and lDstNode:
30 lDstNode.FCurve.KeyReplaceBy(lSrcNode.FCurve)
31
34
35
36if lSrc:
37 lSrc.Translation.SetAnimated(True)
38 lSrc.Rotation.SetAnimated(True)
39 lSrc.Scaling.SetAnimated(True)
40if lDst:
41 lDst.Translation.SetAnimated(True)
42 lDst.Rotation.SetAnimated(True)
43 lDst.Scaling.SetAnimated(True)
44
45if lSrc and lDst:
46 copyAnimation(lSrc, lDst)
FBModel FBFindModelByLabelName(str pModelLabelName)
Find a model in the scene by its label name.