FBX Objects
 
 
 

FBX Object Creation and Destruction

An FBX object is an instance of KFbxObject, or any other class derived from KFbxObject. An instance of an object is created by invoking its class' Create() function, along with a reference to the application's KFbxSdkManager singleton, or a reference to a KFbxScene object.

An object can be explicitly destroyed by invoking its Destroy() member function, or by invoking Destroy() on the KFbxSdkManager or KFbxScene object used to create it. The KFbxSdkManager used to instantiate a KFbxObject can be retrieved by calling KFbxObject::GetFbxSdkManager(). Observe that in the following code sample, KFbxImporter inherits from KFbxIO, which inherits from KFbxObject.

// Assume pImporter is an instance of KFbxImporter.
KFbxSdkManager* lSdkManager = pImporter->GetFbxSdkManager();

For more information on object creation and destruction, see Managing memory with the FBX SDK manager.

Properties

The FBX SDK uses the KFbxProperty class to enforce strongly typed, static and/or dynamic associations of properties to instances of KFbxObject. The FBX SDK property model is described in the next topic, FBX Properties.

Collections

Container classes such as KFbxAnimLayer, KFbxAnimStack, and KFbxScene inherit from the KFbxCollection class. This class provides an interface to:

The KFbxCollection::GetMemberCount() and KFbxCollection::GetMember() functions are overloaded to accept a KFbxCriteria. Consult the KFbxCriteria class reference page for more information.

NoteThe Connections topic provides more information on how to navigate between objects and property hierarchies.

Copying an FBX Object

An FBX object may be copied by calling its Copy() member function. The assignment operator (operator=) cannot be used to copy FBX objects; it is a private member function. The following code sample illustrates how to copy a mesh object.

// Assume that lScene is a pointer to a valid scene object.
KFbxMesh* lSourceMesh = KFbxMesh::Create (lScene, "");
 
// Define control points, etc. for lSourceMesh.
 
// This mesh will be overwritten
KFbxMesh* lTargetMesh = KFbxMesh::Create (lScene, "");
 
// Copy the data from lSourceMesh into lTargetMesh. Note that
// the source object and the target object must be instances of
// the same class (KFbxMesh in this case).
lTargetMesh->Copy(lSourceMesh);

NoteCopying a KFbxObject will also copy all of its associated KFbxProperty instances, and their values.
NoteCopying a KFbxObject does not copy any of its inter-object connections (for example, parent-child relationships). These connections must be set explicitly on the copy. For more information, see Connections.
NoteThe Clone() member function is under review - we recommend that you do not use it. Its behavior should nonetheless remain consistent with previous versions of the FBX SDK.