- Main Page
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# fbxplugin.h

Go to the documentation of this file.

    00001 /****************************************************************************************
    00002
    00003    Copyright (C) 2012 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 #include <fbxsdk/core/fbxobject.h>
    00019
    00020 #include <fbxsdk/core/base/fbxstring.h>
    00021 #include <fbxsdk/core/base/fbxintrusivelist.h>
    00022 #include <fbxsdk/core/fbxmodule.h>
    00023 #include <fbxsdk/core/base/fbxscopedptr.h>
    00024
    00025 #include <fbxsdk/core/fbxemitter.h>
    00026 #include <fbxsdk/core/fbxlistener.h>
    00027
    00028 #include <fbxsdk/fbxsdk_nsbegin.h>
    00029
    00030 class FbxManager;
    00031 class FbxLoadingStrategy;
    00032 class FbxPluginContainer;
    00033
    00035 #define FBXSDK_PLUGIN_DECLARE(Plugin)\
    00036     FBXSDK_FRIEND_NEW();\
    00037 public:\
    00038     static Plugin * Create(const FbxPluginDef& pDefinition, FbxModule pModuleHandle);\
    00039     void Destroy();
    00040
    00042 #define FBXSDK_PLUGIN_IMPLEMENT(Plugin)\
    00043     Plugin* Plugin::Create(const FbxPluginDef& pDefinition, FbxModule pModuleHandle){ return FbxNew<Plugin>(pDefinition, pModuleHandle); }\
    00044     void Plugin::Destroy(){ FbxDelete(this); }
    00045
    00052 struct FBXSDK_DLL FbxPluginDef
    00053 {
    00055     FbxPluginDef() :
    00056         mName("Unknown Name"),
    00057         mVersion("Unknown Version")
    00058     {
    00059     }
    00060
    00061     FbxString mName;
    00062     FbxString mVersion;
    00063 };
    00064
    00067 struct FBXSDK_DLL FbxPluginData
    00068 {
    00070     FbxPluginData() :
    00071         mQueryEmitter(NULL),
    00072         mSDKManager(NULL),
    00073         mPluginContainer(NULL)
    00074     {
    00075     }
    00076
    00078     explicit FbxPluginData(const FbxPluginData& pOther) :
    00079         mQueryEmitter(pOther.mQueryEmitter),
    00080         mSDKManager(pOther.mSDKManager),
    00081         mPluginContainer(pOther.mPluginContainer)
    00082     {
    00083     }
    00084
    00085     FbxEmitter* mQueryEmitter;
    00086     FbxManager*             mSDKManager;
    00087     FbxPluginContainer*     mPluginContainer;
    00088 };
    00089
    00153 class FBXSDK_DLL FbxPlugin : public FbxListener
    00154 {
    00155     FBXSDK_INTRUSIVE_LIST_NODE(FbxPlugin, 1);
    00156
    00157 public:
    00162     const FbxPluginDef& GetDefinition() const;
    00163
    00167     FbxModule GetModuleHdl();
    00168
    00172     virtual bool SpecificInitialize() = 0;
    00173
    00177     virtual bool SpecificTerminate() = 0;
    00178
    00183     virtual void WriteBegin(FbxScene& pScene);
    00184
    00190     virtual void WriteParameters(FbxObject& pParams);
    00191
    00197     virtual void WriteEnd(FbxScene& pScene);
    00198
    00203     virtual void ReadBegin(FbxScene& pScene);
    00204
    00210     virtual void ReadParameters(FbxObject& pParams);
    00211
    00216     virtual void ReadEnd(FbxScene& pScene);
    00217
    00218 protected:
    00223     explicit FbxPlugin(const FbxPluginDef& pDefinition, FbxModule pModuleHandle);
    00224
    00226     virtual ~FbxPlugin();
    00227
    00231     FbxPluginData& GetData();
    00232
    00236     const FbxPluginData& GetData() const;
    00237
    00239 //
    00240 //  WARNING!
    00241 //
    00242 //  Anything beyond these lines may not be documented accurately and is
    00243 //  subject to change without notice.
    00244 //
    00246 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00247 public:
    00248     inline FbxObject& GetPluginSettings() { return *(mPluginSettings.Get()); }
    00249     inline const FbxObject& GetPluginSettings() const { return *(mPluginSettings.Get()); }
    00250     template <typename EventType, typename ListernerType> inline FbxEventHandler* Bind(void (ListernerType::*pFunc)(const EventType*))
    00251     {
    00252         return FbxListener::Bind<EventType,ListernerType>(*(GetData().mQueryEmitter), pFunc );
    00253     }
    00254     virtual void Destroy() = 0;
    00255
    00256 private:
    00257     bool                            Initialize(const FbxPluginData& pData);
    00258     bool                            Terminate();
    00259
    00260     bool                            mInitialized;
    00261     FbxPluginData                   mData;
    00262     FbxPluginDef                    mDefinition;
    00263     FbxModule                       mModuleHandle;
    00264     FbxObjectScopedPtr<FbxObject>   mPluginSettings;
    00265
    00266     friend class FbxLoadingStrategy;
    00267 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00268 };
    00269
    00270 #include <fbxsdk/fbxsdk_nsend.h>
    00271
    00272 #endif /* _FBXSDK_CORE_PLUGIN_H_ */