FbxPlugin Class Reference
 
 
 
FbxPlugin Class Reference

This reference page is linked to from the following overview topics: Customizing File Formats with FBX SDK I/O Plug-ins, Importing and Exporting a Scene.


#include <fbxplugin.h>


Class Description

The base class to inherit from when creating new plug-ins for the FBX SDK.

Plug-ins for the FBX SDK are extremely flexible allowing a wide-range of possibilities. For example, one can write his own plug-in to add new readers/writers to the current list of supported I/O formats, or add new dynamic classes to instantiate custom objects that can later be stored in FBX files. We also use the same interface for plug-ins written using the FBX Extension SDK, which allow additional callbacks for other various Autodesk products enabling greater interoperability with multiple various SDKs.

Here is typical implementation of an FBX SDK plug-in that doesn't do anything else than just registering itself:

 class MyPlugin : public FbxPlugin
 {
     FBXSDK_PLUGIN_DECLARE(MyPlugin); //This macro is mandatory for any plug-in definition

 protected:
     explicit MyPlugin(const FbxPluginDef& pDefinition, FbxModule pModuleHandle) : FbxPlugin(pDefinition, pModuleHandle)
     {
     }

     //Abstract functions that *must* be implemented
     virtual bool SpecificInitialize()
     {
         //For example, here we could register as many new I/O readers/writers as we would like, or classes, etc.
         return true;
     }

     virtual bool SpecificTerminate()
     {
         //Here we would have to unregister whatever we registered to the FBX SDK
         return true;
     }
 };

 FBXSDK_PLUGIN_IMPLEMENT(MyPlugin); //This macro is mandatory for any plug-in implementation

 //Standard C export needed for any new FBX SDK plug-in
 extern "C"
 {
     static MyPlugin* sMyPluginInstance = NULL; //The module is owner of the plug-in

     //This function will be called when an application will request the plug-in
 #ifdef FBXSDK_ENV_WIN
     __declspec(dllexport) void FBXPluginRegistration(FbxPluginContainer& pContainer, FbxModule pModuleHandle)
 #else
     void FBXPluginRegistration(FbxPluginContainer& pContainer, FbxModule pModuleHandle)
 #endif
     {
         if( sPlugin == NULL )
         {
             //Create the plug-in definition which contains the information about the plug-in
             FbxPluginDef sPluginDef;
             sPluginDef.mName = "My Plugin";
             sPluginDef.mVersion = "1.0";

             //Create an instance of the plug-in
             sMyPluginInstance = MyPlugin::Create(sPluginDef, pLibHandle);

             //Register the plug-in with the FBX SDK
             pContainer.Register(*sPlugin);
         }
     }
 }
See also:
FbxPluginDef, FbxPluginData

Definition at line 148 of file fbxplugin.h.

Inheritance diagram for FbxPlugin:
FbxListener

List of all members.

Public Member Functions

virtual bool  SpecificInitialize ()=0
  Abstract function called once at the end of the plug-in construction.
virtual bool  SpecificTerminate ()=0
  Abstract function called once at the beginning of the plug-in destruction.
virtual void  WriteBegin (FbxScene &pScene)
  Virtual function called once when the FBX SDK is about to write an FBX file.
virtual void  WriteParameters (FbxObject &pParams)
  Virtual function called once when the FBX SDK is about to write plug-in's parameters.
virtual void  WriteEnd (FbxScene &pScene)
  Virtual function called once after the FBX SDK wrote an FBX file.
virtual void  ReadBegin (FbxScene &pScene)
  Virtual function called once when the FBX SDK is about to read an FBX file.
virtual void  ReadParameters (FbxObject &pParams)
  Virtual function called once after the FBX SDK reads the plug-in's parameters.
virtual void  ReadEnd (FbxScene &pScene)
  Virtual function called once after the FBX SDK read an FBX file.
const FbxPluginDef GetDefinition () const
  Accessor to the plug-in definition structure that contains basic information on the plug-in like its name or version.
FbxModule  GetModuleHdl ()
  Retrieve the module address pointer for this plug-in.

Protected Member Functions

  FbxPlugin (const FbxPluginDef &pDefinition, FbxModule pModuleHandle)
  Use the Create() and Destroy() methods declared and implemented in the FBXSDK_PLUGIN_DECLARE and FBXSDK_PLUGIN_IMPLEMENT macros to construct and destroy FbxPlugin objects.
