Public Member Functions | Protected Member Functions | Friends

KFbxPlugin Class Reference

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


Search for all occurrences

Detailed 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 KFbxPlugin
 {
     KFBXPLUGIN_DECLARE(MyPlugin); //This macro is mandatory for any plug-in definition

 protected:
     explicit MyPlugin(const KFbxPluginDefinition& pDefinition, kLibHandle pLibHandle) : KFbxPlugin(pDefinition, pLibHandle)
     {
     }

     //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;
     }
 };

 KFBXPLUGIN_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 KARCH_ENV_WIN
     __declspec(dllexport) void FBXPluginRegistration(KFbxPluginContainer& pContainer, kLibHandle pLibHandle)
 #else
     void FBXPluginRegistration(KFbxPluginContainer& pContainer, kLibHandle pLibHandle)
 #endif
     {
         if( sPlugin == NULL )
         {
             //Create the plug-in definition which contains the information about the plug-in
             KFbxPluginDefinition 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:
KFbxPluginDefinition, KFbxPluginData

Definition at line 178 of file kfbxplugin.h.

#include <kfbxplugin.h>

Inheritance diagram for KFbxPlugin:
Inheritance graph
[legend]

List of all members.

Public Member Functions

const KFbxPluginDefinition GetDefinition () const
  Accessor to the plug-in definition structure that contains basic information on the plug-in like its name or version.
kLibHandle  GetLibraryHandle ()
  Retrieve the library address pointer for this plug-in.
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 (KFbxScene &pScene)
  Virtual function called once when the FBX SDK is about to write an FBX file.
virtual void  WriteParameters (KFbxObject &pParams)
  Virtual function called once when the FBX SDK is about to write plug-in's parameters.
virtual void  WriteEnd (KFbxScene &pScene)
  Virtual function called once after the FBX SDK wrote an FBX file.
virtual void  ReadBegin (KFbxScene &pScene)
  Virtual function called once when the FBX SDK is about to read an FBX file.
virtual void  ReadParameters (KFbxObject &pParams)
  Virtual function called once after the FBX SDK reads the plug-in's parameters.
virtual void  ReadEnd (KFbxScene &pScene)
  Virtual function called once after the FBX SDK read an FBX file.
KFbxObject GetPluginSettings ()
const KFbxObject GetPluginSettings () const
template<typename EventType , typename ListernerType >
KFbxEventHandler *  Bind (void(ListernerType::*pFunc)(const EventType *))
virtual void  Destroy ()=0

Protected Member Functions

  KFbxPlugin (const KFbxPluginDefinition &pDefinition, kLibHandle pLibHandle)
  Use the Create() and Destroy() methods declared and implemented in the KFBXPLUGIN_DECLARE and KFBXPLUGIN_IMPLEMENT macros to construct and destroy KFbxPlugin objects.
virtual  ~KFbxPlugin ()
  Destructor.
KFbxPluginData GetData ()
  Accessor to the plug-in private data.
const KFbxPluginData GetData () const
  Const accessor to the plug-in private data.

Friends

class  KFbxLoadingStrategy

Constructor & Destructor Documentation

KFbxPlugin ( const KFbxPluginDefinition pDefinition,
kLibHandle  pLibHandle 
) [explicit, protected]

Use the Create() and Destroy() methods declared and implemented in the KFBXPLUGIN_DECLARE and KFBXPLUGIN_IMPLEMENT macros to construct and destroy KFbxPlugin 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.
pLibHandle A pointer to the plug-in library address.
virtual ~KFbxPlugin ( ) [protected, virtual]

Destructor.


Member Function Documentation

const KFbxPluginDefinition& 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.
kLibHandle GetLibraryHandle ( )

Retrieve the library 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.

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 ( KFbxScene 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 ( KFbxObject 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 ( KFbxScene 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 ( KFbxScene 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 ( KFbxObject 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 ( KFbxScene 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.
KFbxPluginData& GetData ( ) [protected]

Accessor to the plug-in private data.

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

Const accessor to the plug-in private data.

Returns:
The const data for the current plug-in.
KFbxObject& GetPluginSettings ( ) [inline]

Definition at line 273 of file kfbxplugin.h.

{ return *(mPluginSettings.Get()); }
const KFbxObject& GetPluginSettings ( ) const [inline]

Definition at line 274 of file kfbxplugin.h.

{ return *(mPluginSettings.Get()); }
KFbxEventHandler* Bind ( void(ListernerType::*)(const EventType *)  pFunc ) [inline]

Definition at line 275 of file kfbxplugin.h.

    {
        return KFbxListener::Bind<EventType,ListernerType>(*(GetData().mQueryEmitter), pFunc );
    }
virtual void Destroy ( ) [pure virtual]

Friends And Related Function Documentation

friend class KFbxLoadingStrategy [friend]

Definition at line 282 of file kfbxplugin.h.


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

KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin
KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin KFbxPlugin