Samples/Properties/PropertyViewManager.py

# Copyright 2012 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:
# Shows how to create new Property View
#
# Topic: FBPropertyViewManager
#
from pyfbsdk import *

# This function finds property in pOwner property list and add it under given pHierarchy in pViewList
# pSetOpen will open whole hierarchy
def AddPropertyToViewList(pOwner, pPropertyName, pViewList, pHierarchy, pSetOpen=False):
    lProperty = pOwner.PropertyList.Find(pPropertyName)
    lView = pViewList.AddPropertyView(lProperty, pHierarchy)
    
    if pSetOpen:
        lView.SetOpen(pSetOpen,True)
    
    return lView

#################################

# Create new object for which we will create local(by object) property view
lModel = FBModelNull('ObjectWithLocalPropertyView')
    
# Make model visible in the viewer
lModel.Show = True
    
# Get property view manager
lMgr = FBPropertyViewManager()
    
# Create local(by object) property view called 'PythonCreatedView'
lViewList = lMgr.CreatePropertyList(lModel, FBPropertyViewType.kFBViewByObject, 'PythonCreatedView')
# Add 'Show' property under 'Visibility Options' node
AddPropertyToViewList(lModel, 'Show', lViewList, 'Visibility Options')
# Add 'Visibility' property under 'Visibility Options' node
AddPropertyToViewList(lModel, 'Visibility', lViewList, 'Visibility Options')
# Here we add 'Visibility Inheritance' under 'Visibility' which is under 'Visibility Options' node
AddPropertyToViewList(lModel, 'Visibility Inheritance', lViewList, 'Visibility Options.Visibility', True)
    
# Same this as above, adding properties under 'Transformation Options'
AddPropertyToViewList(lModel, 'Translation (Lcl)', lViewList, 'Transformation Options')
AddPropertyToViewList(lModel, 'Rotation (Lcl)', lViewList, 'Transformation Options')
AddPropertyToViewList(lModel, 'Scaling (Lcl)', lViewList, 'Transformation Options')
AddPropertyToViewList(lModel, 'Quaternion Rotation', lViewList, 'Transformation Options')
    
# Select model to see our new property view in Properties tool
lModel.Selected = True
    
# In this case we don't have to refresh, but if you update already existing View, you should do it.
lMgr.RefreshPropertyViews()