FbxPluginData GetData ()
  Accessor to the plug-in private data.
const FbxPluginData GetData () const
  Const accessor to the plug-in private data.

Constructor & Destructor Documentation

FbxPlugin ( const FbxPluginDef pDefinition,
FbxModule  pModuleHandle 
) [explicit, protected]

Use the Create() and Destroy() methods declared and implemented in the FBXSDK_PLUGIN_DECLARE and FBXSDK_PLUGIN_IMPLEMENT macros to construct and destroy FbxPlugin objects.

Parameters:
pDefinition The definition associated with this plug-in. Each plug-in must have its own definition to differentiate it with other plug-ins.
pModuleHandle A pointer to the plug-in module address.

Member Function Documentation

virtual bool SpecificInitialize ( ) [pure virtual]

Abstract function called once at the end of the plug-in construction.

At that moment, plug-in data have been properly initialized. This function must be implemented by anyone who writes a new plug-in for the FBX SDK.

virtual bool SpecificTerminate ( ) [pure virtual]

Abstract function called once at the beginning of the plug-in destruction.

At that moment, plug-in data is fully available. This function must be implemented by anyone who writes a new plug-in for the FBX SDK.

virtual void WriteBegin ( FbxScene pScene ) [virtual]

Virtual function called once when the FBX SDK is about to write an FBX file.

Users can re-implement it in their plug-in if they need to perform tasks at that moment. The scene provided in parameter can be altered. If not re-implemented, this function does nothing.

Parameters:
pScene The scene that is about to be written in the FBX file.
virtual void WriteParameters ( FbxObject pParams ) [virtual]

Virtual function called once when the FBX SDK is about to write plug-in's parameters.

Users can re-implement it in their plug-in if they need to store properties in the FBX file for their own usage. The object in parameter is used to store those properties. If not re-implemented, this function does nothing.

Parameters:
pParams An abstract object that can be used as a property container, to allow the plug-in to store properties about the plug-in.
virtual void WriteEnd ( FbxScene pScene ) [virtual]

Virtual function called once after the FBX SDK wrote an FBX file.

Users can re-implement it in their plug-in if they need to perform tasks at that moment. The scene provided in parameter can be altered, but the changes will not appear in the FBX file. If not re-implemented, this function does nothing.

Parameters:
pScene The scene that was written in the FBX file.
virtual void ReadBegin ( FbxScene pScene ) [virtual]

Virtual function called once when the FBX SDK is about to read an FBX file.

Users can re-implement it in their plug-in if they need to perform tasks at that moment. The scene provided in parameter can be altered. If not re-implemented, this function does nothing.

Parameters:
pScene The scene that is about to be read in the FBX file.
virtual void ReadParameters ( FbxObject pParams ) [virtual]

Virtual function called once after the FBX SDK reads the plug-in's parameters.

Users can re-implement it in their plug-in if they need to retrieve properties for their own usage. The object in parameter is used to retrieve those properties. If not re-implemented, this function does nothing.

Parameters:
pParams An abstract object that can be used as a property container, to allow the plug-in to read properties about the plug-in.
virtual void ReadEnd ( FbxScene pScene ) [virtual]

Virtual function called once after the FBX SDK read an FBX file.

Users can re-implement it in their plug-in if they need to perform tasks at that moment. The scene provided in parameter can be altered. If not re-implemented, this function does nothing.

Parameters:
pScene The scene that was read in the FBX file.
const FbxPluginDef& GetDefinition ( ) const

Accessor to the plug-in definition structure that contains basic information on the plug-in like its name or version.

This is the only method available to differentiate plug-ins.

Returns:
The definition structure for this plug-in.
FbxModule GetModuleHdl ( )

Retrieve the module address pointer for this plug-in.

With this module instance handle, for example someone can query procedures addresses, allowing more complex interactions, as well as other operating system module specific functions.

FbxPluginData& GetData ( ) [protected]

Accessor to the plug-in private data.

Returns:
The data for the current plug-in.
const FbxPluginData& GetData ( ) const [protected]

Const accessor to the plug-in private data.

Returns:
The const data for the current plug-in.

The documentation for this class was generated from the following file: