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 calledimport options, and we need to create an object to hold them:

 KFbxStreamOptionsFbxReader* lImportOptions=
 KFbxStreamOptionsFbxReader::Create(pSdkManager, "");

To keep ImportExport simple, we don’t let the user change the import options. Instead, we simply set them totrue, which is in any case the default value:

 lImportOptions->SetOption(KFBXSTREAMOPT_FBX_MATERIAL, true);
 lImportOptions->SetOption(KFBXSTREAMOPT_FBX_TEXTURE, true);
 lImportOptions->SetOption(KFBXSTREAMOPT_FBX_LINK, true);
 lImportOptions->SetOption(KFBXSTREAMOPT_FBX_SHAPE, true);
 lImportOptions->SetOption(KFBXSTREAMOPT_FBX_GOBO, true);
 lImportOptions->SetOption(KFBXSTREAMOPT_FBX_ANIMATION, true);
 lImportOptions->SetOption(KFBXSTREAMOPT_FBX_GLOBAL_SETTINGS, true);

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 (previously empty) scene. 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 never really look at the contents of the scene. For more detail on scenes, nodes, node attributes, etc., seeTutorial 2: Traversing the scene graph, which explains the SceneTreeView sample program.