fbxsdk/core/fbxplugin.h Source File

fbxplugin.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_CORE_PLUGIN_H_
14 #define _FBXSDK_CORE_PLUGIN_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
18 #ifndef FBXSDK_ENV_WINSTORE
19 
20 #include <fbxsdk/core/fbxobject.h>
21 #include <fbxsdk/core/fbxmodule.h>
23 
24 #include <fbxsdk/fbxsdk_nsbegin.h>
25 
26 class FbxManager;
27 class FbxPluginContainer;
28 
30 #define FBXSDK_PLUGIN_DECLARE(Plugin)\
31  FBXSDK_FRIEND_NEW();\
32 public:\
33  static Plugin * Create(const FbxPluginDef& pDefinition, FbxModule pModuleHandle);\
34  void Destroy();
35 
37 #define FBXSDK_PLUGIN_IMPLEMENT(Plugin)\
38  Plugin* Plugin::Create(const FbxPluginDef& pDefinition, FbxModule pModuleHandle){ return FbxNew<Plugin>(pDefinition, pModuleHandle); }\
39  void Plugin::Destroy(){ FbxDelete(this); }
40 
48 {
51  mName("Unknown Name"),
52  mVersion("Unknown Version")
53  {
54  }
55 
58 };
59 
63 {
66  mQueryEmitter(NULL),
67  mSDKManager(NULL),
68  mPluginContainer(NULL)
69  {
70  }
71 
73  explicit FbxPluginData(const FbxPluginData& pOther) :
74  mQueryEmitter(pOther.mQueryEmitter),
75  mSDKManager(pOther.mSDKManager),
76  mPluginContainer(pOther.mPluginContainer)
77  {
78  }
79 
83 };
84 
149 {
150  FBXSDK_INTRUSIVE_LIST_NODE(FbxPlugin, 1);
151 
152 public:
156  virtual bool SpecificInitialize()=0;
157 
161  virtual bool SpecificTerminate()=0;
162 
167  virtual void WriteBegin(FbxScene& pScene);
168 
174  virtual void WriteParameters(FbxObject& pParams);
175 
181  virtual void WriteEnd(FbxScene& pScene);
182 
187  virtual void ReadBegin(FbxScene& pScene);
188 
194  virtual void ReadParameters(FbxObject& pParams);
195 
200  virtual void ReadEnd(FbxScene& pScene);
201 
206  const FbxPluginDef& GetDefinition() const;
207 
211  FbxModule GetModuleHdl();
212 
213 protected:
218  explicit FbxPlugin(const FbxPluginDef& pDefinition, FbxModule pModuleHandle);
219 
223  FbxPluginData& GetData();
224 
228  const FbxPluginData& GetData() const;
229 
230 /*****************************************************************************************************************************
231 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
232 *****************************************************************************************************************************/
233 #ifndef DOXYGEN_SHOULD_SKIP_THIS
234 public:
235  inline FbxObject& GetPluginSettings() { return *mPluginSettings; }
236  inline const FbxObject& GetPluginSettings() const { return *mPluginSettings; }
237  template <typename EventType, typename ListernerType> inline FbxEventHandler* Bind(void (ListernerType::*pFunc)(const EventType*))
238  {
239  return FbxListener::Bind<EventType,ListernerType>(*(GetData().mQueryEmitter), pFunc );
240  }
241  virtual void Destroy() = 0;
242 
243 protected:
244  virtual ~FbxPlugin();
245 
246 private:
247  bool Initialize(const FbxPluginData& pData);
248  bool Terminate();
249 
250  bool mInitialized;
251  FbxPluginData mData;
252  FbxPluginDef mDefinition;
253  FbxModule mModuleHandle;
254  FbxObject* mPluginSettings;
255 
256  friend class FbxLoadingStrategy;
257 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
258 };
259 
260 #include <fbxsdk/fbxsdk_nsend.h>
261 
262 #endif /* !FBXSDK_ENV_WINSTORE */
263 
264 #endif /* _FBXSDK_CORE_PLUGIN_H_ */
FBX SDK environment definition.
SDK object manager.
Definition: fbxmanager.h:56
FbxEmitter * mQueryEmitter
The emitter on which the plug-in can listen to receive events.
Definition: fbxplugin.h:80
Data used to communicate information between an application and the plug-in.
Definition: fbxplugin.h:62
Abstract class used to implemented some plug-in loading strategy.
#define NULL
Definition: fbxarch.h:210
Utility class to manipulate strings.
Definition: fbxstring.h:66
FbxString mName
The identifier name string of the plug-in.
Definition: fbxplugin.h:56
FbxPluginContainer * mPluginContainer
The container which will have the ownership of the plug-in.
Definition: fbxplugin.h:82
The base class to inherit from when creating new plug-ins for the FBX SDK.
Definition: fbxplugin.h:148
Manages registration and ownership of FBX SDK plug-ins (FbxPlugin).
FbxManager * mSDKManager
The FBX SDK Manager on which the plug-in was instanced.
Definition: fbxplugin.h:81
void * FbxModule
Definition: fbxmodule.h:22
Event handler class contains a listener and a callback function.
The base class of most FBX objects.
Definition: fbxobject.h:157
FbxPluginDef()
Constructor.
Definition: fbxplugin.h:50
This class contains the description of a 3D scene.
Definition: fbxscene.h:61
Base class to emit event with the specified event type.
Definition: fbxemitter.h:49
#define FBXSDK_DLL
Definition: fbxarch.h:173
FBX SDK listener class.
Definition: fbxlistener.h:41
FbxPluginData()
Constructor.
Definition: fbxplugin.h:65
Structure used by plug-ins for identification purposes.
Definition: fbxplugin.h:47
FbxString mVersion
The version string of the plug-in.
Definition: fbxplugin.h:57
FbxEventHandler * Bind(FbxEmitter &pEmitter, void(ListenerType::*pFunc)(const EventType *))
Bind current listener and the specified emitter together via an automatically created event handler...
Definition: fbxlistener.h:67
FbxPluginData(const FbxPluginData &pOther)
Copy Constructor.
Definition: fbxplugin.h:73