Python Reference Guide
 
Loading...
Searching...
No Matches
Tasks\CreateCharacterExtensionOnSelectedObject.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# Topic: FBCharacterExtension
7#
8
9from pyfbsdk import FBApplication, FBModelList, FBGetSelectedModels, FBCharacterExtension
10
11# Create an empty FBModelList object.
12lModels = FBModelList()
13
14# Obtain the list of selected models.
15FBGetSelectedModels( lModels )
16
17lModelCount = len(lModels)
18if (lModelCount > 0):
19 # Create an Empty FBCharacterExtension Object
20 lCharacterExtension = FBCharacterExtension("Character Extension")
21
22 # Add Object and TR Properties To Character Extension
23 for lModel in lModels:
24 lCharacterExtension.AddObjectDependency(lModel)
25
26 # Add to current character
27 currentChar = FBApplication().CurrentCharacter
28 if currentChar != None:
29 currentChar.AddCharacterExtension(lCharacterExtension)
30
31 # For Cleanup.
32 del( lModel )
33
34 # If Cleanup.
35 del ( lCharacterExtension )
36
37# Cleanup of local objects.
38del( lModels, lModelCount )
39
40# Cleanup of imported modules.
41del( FBApplication, FBModelList, FBGetSelectedModels, FBCharacterExtension )
FBApplication is used mainly to manage files.
Definition: pyfbsdk_generated.h:801
Objects Grouping class.
Definition: pyfbsdk_generated.h:3506
FBGetSelectedModels(FBModelList pList, FBModel pParent=None, bool pSelected=True, bool pSortBySelectOrder=False)
Find all models that are selected (if pSelected is true) Searches recursively from a root model for m...