- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# fbxplugin.h

Go to the documentation of this file.

    00001 /****************************************************************************************
    00002
    00003    Copyright (C) 2013 Autodesk, Inc.
    00004    All rights reserved.
    00005
    00006    Use of this software is subject to the terms of the Autodesk license agreement
    00007    provided at the time of installation or download, or which otherwise accompanies
    00008    this software in either electronic or hard copy form.
    00009
    00010 ****************************************************************************************/
    00011
    00013 #ifndef _FBXSDK_CORE_PLUGIN_H_
    00014 #define _FBXSDK_CORE_PLUGIN_H_
    00015
    00016 #include <fbxsdk/fbxsdk_def.h>
    00017
    00018 #ifndef FBXSDK_ENV_WINRT
    00019
    00020 #include <fbxsdk/core/fbxobject.h>
    00021 #include <fbxsdk/core/fbxmodule.h>
    00022 #include <fbxsdk/core/fbxlistener.h>
    00023
    00024 #include <fbxsdk/fbxsdk_nsbegin.h>
    00025
    00026 class FbxManager;
    00027 class FbxPluginContainer;
    00028
    00030 #define FBXSDK_PLUGIN_DECLARE(Plugin)\
    00031     FBXSDK_FRIEND_NEW();\
    00032 public:\
    00033     static Plugin * Create(const FbxPluginDef& pDefinition, FbxModule pModuleHandle);\
    00034     void Destroy();
    00035
    00037 #define FBXSDK_PLUGIN_IMPLEMENT(Plugin)\
    00038     Plugin* Plugin::Create(const FbxPluginDef& pDefinition, FbxModule pModuleHandle){ return FbxNew<Plugin>(pDefinition, pModuleHandle); }\
    00039     void Plugin::Destroy(){ FbxDelete(this); }
    00040
    00047 struct FBXSDK_DLL FbxPluginDef
    00048 {
    00050     FbxPluginDef() :
    00051         mName("Unknown Name"),
    00052         mVersion("Unknown Version")
    00053     {
    00054     }
    00055
    00056     FbxString mName;
    00057     FbxString mVersion;
    00058 };
    00059
    00062 struct FBXSDK_DLL FbxPluginData
    00063 {
    00065     FbxPluginData() :
    00066         mQueryEmitter(NULL),
    00067         mSDKManager(NULL),
    00068         mPluginContainer(NULL)
    00069     {
    00070     }
    00071
    00073     explicit FbxPluginData(const FbxPluginData& pOther) :
    00074         mQueryEmitter(pOther.mQueryEmitter),
    00075         mSDKManager(pOther.mSDKManager),
    00076         mPluginContainer(pOther.mPluginContainer)
    00077     {
    00078     }
    00079
    00080     FbxEmitter*         mQueryEmitter;
    00081     FbxManager*         mSDKManager;
    00082     FbxPluginContainer* mPluginContainer;
    00083 };
    00084
    00148 class FBXSDK_DLL FbxPlugin : public FbxListener
    00149 {
    00150     FBXSDK_INTRUSIVE_LIST_NODE(FbxPlugin, 1);
    00151
    00152 public:
    00156     virtual bool SpecificInitialize()=0;
    00157
    00161     virtual bool SpecificTerminate()=0;
    00162
    00167     virtual void WriteBegin(FbxScene& pScene);
    00168
    00174     virtual void WriteParameters(FbxObject& pParams);
    00175
    00181     virtual void WriteEnd(FbxScene& pScene);
    00182
    00187     virtual void ReadBegin(FbxScene& pScene);
    00188
    00194     virtual void ReadParameters(FbxObject& pParams);
    00195
    00200     virtual void ReadEnd(FbxScene& pScene);
    00201
    00206     const FbxPluginDef& GetDefinition() const;
    00207
    00211     FbxModule GetModuleHdl();
    00212
    00213 protected:
    00218     explicit FbxPlugin(const FbxPluginDef& pDefinition, FbxModule pModuleHandle);
    00219
    00223     FbxPluginData& GetData();
    00224
    00228     const FbxPluginData& GetData() const;
    00229
    00230 /*****************************************************************************************************************************
    00231 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
    00232 *****************************************************************************************************************************/
    00233 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00234 public:
    00235     inline FbxObject& GetPluginSettings() { return *mPluginSettings; }
    00236     inline const FbxObject& GetPluginSettings() const { return *mPluginSettings; }
    00237     template <typename EventType, typename ListernerType> inline FbxEventHandler* Bind(void (ListernerType::*pFunc)(const EventType*))
    00238     {
    00239         return FbxListener::Bind<EventType,ListernerType>(*(GetData().mQueryEmitter), pFunc );
    00240     }
    00241     virtual void Destroy() = 0;
    00242
    00243 protected:
    00244     virtual ~FbxPlugin();
    00245
    00246 private:
    00247     bool                            Initialize(const FbxPluginData& pData);
    00248     bool                            Terminate();
    00249
    00250     bool                            mInitialized;
    00251     FbxPluginData                   mData;
    00252     FbxPluginDef                    mDefinition;
    00253     FbxModule                       mModuleHandle;
    00254     FbxObject*                      mPluginSettings;
    00255
    00256     friend class FbxLoadingStrategy;
    00257 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
    00258 };
    00259
    00260 #include <fbxsdk/fbxsdk_nsend.h>
    00261
    00262 #endif /* !FBXSDK_ENV_WINRT */
    00263
    00264 #endif /* _FBXSDK_CORE_PLUGIN_H_ */