Go to the
documentation of this file.
00001
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXPLUG_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXPLUG_H
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include <fbxfilesdk/fbxfilesdk_def.h>
00042
00043 #include <fbxfilesdk/kfbxevents/kfbxemitter.h>
00044 #include <fbxfilesdk/fbxfilesdk_new.h>
00045
00046 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00047
00048 class KFbxPlug;
00049 class KFbxSdkManager;
00050 class KFbxClassIdInfo;
00051 class KFbxObject;
00052 class KFbxPropertyHandle;
00053
00055 typedef KFbxPlug* (*kFbxPlugConstructor)(KFbxSdkManager& pManager, const char* pName, const KFbxPlug* pFrom, const char* pFBXType, const char* pFBXSubType);
00056
00072 class KFBX_DLL kFbxClassId
00073 {
00074 public:
00076 kFbxClassId();
00077
00085 kFbxClassId(const char* pClassName, const kFbxClassId &pParentClassId, kFbxPlugConstructor pConstructor=0, const char* pFBXType=NULL, const char* pFBXSubType=NULL);
00086
00088 void Destroy();
00089
00093 const char* GetName() const;
00094
00098 kFbxClassId GetParent() const;
00099
00106 KFbxPlug* Create(KFbxSdkManager& pManager, const char* pName, const KFbxPlug* pFrom);
00107
00112 bool Override(kFbxPlugConstructor pConstructor);
00113
00119 bool Is(kFbxClassId const pId) const;
00120
00126 bool operator==(kFbxClassId const& pClassId) const;
00127
00133 bool operator!=(kFbxClassId const& pClassId) const;
00134
00135 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00136
00139 inline KFbxClassIdInfo* GetClassIdInfo() { return mClassInfo; }
00140
00144 inline const KFbxClassIdInfo* GetClassIdInfo() const { return mClassInfo; }
00145 #endif
00146
00151 const char* GetFbxFileTypeName(bool pAskParent=false) const;
00152
00157 const char* GetFbxFileSubTypeName() const;
00158
00162 inline bool IsValid() const { return mClassInfo ? true : false; }
00163
00169 void SetObjectTypePrefix(const char* pObjectTypePrefix);
00170
00174 const char* GetObjectTypePrefix();
00175
00180 KFbxPropertyHandle* GetRootClassDefaultPropertyHandle();
00181
00185 int ClassInstanceIncRef();
00186
00190 int ClassInstanceDecRef();
00191
00195 int GetInstanceRef();
00196
00198
00199
00200
00201
00202
00203
00205 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00206 private:
00207 kFbxClassId(KFbxClassIdInfo* mClassInfo);
00208
00209 bool SetFbxFileTypeName(const char* pName);
00210 bool SetFbxFileSubTypeName(const char* pName);
00211
00212 KFbxClassIdInfo* mClassInfo;
00213
00214 friend class KFbxSdkManager;
00215 #endif
00216 };
00217
00219 #define KFBXPLUG_DECLARE(Class) \
00220 public: \
00221 KFBXNEW_DECLARE_FRIEND \
00222 static kFbxClassId ClassId; \
00223 static Class* Create(KFbxSdkManager *pManager, const char *pName); \
00224 static Class* SdkManagerCreate(KFbxSdkManager *pManager, const char *pName, Class* pFrom) \
00225 { \
00226 Class* lClass = FbxSdkNew< Class >(*pManager, pName); \
00227 lClass->Construct(pFrom); \
00228 return lClass; \
00229 } \
00230 virtual kFbxClassId GetClassId() const { return ClassId; } \
00231 friend class FBXFILESDK_NAMESPACE::KFbxSdkManager; \
00232
00233
00234 #define KFBXPLUG_DECLARE_ABSTRACT(Class) \
00235 public: \
00236 static kFbxClassId ClassId; \
00237 static Class* Create(KFbxSdkManager *pManager, const char *pName); \
00238 static kFbxPlugConstructor SdkManagerCreate; \
00239 virtual kFbxClassId GetClassId() const { return ClassId; } \
00240 friend class FBXFILESDK_NAMESPACE::KFbxSdkManager; \
00241
00242
00243 #define KFBXPLUG_IMPLEMENT(Class) \
00244 kFbxClassId Class::ClassId; \
00245 Class* Class::Create(KFbxSdkManager* pManager, const char* pName) \
00246 { \
00247 Class* ClassPtr; \
00248 ClassPtr = 0; \
00249 return (Class*)pManager->CreateNewObjectFromClassId(Class::ClassId, pName); \
00250 } \
00251
00252
00253 #define KFBXPLUG_IMPLEMENT_ABSTRACT(Class) \
00254 kFbxClassId Class::ClassId; \
00255 kFbxPlugConstructor Class::SdkManagerCreate = 0; \
00256 Class* Class::Create(KFbxSdkManager *pManager, const char *pName) \
00257 { \
00258 Class* ClassPtr; \
00259 ClassPtr = 0; \
00260 return (Class*)pManager->CreateNewObjectFromClassId(Class::ClassId, pName); \
00261 } \
00262
00263
00267 class KFBX_DLL KFbxPlug : public kfbxevents::KFbxEmitter
00268 {
00269 KFBXPLUG_DECLARE(KFbxPlug);
00270
00271 public:
00277 virtual void Destroy(bool pRecursive=false, bool pDependents=false);
00278
00283 virtual KFbxSdkManager* GetFbxSdkManager() const { return 0; }
00284
00290 virtual bool Is(kFbxClassId pClassId) const { return GetClassId().Is(pClassId); }
00291
00297 template < class T >inline bool Is(T *pFBX_TYPE) const { return Is(T::ClassId); }
00298
00305 virtual bool IsRuntime(kFbxClassId pClassId) const { return GetRuntimeClassId().Is(pClassId); }
00306
00314 virtual bool SetRuntimeClassId(kFbxClassId pClassId);
00315
00319 virtual kFbxClassId GetRuntimeClassId() const;
00320
00324 virtual bool IsRuntimePlug() const { return !( GetRuntimeClassId() == GetClassId() ); }
00325
00327
00328
00329
00330
00331
00332
00334 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00335 inline static void SetWipeMode(bool pState) { KFbxPlug::sgWipeMode = pState; }
00336 inline static bool GetWipeMode() { return KFbxPlug::sgWipeMode; }
00337
00338 private:
00339
00340
00341 static bool sgWipeMode;
00342
00343 protected:
00344 inline KFbxPlug() {}
00345 inline KFbxPlug(KFbxSdkManager& pManager, const char* pName) {}
00346 virtual ~KFbxPlug() {}
00347
00348 virtual void Construct(const KFbxPlug* pFrom);
00349 virtual void Destruct(bool pRecursive, bool pDependents);
00350 friend class KFbxProperty;
00351 friend class KFbxObject;
00352 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00353 };
00354
00362 #define FBX_TYPE(class) ((class const*)0)
00363
00374 #define FBX_CLASSID(class) (class::ClassId)
00375
00382 template < class T > inline T* KFbxCast(KFbxPlug *pPlug)
00383 {
00384 return pPlug && pPlug->Is(FBX_CLASSID(T)) ? (T *)pPlug : 0;
00385 }
00386
00393 template < class T > inline T const* KFbxCast(KFbxPlug const*pPlug)
00394 {
00395 return pPlug && pPlug->Is(FBX_CLASSID(T)) ? (T const*)pPlug : 0;
00396 }
00397
00398 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00399
00400 #endif // FBXFILESDK_KFBXPLUGINS_KFBXPLUG_H
00401