UI/BrowsingProperty.py

UI/BrowsingProperty.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 which shows the FBArrowButton and how to show/hide content
8 #
9 # Topic: FBBrowsingProperty
10 #
11 
12 from pyfbsdk import *
13 from pyfbsdk_additions import *
14 
15 
16 def PopulateLayout(mainLyt):
17  # dummy label to show the layout moves
18  x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
19  y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
20  w = FBAddRegionParam(0,FBAttachType.kFBAttachRight,"")
21  h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
22 
23 
24  cube = FBModelCube("mycube")
25  mainLyt.propertyBrowser = FBBrowsingProperty()
26  mainLyt.propertyBrowser.AddObject(cube)
27 
28  mainLyt.AddRegion("main","main", x, y, w, h)
29  mainLyt.SetControl("main", mainLyt.propertyBrowser)
30 
31 def CreateTool():
32  # Tool creation will serve as the hub for all other controls
33  t = FBCreateUniqueTool("Browsing Property Example")
34  PopulateLayout(t)
35  ShowTool(t)
36  return t
37 
38 tool = CreateTool()
39 
40 print "Nb of object in Property browser", tool.propertyBrowser.ObjectGetCount()
41 print "What object at index 0?", tool.propertyBrowser.ObjectGet(0)