Python Reference Guide
 
Loading...
Searching...
No Matches
Samples\Properties\PropertyViewManager.py
1# Copyright 2012 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# Shows how to create new Property View
8#
9# Topic: FBPropertyViewManager
10#
11from pyfbsdk import *
12
13# This function finds property in pOwner property list and add it under given pHierarchy in pViewList
14# pSetOpen will open whole hierarchy
15def AddPropertyToViewList(pOwner, pPropertyName, pViewList, pHierarchy, pSetOpen=False):
16 lProperty = pOwner.PropertyList.Find(pPropertyName)
17 lView = pViewList.AddPropertyView(lProperty, pHierarchy)
18
19 if pSetOpen:
20 lView.SetOpen(pSetOpen,True)
21
22 return lView
23
24
25
26# Create new object for which we will create local(by object) property view
27lModel = FBModelNull('ObjectWithLocalPropertyView')
28
29# Make model visible in the viewer
30lModel.Show = True
31
32# Get property view manager
34
35# Create local(by object) property view called 'PythonCreatedView'
36lViewList = lMgr.CreatePropertyList(lModel, FBPropertyViewType.kFBViewByObject, 'PythonCreatedView')
37# Add 'Show' property under 'Visibility Options' node
38AddPropertyToViewList(lModel, 'Show', lViewList, 'Visibility Options')
39# Add 'Visibility' property under 'Visibility Options' node
40AddPropertyToViewList(lModel, 'Visibility', lViewList, 'Visibility Options')
41# Here we add 'Visibility Inheritance' under 'Visibility' which is under 'Visibility Options' node
42AddPropertyToViewList(lModel, 'Visibility Inheritance', lViewList, 'Visibility Options.Visibility', True)
43
44# Same this as above, adding properties under 'Transformation Options'
45AddPropertyToViewList(lModel, 'Translation (Lcl)', lViewList, 'Transformation Options')
46AddPropertyToViewList(lModel, 'Rotation (Lcl)', lViewList, 'Transformation Options')
47AddPropertyToViewList(lModel, 'Scaling (Lcl)', lViewList, 'Transformation Options')
48AddPropertyToViewList(lModel, 'Quaternion Rotation', lViewList, 'Transformation Options')
49
50# Select model to see our new property view in Properties tool
51lModel.Selected = True
52
53# In this case we don't have to refresh, but if you update already existing View, you should do it.
54lMgr.RefreshPropertyViews()
Null object class.
Definition: pyfbsdk_generated.h:11489
FBProperty View Manager.
Definition: pyfbsdk_generated.h:15816