UI/BoxCustomParams.py

UI/BoxCustomParams.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 that shows all custom params possible with a FBVBoxLayout/FBHBoxLayout.
8 #
9 # Topic: FBHBoxLayout, FBVBoxLayout
10 #
11 
12 from pyfbsdk import *
13 from pyfbsdk_additions import *
14 
15 
16 def PopulateLayout(mainLyt):
17  x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
18  y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
19  w = FBAddRegionParam(5,FBAttachType.kFBAttachRight,"")
20  h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
21  mainLyt.AddRegion("main","main", x, y, w, h)
22 
23  lyt = FBHBoxLayout()
24  mainLyt.SetControl("main",lyt)
25 
26  b = FBButton()
27  b.Caption = "But0"
28  # Custom params: height is fixed in a FBHBoxLayout
29  lyt.Add(b,30, height=75)
30 
31  b = FBButton()
32  b.Caption = "But1"
33  # Custom params: space between lastly inserted control
34  lyt.Add(b,30, space=75,height=50)
35 
36  b = FBButton()
37  b.Caption = "But2"
38  lyt.Add(b,30, height=25)
39 
40  vlyt = FBVBoxLayout()
41  # Custom params: space between lastly inserted control
42  lyt.Add(vlyt,150, space=25)
43 
44  b = FBButton()
45 
46  b.Caption = "But3"
47  # Custom params: width is fixed in this FBVBoxLayout
48  vlyt.Add(b,30, width=75)
49 
50  b = FBButton()
51  b.Caption = "But4"
52  vlyt.Add(b,30, space=75,width=50)
53 
54  b = FBButton()
55  b.Caption = "But5"
56  vlyt.Add(b,30, width=25)
57 
58 
59 def CreateTool():
60  # Tool creation will serve as the hub for all other controls
61  t = FBCreateUniqueTool("Box Custom Params Example")
62  t.StartSizeX = 400
63  t.StartSizeY = 400
64 
65  PopulateLayout(t)
66  ShowTool(t)
67 
68 CreateTool()