UI/FCurveEditor.py

UI/FCurveEditor.py
1 # Copyright 2009 Autodesk, Inc. All rights reserved.
2 # Use of this software is subject to the terms of the Autodesk license agreement
3 # provided at the time of installation or download, or which otherwise accompanies
4 # this software in either electronic or hard copy form.
5 #
6 # Script description:
7 # Create a tool with a FCurve editor and shows how to create an interpolator fcurve
8 # and sets its
9 #
10 # Topic: FBAnimationNode, FBFCurve, FBFCurveEditor
11 #
12 
13 from pyfbsdk import *
14 from pyfbsdk_additions import *
15 
16 AnimationNode = None
17 
18 def PopulateLayout(mainLyt):
19  #create Spread
20  Editor = FBFCurveEditor()
21 
22  x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
23  y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
24  w = FBAddRegionParam(0,FBAttachType.kFBAttachRight,"")
25  h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
26 
27  mainLyt.AddRegion("FCurveEditor","FCurveEditor", x, y, w, h)
28 
29  mainLyt.SetControl("FCurveEditor",Editor)
30 
31  AnimationNode = FBAnimationNode("Test")
32  FCurve = FBFCurve().CreateInterpolatorCurve( FBInterpolatorCurveType.kFBInterpolatorCurveSmoothOut )
33  AnimationNode.FCurve = FCurve
34  Editor.AddAnimationNode( AnimationNode )
35  FCurve.FBDelete()
36 
37 def CreateTool():
38  # Tool creation will serve as the hub for all other controls
39  t = FBCreateUniqueTool("FCurve editor sample")
40 
41  t.StartSizeX = 300
42  t.StartSizeY = 300
43 
44  PopulateLayout(t)
45  ShowTool(t)
46 
47 
48 CreateTool()
49 
50