Loading the import file into the scene
 
 
 

You can import all or part of the scene. For example, you can choose whether or not to import the cameras, lights, animation, etc. These are called import options

Import options are stored in a file (see class KFbxIOSettings and header file kfbxiosettingspath.h). Import options apply to all imported files unless explicitly changed.

This sample program does not provide the user with a UI to change the import options. Instead, we simply set all the import options to true, which is in any case the default value.

        // Import options determine what kind of data is to be imported.
        // The default is true, but here we set the options explictly.
        IOSREF.SetBoolProp(IMP_FBX_MATERIAL,        true);
        IOSREF.SetBoolProp(IMP_FBX_TEXTURE,         true);
        IOSREF.SetBoolProp(IMP_FBX_LINK,            true);
        IOSREF.SetBoolProp(IMP_FBX_SHAPE,           true);
        IOSREF.SetBoolProp(IMP_FBX_GOBO,            true);
        IOSREF.SetBoolProp(IMP_FBX_ANIMATION,       true);
        IOSREF.SetBoolProp(IMP_FBX_GLOBAL_SETTINGS, true);
    }

IOSREF is a convenience macro:

#define IOSREF  KFbxIOSettings::IOSettingsRef()

Finally we import the scene:

   lStatus = lImporter->Import(*pScene, lImportOptions);

The importer reads the import file, extracts the nodes and other scene data (animation curves, textures, materials, etc.) from the file, and loads it into the FBX scene (which until now was empty). 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 Tutorial 2: Traversing the Scene Graph, which explains the SceneTreeView sample program.