Loading all or part of an import file
 
 
 

You can import into an FBX scene all or only some of the data types that are stored in an import file. For example, you can choose whether or not to import the cameras, lights, animation, etc. These choices are called import options.

Import options (as well as export options) are managed by your SDK manager, and stored in an IO settings object:

// Create an IOSettings object.
// Let’s assume that mySDKManager has already been created.
KFbxIOSettings * ios = KFbxIOSettings::Create(mySdkManager, IOSROOT );
mySdkManager->SetIOSettings(ios); // Store IO settings here

The following code snippet sets some import options:

// Import options determine what kind of data is to be imported.
// True is the default, but here we’ll set some to true explicitly, and others to false.
(*(pSdkManager->GetIOSettings())).SetBoolProp(IMP_FBX_MATERIAL,        true);
(*(pSdkManager->GetIOSettings())).SetBoolProp(IMP_FBX_TEXTURE,         true);
(*(pSdkManager->GetIOSettings())).SetBoolProp(IMP_FBX_LINK,            false);
(*(pSdkManager->GetIOSettings())).SetBoolProp(IMP_FBX_SHAPE,           false);
(*(pSdkManager->GetIOSettings())).SetBoolProp(IMP_FBX_GOBO,            false);
(*(pSdkManager->GetIOSettings())).SetBoolProp(IMP_FBX_ANIMATION,       true);
(*(pSdkManager->GetIOSettings())).SetBoolProp(IMP_FBX_GLOBAL_SETTINGS, true);

Here is the call to import a file into our scene::

lStatus = myImporter->Import(myScene);

The importer reads the import file, extracts the scene data (as specified by the import options) from the file, and loads it into the FBX scene (which may or may not be previously empty). In other words, the FBX scene graph is populated with data extracted from the import file.

If the import file is not an FBX file, the importer does the necessary conversions to load it into an FBX scene.

In the ImportExport sample program, we load a scene from a file, but we do not look at the contents of the scene. For more detail on scenes, nodes, node attributes, etc., see Traversing the Scene Graph, which explains the SceneTreeView sample program.

Notes on import options: