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.
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.
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.
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);