# Copyright 2009 Autodesk, Inc.  All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement 
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
# Script description:
# Create a tool which shows the FBArrowButton and how to show/hide content
#
# Topic: FBBrowsingProperty
#

from pyfbsdk import *
from pyfbsdk_additions import *


def PopulateLayout(mainLyt):
    # dummy label to show the layout moves
    x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
    y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
    w = FBAddRegionParam(0,FBAttachType.kFBAttachRight,"")
    h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")


    cube = FBModelCube("mycube")
    mainLyt.propertyBrowser = FBBrowsingProperty()
    mainLyt.propertyBrowser.AddObject(cube)

    mainLyt.AddRegion("main","main", x, y, w, h)
    mainLyt.SetControl("main", mainLyt.propertyBrowser)

def CreateTool():
    # Tool creation will serve as the hub for all other controls
    t = CreateUniqueTool("Browsing Property Example")
    PopulateLayout(t)
    ShowTool(t)
    return t

tool = CreateTool()

print "Nb of object in Property browser", tool.propertyBrowser.ObjectGetCount()
print "What object at index 0?", tool.propertyBrowser.ObjectGet(0)