Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013 #ifndef _FBXSDK_CORE_PLUG_H_
00014 #define _FBXSDK_CORE_PLUG_H_
00015
00016 #include <fbxsdk/fbxsdk_def.h>
00017
00018 #include <fbxsdk/core/fbxemitter.h>
00019
00020 #include <fbxsdk/fbxsdk_nsbegin.h>
00021
00022 class FbxPlug;
00023 class FbxManager;
00024 class FbxClassIdInfo;
00025 class FbxObject;
00026 class FbxPropertyHandle;
00027
00029 typedef FbxPlug* (*FbxPlugCreateProc)(FbxManager& pManager, const char* pName, const FbxPlug* pFrom, const char* pFBXType, const char* pFBXSubType);
00030
00046 class FBXSDK_DLL FbxClassId
00047 {
00048 public:
00050 FbxClassId();
00051
00059 FbxClassId(const char* pClassName, const FbxClassId& pParentClassId, FbxPlugCreateProc pConstructor=0, const char* pFBXType=NULL, const char* pFBXSubType=NULL);
00060
00062 void Destroy();
00063
00067 const char* GetName() const;
00068
00072 FbxClassId GetParent() const;
00073
00080 FbxPlug* Create(FbxManager& pManager, const char* pName, const FbxPlug* pFrom);
00081
00086 bool Override(FbxPlugCreateProc pConstructor);
00087
00093 bool Is(FbxClassId const pId) const;
00094
00100 bool operator==(const FbxClassId& pClassId) const;
00101
00107 bool operator!=(const FbxClassId& pClassId) const;
00108
00109 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00110
00113 inline FbxClassIdInfo* GetClassIdInfo() { return mClassInfo; }
00114
00118 inline const FbxClassIdInfo* GetClassIdInfo() const { return mClassInfo; }
00119 #endif
00120
00125 const char* GetFbxFileTypeName(bool pAskParent=false) const;
00126
00131 const char* GetFbxFileSubTypeName() const;
00132
00136 inline bool IsValid() const { return mClassInfo ? true : false; }
00137
00143 void SetObjectTypePrefix(const char* pObjectTypePrefix);
00144
00148 const char* GetObjectTypePrefix();
00149
00154 FbxPropertyHandle* GetRootClassDefaultPropertyHandle();
00155
00159 int ClassInstanceIncRef();
00160
00164 int ClassInstanceDecRef();
00165
00169 int GetInstanceRef();
00170
00172
00173
00174
00175
00176
00177
00179 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00180 private:
00181 FbxClassId(FbxClassIdInfo* mClassInfo);
00182
00183 bool SetFbxFileTypeName(const char* pName);
00184 bool SetFbxFileSubTypeName(const char* pName);
00185
00186 FbxClassIdInfo* mClassInfo;
00187
00188 friend class FbxManager;
00189 #endif
00190 };
00191
00193 #define FBXSDK_PLUG_DECLARE(Class) \
00194 public: \
00195 FBXSDK_FRIEND_NEW(); \
00196 static FbxClassId ClassId; \
00197 static Class* Create(FbxManager* pManager, const char* pName); \
00198 static Class* ManagerCreate(FbxManager* pManager, const char* pName, Class* pFrom) \
00199 { \
00200 Class* lClass = FbxNew< Class >(*pManager, pName); \
00201 lClass->Construct(pFrom); \
00202 return lClass; \
00203 } \
00204 virtual FbxClassId GetClassId() const { return ClassId; } \
00205 friend class FBXSDK_NAMESPACE::FbxManager; \
00206
00207
00208 #define FBXSDK_ABSTRACT_PLUG_DECLARE(Class) \
00209 public: \
00210 static FbxClassId ClassId; \
00211 static Class* Create(FbxManager* pManager, const char* pName); \
00212 static FbxPlugCreateProc ManagerCreate; \
00213 virtual FbxClassId GetClassId() const { return ClassId; } \
00214 friend class FBXSDK_NAMESPACE::FbxManager; \
00215
00216
00217 #define FBXSDK_PLUG_IMPLEMENT(Class) \
00218 FbxClassId Class::ClassId; \
00219 Class* Class::Create(FbxManager* pManager, const char* pName) \
00220 { \
00221 Class* ClassPtr; \
00222 ClassPtr = 0; \
00223 return (Class*)pManager->CreateNewObjectFromClassId(Class::ClassId, pName); \
00224 } \
00225
00226
00227 #define FBXSDK_ABSTRACT_PLUG_IMPLEMENT(Class) \
00228 FbxClassId Class::ClassId; \
00229 FbxPlugCreateProc Class::ManagerCreate = 0; \
00230 Class* Class::Create(FbxManager* pManager, const char* pName) \
00231 { \
00232 Class* ClassPtr; \
00233 ClassPtr = 0; \
00234 return (Class*)pManager->CreateNewObjectFromClassId(Class::ClassId, pName); \
00235 } \
00236
00237
00241 class FBXSDK_DLL FbxPlug : public FbxEmitter
00242 {
00243 FBXSDK_PLUG_DECLARE(FbxPlug);
00244
00245 public:
00251 virtual void Destroy(bool pRecursive=false, bool pDependents=false);
00252
00257 virtual FbxManager* GetFbxManager() const { return 0; }
00258
00264 virtual bool Is(FbxClassId pClassId) const { return GetClassId().Is(pClassId); }
00265
00271 template < class T >inline bool Is(T* pFBX_TYPE) const { return Is(T::ClassId); }
00272
00279 virtual bool IsRuntime(FbxClassId pClassId) const { return GetRuntimeClassId().Is(pClassId); }
00280
00288 virtual bool SetRuntimeClassId(FbxClassId pClassId);
00289
00293 virtual FbxClassId GetRuntimeClassId() const;
00294
00298 virtual bool IsRuntimePlug() const { return !( GetRuntimeClassId() == GetClassId() ); }
00299
00301
00302
00303
00304
00305
00306
00308 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00309 inline static void SetWipeMode(bool pState) { FbxPlug::sgWipeMode = pState; }
00310 inline static bool GetWipeMode() { return FbxPlug::sgWipeMode; }
00311
00312 private:
00313
00314
00315 static bool sgWipeMode;
00316
00317 protected:
00318 inline FbxPlug() {}
00319 inline FbxPlug(FbxManager& , const char* ) {}
00320 virtual ~FbxPlug() {}
00321
00322 virtual void Construct(const FbxPlug* pFrom);
00323 virtual void Destruct(bool pRecursive, bool pDependents);
00324 friend class FbxProperty;
00325 friend class FbxObject;
00326 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00327 };
00328
00336 #define FBX_TYPE(class) ((const class*)0)
00337
00344 template < class T > inline T* FbxCast(FbxPlug* pPlug)
00345 {
00346 return pPlug && pPlug->Is(T::ClassId) ? (T*)pPlug : 0;
00347 }
00348
00355 template < class T > inline const T* FbxCast(const FbxPlug* pPlug)
00356 {
00357 return pPlug && pPlug->Is(T::ClassId) ? (const T*)pPlug : 0;
00358 }
00359
00360 #include <fbxsdk/fbxsdk_nsend.h>
00361
00362 #endif