Python Reference Guide
 
Loading...
Searching...
No Matches
BasicOperations\FBFbxOptions.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# Script description:
7# Shows how to create and modify FBFbxOptions to customize the Load/save process
8#
9# Topic: FBApplication, FBFbxOptions
10#
11
12from pyfbsdk import *
13
14import os.path
15
16SOURCE_SCENE_PATH = "multiple_elements_scene.fbx"
17SAVE_SCENE_PATH = "single_elements_scene.fbx"
18NO_LOAD_UI_DIALOG = False
19OPTION_USED_FOR_LOADING = True
20OPTION_USED_FOR_SAVING = False
21
22app = FBApplication()
23
24def CreateDummyScene():
25 # Create a scene containing different types of elements and save it
26 cube = FBModelCube("cube")
27 character = FBCharacter("character")
28 actor = FBActor("actor")
29 camera = FBCamera("camera")
30
31 app.FileSave(SOURCE_SCENE_PATH)
32 app.FileNew()
33
34
35CreateDummyScene()
36
37# Set a few options to Load a scene
38
39# To init the option for a load/merge: pass True as first param
40options = FBFbxOptions(OPTION_USED_FOR_LOADING)
41
42# Set loading options. Options corresponds to the UI shown in a File -> Open/Merge
43
44# Do not load character
45options.Characters = FBElementAction.kFBElementActionDiscard
46
47# Do not load Camera animation
48options.CameraAnimation = False
49
50# Load the file
51app.FileOpen(SOURCE_SCENE_PATH, NO_LOAD_UI_DIALOG, options)
52
53# Set options to save a scene
54# Initialize options
55options = FBFbxOptions(OPTION_USED_FOR_SAVING)
56
57# Tell that by default we won't save anything
58options.SetAll(FBElementAction.kFBElementActionDiscard, False)
59
60# Except for the actor and its animation
61options.Actors = FBElementAction.kFBElementActionSave
62options.ActorAnimation = True
63
64# Save the scene in ascci format
65options.UseASCIIFormat = True
66
67app.FileSave(SAVE_SCENE_PATH, options)
68
69
FBActor is used to link motion data to a character.
Definition: pyfbsdk_generated.h:56
FBApplication is used mainly to manage files.
Definition: pyfbsdk_generated.h:801
Creates custom cameras and manages system cameras.
Definition: pyfbsdk_generated.h:2530
A character is the link between a motion source and a character model.
Definition: pyfbsdk_generated.h:3085
Customize file loading and saving.
Definition: pyfbsdk_generated.h:7400
Cube model class.
Definition: pyfbsdk_generated.h:11337