Samples/Utilities/SetPropertyStaticIfPossibleOption.py

Samples/Utilities/SetPropertyStaticIfPossibleOption.py
1 # Copyright 2011 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 # This script demonstrate the usage of SetPropertyStaticIfPossible flag of FBFbxOptions, Set
7 # SetPropertyStaticIfPossible to False if want to keep properties' animated flag even when they
8 # are not really animated(no keyframe data) while retrieving/storing.
9 #
10 # Topic: FBFbxOptions.SetPropertyStaticIfPossible
11 #
12 from pyfbsdk import FBApplication, FBFilePopup, FBFilePopupStyle, FBFbxOptions
13 import os
14 
15 lApp = FBApplication()
16 lApp.FileNew()
17 
18 # File Popup to select file to load
19 lFp = FBFilePopup()
20 lFp.Caption = "Select the fbx file:"
21 lFp.Style = FBFilePopupStyle.kFBFilePopupOpen
22 lFp.Filter = "*.fbx"
23 
24 # File load options
25 lOptions = FBFbxOptions(True)
26 lOptions.ShowOptionsDialog = True
27 
28 # Set False will disable the SetPropertyStaticIfPossible optimization
29 # Then set the retrieved properties with animated flag but without keyframe data to animated
30 # Set True will get these propertise to not animated when retrieved
31 lOptions.SetPropertyStaticIfPossible = False
32 
33 lFbxFilePath = ""
34 if (lFp.Execute()):
35  lFbxFilePath = os.path.join(lFp.Path,lFp.FileName)
36  # Load file using file load options
37  lApp.FileOpen(lFbxFilePath, True,lOptions)
38 
39 
40 # File Save options
41 lOptions = FBFbxOptions(False)
42 lOptions.ShowOptionsDialog = True
43 
44 # Set False will disable the SetPropertyStaticIfPossible optimization
45 # Then set the storing properties with animated flag but without keyframe data to animated
46 # Set True will get these propertise to not animated when storing
47 lOptions.SetPropertyStaticIfPossible = False
48 
49 # Save file using file save options
50 #lApp.FileSave(lFbxFilePath,lOptions)
51 
52 # Cleanup
53 del( lFbxFilePath, lOptions, lFp, lApp )
54 del( FBApplication, FBFilePopup, FBFilePopupStyle, FBFbxOptions )