00001
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXOBJECT_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXOBJECT_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
00044 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00045 #include <fbxfilesdk/components/kbaselib/klib/kstringlist.h>
00046 #include <fbxfilesdk/components/kbaselib/klib/kname.h>
00047 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00048 #include <fbxfilesdk/components/kbaselib/klib/kscopedptr.h>
00049 #include <fbxfilesdk/kfbxplugins/kfbxplug.h>
00050 #include <fbxfilesdk/kfbxplugins/kfbxproperty.h>
00051 #include <fbxfilesdk/kfbxevents/kfbxevents.h>
00052
00053
00054 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00055
00056 class KFbxSdkManager;
00057 class KFbxDocument;
00058 class KFbxScene;
00059 class KFbxObject_internal;
00060 class KFbxProperty_internal;
00061 class KFbxAnimLayer;
00062 class UserDataRecord;
00063 class KFbxImplementation;
00064 class KFbxImplementationFilter;
00065 class KFbxLibrary;
00066 class KFbxStream;
00067 class KFbxPeripheral;
00068 class KFbxObject;
00069 class KFbxMessage;
00070
00072 class KFbxObjectPropertyChanged : public kfbxevents::KFbxEvent<KFbxObjectPropertyChanged>
00073 {
00074 public:
00075 KFBXEVENT_DECLARE(KFbxObjectPropertyChanged)
00076
00077 public:
00078 KFbxObjectPropertyChanged(KFbxProperty pProp):mProp(pProp){}
00079 KFbxProperty mProp;
00080 };
00082
00083 enum eFbxCompare {
00084 eFbxCompareProperties
00085 };
00086
00087 #define KFBXOBJECT_DECLARE(Class,Parent) \
00088 KFBXPLUG_DECLARE(Class) \
00089 typedef Parent ParentClass; \
00090 static Class* Create(KFbxObject *pContainer, char const *pName); \
00091 static Class* CreateForClone( KFbxSdkManager *pManager, char const *pName, const Class* pFrom ); \
00092 virtual ~Class(){}; \
00093 Class* TypedClone(KFbxObject* pContainer = NULL, KFbxObject::ECloneType pCloneType = eDEEP_CLONE) const; \
00094 private: \
00095 Class(const Class&); \
00096 Class& operator=(const Class&); \
00097
00098 #define KFBXOBJECT_DECLARE_ABSTRACT(Class,Parent) \
00099 KFBXPLUG_DECLARE_ABSTRACT(Class) \
00100 typedef Parent ParentClass; \
00101 private: \
00102 Class(const Class&); \
00103 Class& operator=(const Class&); \
00104
00105 #define KFBXOBJECT_IMPLEMENT(Class) \
00106 KFBXPLUG_IMPLEMENT(Class) \
00107 Class* Class::Create(KFbxObject *pContainer, char const *pName) \
00108 { \
00109 Class* ClassPtr=Class::Create(pContainer->GetFbxSdkManager(),pName); \
00110 pContainer->ConnectSrcObject(ClassPtr); \
00111 return ClassPtr; \
00112 } \
00113 Class* Class::TypedClone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const \
00114 { \
00115 KFbxObject* lObjClone = Clone(pContainer, pCloneType); \
00116 if (lObjClone == NULL) \
00117 { \
00118 return NULL; \
00119 } \
00120 Class* lTypedClone = KFbxCast<Class>(lObjClone); \
00121 if (lTypedClone == NULL) \
00122 { \
00123 lObjClone->Destroy(); \
00124 } \
00125 return lTypedClone; \
00126 } \
00127 Class* Class::CreateForClone(KFbxSdkManager *pManager, char const *pName, const Class* pFrom ) \
00128 { \
00129 return (Class *)pManager->CreateClassFrom(Class::ClassId, pName, pFrom); \
00130 } \
00131
00132 #define KFBXOBJECT_IMPLEMENT_ABSTRACT(Class) \
00133 KFBXPLUG_IMPLEMENT_ABSTRACT(Class) \
00134
00135 typedef size_t KFbxObjectID;
00136
00137 class _KFbxObjectData;
00138
00139 typedef int kFbxUpdateId;
00140
00144 class KFBX_DLL KFbxObject : public KFbxPlug
00145 {
00146 public:
00149 typedef enum
00150 {
00151 eSURFACE_CLONE,
00152 eREFERENCE_CLONE,
00153 eDEEP_CLONE
00154 } ECloneType;
00155
00156 KFBXOBJECT_DECLARE(KFbxObject,KFbxPlug);
00157
00162 public:
00163
00164
00170 virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00171
00175 bool IsAReferenceTo(void) const;
00176
00180 KFbxObject* GetReferenceTo(void) const;
00181
00185 bool IsReferencedBy(void) const;
00186
00190 int GetReferencedByCount(void) const;
00191
00196 KFbxObject* GetReferencedBy(int pIndex) const;
00197
00198 protected:
00199
00201
00205 public:
00206
00210 void SetName(char const* pName);
00211
00215 char const* GetName() const;
00216
00220 KString GetNameWithoutNameSpacePrefix() const;
00221
00225 KString GetNameWithNameSpacePrefix() const;
00226
00230 void SetInitialName(char const* pName);
00231
00235 char const* GetInitialName() const;
00236
00240 KString GetNameSpaceOnly( );
00241
00245 void SetNameSpace(KString pNameSpace);
00246
00251 KArrayTemplate<KString*> GetNameSpaceArray( char identifier );
00252
00256 KString GetNameOnly() const;
00257
00261 KString GetNameSpacePrefix() const;
00262
00267 static KString RemovePrefix(char* pName);
00268
00273 static KString StripPrefix(KString& lName);
00274
00279 static KString StripPrefix(const char* pName);
00280
00282 KFbxObjectID const& GetUniqueID() const;
00284
00289 public:
00290
00295 typedef enum {
00296 eUpdateId_Object,
00297 eUpdateId_Dependency
00298 } eFbxUpdateIdType;
00299
00304 virtual kFbxUpdateId GetUpdateId(eFbxUpdateIdType pUpdateId=eUpdateId_Object) const;
00305
00306
00308
00316 public:
00326 int ContentUnload();
00327
00334 int ContentLoad();
00335
00341 bool ContentIsLoaded() const;
00342
00346 void ContentDecrementLockCount();
00347
00351 void ContentIncrementLockCount();
00352
00359 bool ContentIsLocked() const;
00360
00361
00362 protected:
00367 virtual void ContentClear();
00368
00373 virtual KFbxPeripheral* GetPeripheral();
00375 public:
00387 virtual bool ContentWriteTo(KFbxStream& pStream) const;
00388
00394 virtual bool ContentReadFrom(const KFbxStream& pStream);
00396
00401 public:
00402
00406 virtual bool GetSelected();
00407
00411 virtual void SetSelected(bool pSelected);
00413
00418 public:
00419
00423 inline KFbxProperty GetFirstProperty() const
00424 {
00425 return RootProperty.GetFirstDescendent();
00426 }
00427
00432 inline KFbxProperty GetNextProperty(KFbxProperty const &pProperty) const
00433 {
00434 return RootProperty.GetNextDescendent(pProperty);
00435 }
00436
00442 inline KFbxProperty FindProperty(const char* pName, bool pCaseSensitive = true)const
00443 {
00444 return RootProperty.Find(pName, pCaseSensitive );
00445 }
00446
00453 inline KFbxProperty FindProperty(const char* pName, KFbxDataType const &pDataType, bool pCaseSensitive = true) const
00454 {
00455 return RootProperty.Find(pName, pDataType, pCaseSensitive );
00456 }
00457
00464 inline KFbxProperty FindPropertyHierarchical(const char* pName, bool pCaseSensitive = true)const
00465 {
00466 return RootProperty.FindHierarchical(pName, pCaseSensitive );
00467 }
00468
00476 inline KFbxProperty FindPropertyHierarchical(const char* pName, KFbxDataType const &pDataType, bool pCaseSensitive = true) const
00477 {
00478 return RootProperty.FindHierarchical(pName, pDataType, pCaseSensitive );
00479 }
00480
00484 inline KFbxProperty &GetRootProperty() { return RootProperty; }
00485
00489 inline const KFbxProperty& GetRootProperty()const{ return RootProperty; }
00490
00495 KFbxProperty GetClassRootProperty();
00496
00497 public:
00498 KFbxProperty RootProperty;
00499
00500 private:
00501 void SetClassRootProperty(KFbxProperty &lProperty);
00502 int GetFlatPropertyCount() const;
00503
00505
00510
00511
00516 public:
00517
00523 inline bool ConnectSrcObject (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone) { return RootProperty.ConnectSrcObject(pObject,pType); }
00524
00529 inline bool IsConnectedSrcObject (const KFbxObject* pObject) const { return RootProperty.IsConnectedSrcObject (pObject); }
00530
00535 inline bool DisconnectSrcObject (KFbxObject* pObject) { return RootProperty.DisconnectSrcObject(pObject); }
00536
00540 inline bool DisconnectAllSrcObject() { return RootProperty.DisconnectAllSrcObject(); }
00541
00546 inline bool DisconnectAllSrcObject(KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllSrcObject(pCriteria); }
00547
00552 inline bool DisconnectAllSrcObject(kFbxClassId pClassId) { return RootProperty.DisconnectAllSrcObject(pClassId); }
00553
00559 inline bool DisconnectAllSrcObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllSrcObject(pClassId,pCriteria); }
00560
00564 inline int GetSrcObjectCount () const { return RootProperty.GetSrcObjectCount(); }
00565
00570 inline int GetSrcObjectCount (KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pCriteria); }
00571
00576 inline int GetSrcObjectCount (kFbxClassId pClassId) const { return RootProperty.GetSrcObjectCount(pClassId); }
00577
00583 inline int GetSrcObjectCount (kFbxClassId pClassId,KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pClassId,pCriteria); }
00584
00589 inline KFbxObject* GetSrcObject (int pIndex=0) const { return RootProperty.GetSrcObject(pIndex); }
00590
00596 inline KFbxObject* GetSrcObject (KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pCriteria,pIndex); }
00597
00603 inline KFbxObject* GetSrcObject (kFbxClassId pClassId,int pIndex=0) const { return RootProperty.GetSrcObject(pClassId,pIndex); }
00604
00611 inline KFbxObject* GetSrcObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pClassId,pCriteria,pIndex); }
00612
00618 inline KFbxObject* FindSrcObject (const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pName,pStartIndex); }
00619
00626 inline KFbxObject* FindSrcObject (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pCriteria,pName,pStartIndex); }
00627
00634 inline KFbxObject* FindSrcObject (kFbxClassId pClassId,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pClassId,pName,pStartIndex); }
00635
00643 inline KFbxObject* FindSrcObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pClassId,pCriteria,pName,pStartIndex); }
00644
00649 template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE) { return RootProperty.DisconnectAllSrcObject(pFBX_TYPE); }
00650
00656 template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllSrcObject(pFBX_TYPE,pCriteria); }
00657
00662 template < class T > inline int GetSrcObjectCount(T const *pFBX_TYPE) const { return RootProperty.GetSrcObjectCount(pFBX_TYPE); }
00663
00669 template < class T > inline int GetSrcObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pFBX_TYPE,pCriteria); }
00670
00676 template < class T > inline T* GetSrcObject(T const *pFBX_TYPE,int pIndex=0) const { return RootProperty.GetSrcObject(pFBX_TYPE,pIndex); }
00677
00684 template < class T > inline T* GetSrcObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pFBX_TYPE,pCriteria,pIndex); }
00685
00692 template < class T > inline T* FindSrcObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pFBX_TYPE,pName,pStartIndex); }
00693
00701 template < class T > inline T* FindSrcObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pFBX_TYPE,pCriteria,pName,pStartIndex); }
00702
00703
00709 inline bool ConnectDstObject (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone) { return RootProperty.ConnectDstObject(pObject,pType); }
00710
00715 inline bool IsConnectedDstObject (const KFbxObject* pObject) const { return RootProperty.IsConnectedDstObject (pObject); }
00716
00721 inline bool DisconnectDstObject (KFbxObject* pObject) { return RootProperty.DisconnectDstObject(pObject); }
00722
00726 inline bool DisconnectAllDstObject() { return RootProperty.DisconnectAllDstObject(); }
00727
00732 inline bool DisconnectAllDstObject(KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllDstObject(pCriteria); }
00733
00738 inline bool DisconnectAllDstObject(kFbxClassId pClassId) { return RootProperty.DisconnectAllDstObject(pClassId); }
00739
00745 inline bool DisconnectAllDstObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllDstObject(pClassId,pCriteria); }
00746
00750 inline int GetDstObjectCount () const { return RootProperty.GetDstObjectCount(); }
00751
00756 inline int GetDstObjectCount (KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pCriteria); }
00757
00762 inline int GetDstObjectCount (kFbxClassId pClassId) const { return RootProperty.GetDstObjectCount(pClassId); }
00763
00769 inline int GetDstObjectCount (kFbxClassId pClassId,KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pClassId,pCriteria); }
00770
00775 inline KFbxObject* GetDstObject (int pIndex=0) const { return RootProperty.GetDstObject(pIndex); }
00776
00782 inline KFbxObject* GetDstObject (KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pCriteria,pIndex); }
00783
00789 inline KFbxObject* GetDstObject (kFbxClassId pClassId,int pIndex=0) const { return RootProperty.GetDstObject(pClassId,pIndex); }
00790
00797 inline KFbxObject* GetDstObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pClassId,pCriteria,pIndex); }
00798
00804 inline KFbxObject* FindDstObject (const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pName,pStartIndex); }
00805
00812 inline KFbxObject* FindDstObject (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pCriteria,pName,pStartIndex); }
00813
00820 inline KFbxObject* FindDstObject (kFbxClassId pClassId,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pClassId,pName,pStartIndex); }
00821
00829 inline KFbxObject* FindDstObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pClassId,pCriteria,pName,pStartIndex); }
00830
00835 template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE) { return RootProperty.DisconnectAllDstObject(pFBX_TYPE); }
00836
00842 template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllDstObject(pFBX_TYPE,pCriteria); }
00843
00848 template < class T > inline int GetDstObjectCount(T const *pFBX_TYPE) const { return RootProperty.GetDstObjectCount(pFBX_TYPE); }
00849
00855 template < class T > inline int GetDstObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pFBX_TYPE,pCriteria); }
00856
00862 template < class T > inline T* GetDstObject(T const *pFBX_TYPE,int pIndex=0) const { return RootProperty.GetDstObject(pFBX_TYPE,pIndex); }
00863
00870 template < class T > inline T* GetDstObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pFBX_TYPE,pCriteria,pIndex); }
00871
00878 template < class T > inline T* FindDstObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pFBX_TYPE,pName,pStartIndex); }
00879
00887 template < class T > inline T* FindDstObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pFBX_TYPE,pCriteria,pName,pStartIndex); }
00889
00894
00899 inline bool ConnectSrcProperty (KFbxProperty const & pProperty) { return RootProperty.ConnectSrcProperty(pProperty); }
00900
00905 inline bool IsConnectedSrcProperty (KFbxProperty const & pProperty) { return RootProperty.IsConnectedSrcProperty(pProperty); }
00906
00911 inline bool DisconnectSrcProperty (KFbxProperty const & pProperty) { return RootProperty.DisconnectSrcProperty(pProperty); }
00912
00916 inline int GetSrcPropertyCount () const { return RootProperty.GetSrcPropertyCount(); }
00917
00922 inline KFbxProperty GetSrcProperty (int pIndex=0) const { return RootProperty.GetSrcProperty(pIndex); }
00923
00929 inline KFbxProperty FindSrcProperty (const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcProperty(pName,pStartIndex); }
00930
00935 inline bool ConnectDstProperty (KFbxProperty const & pProperty) { return RootProperty.ConnectDstProperty(pProperty); }
00936
00941 inline bool IsConnectedDstProperty (KFbxProperty const & pProperty) { return RootProperty.IsConnectedDstProperty(pProperty); }
00942
00947 inline bool DisconnectDstProperty (KFbxProperty const & pProperty) { return RootProperty.DisconnectDstProperty(pProperty); }
00948
00952 inline int GetDstPropertyCount () const { return RootProperty.GetDstPropertyCount(); }
00953
00958 inline KFbxProperty GetDstProperty (int pIndex=0) const { return RootProperty.GetDstProperty(pIndex); }
00959
00965 inline KFbxProperty FindDstProperty (const char *pName,int pStartIndex=0) const { return RootProperty.FindDstProperty(pName,pStartIndex); }
00967
00972
00979 void SetUserDataPtr(KFbxObjectID const& pUserID, void* pUserData);
00980
00985 void* GetUserDataPtr(KFbxObjectID const& pUserID) const;
00986
00992 inline void SetUserDataPtr(void* pUserData) { SetUserDataPtr( GetUniqueID(), pUserData ); }
00993
00997 inline void* GetUserDataPtr() const { return GetUserDataPtr( GetUniqueID() ); }
00999
01000
01009 KFbxDocument* GetDocument() const;
01010
01017 KFbxDocument* GetRootDocument() const;
01018
01023 KFbxScene* GetScene() const;
01025
01026
01035 void EmitMessage(KFbxMessage * pMessage) const;
01037
01048 virtual const char * Localize( const char * pID, const char * pDefault = NULL ) const;
01050
01058 KFbxLibrary* GetParentLibrary(void) const;
01059
01065 bool AddImplementation(KFbxImplementation* pImplementation);
01066
01072 bool RemoveImplementation(KFbxImplementation* pImplementation);
01073
01077 bool HasDefaultImplementation(void) const;
01078
01082 KFbxImplementation* GetDefaultImplementation(void) const;
01083
01090 bool SetDefaultImplementation(KFbxImplementation* pImplementation);
01091
01096 int GetImplementationCount(
01097 const KFbxImplementationFilter* pCriteria = NULL
01098 ) const;
01099
01105 KFbxImplementation* GetImplementation(
01106 int pIndex,
01107 const KFbxImplementationFilter* pCriteria = NULL
01108 ) const;
01110
01115 public:
01120 virtual KString GetUrl() const;
01121
01127 virtual bool SetUrl(char *pUrl);
01129
01135 virtual KFbxObject& Copy(const KFbxObject& pObject);
01136
01138
01139
01140
01141
01142
01143
01145
01146 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01147
01148 protected:
01149 KFbxObject(KFbxSdkManager& pManager, char const* pName);
01150
01151
01152
01153
01154
01155
01156 virtual void Construct(const KFbxObject* pFrom);
01157
01158
01159
01160
01161
01162 virtual bool ConstructProperties(bool pForceSet);
01163 virtual void Destruct(bool pRecursive, bool pDependents);
01164
01165 bool Copyable(const KFbxObject& pObject);
01166
01167 public:
01168 virtual bool Compare(KFbxObject *pOtherObject,eFbxCompare pCompareMethod=eFbxCompareProperties);
01169
01170 virtual KFbxSdkManager* GetFbxSdkManager() const;
01171 virtual kFbxClassId GetRuntimeClassId() const;
01172
01173 typedef enum
01174 {
01175 eNONE = 0x00000000,
01176 eSYSTEM_FLAG = 0x00000001,
01177 eSAVABLE_FLAG = 0x00000002,
01178 eHIDDEN_FLAG = 0x00000008,
01179
01180 eSYSTEM_FLAGS = 0x0000ffff,
01181
01182 eUSER_FLAGS = 0x000f0000,
01183
01184
01185 eSYSTEM_RUNTIME_FLAGS = 0x0ff00000,
01186
01187 eCONTENT_LOADED_FLAG = 0x00100000,
01188
01189 eUSER_RUNTIME_FIRST_FLAG= 0x10000000,
01190 eUSER_RUNTIME_FLAGS = 0xf0000000,
01191
01192 eRUNTIME_FLAGS = 0xfff00000
01193 } EObjectFlag;
01194
01195 void SetObjectFlags(EObjectFlag pFlags, bool pValue);
01196 bool GetObjectFlags(EObjectFlag pFlags) const;
01197
01198
01199
01200
01201
01202 void SetObjectFlags(kUInt pFlags);
01203 kUInt GetObjectFlags() const;
01204
01205
01206
01207
01208 bool operator==(KFbxObject const& pObject);
01209 bool operator!=(KFbxObject const& pObject);
01210
01211 private:
01212 void CopyPropertiesFrom(const KFbxObject& pFrom);
01213
01214 protected:
01215
01216 virtual bool SetRuntimeClassId(kFbxClassId pClassId);
01217 virtual bool ConnecNotify (KFbxConnectEvent const &pEvent);
01218 virtual kFbxUpdateId IncUpdateId(eFbxUpdateIdType pUpdateId=eUpdateId_Object);
01219
01220
01221 typedef enum {
01222 eFbxProperty_SetRequest,
01223 eFbxProperty_Set,
01224 eFbxProperty_Get
01225 } eFbxPropertyNotify;
01226 virtual bool PropertyNotify(eFbxPropertyNotify pType, KFbxProperty* pProperty);
01227
01228 public:
01229 virtual KString GetTypeName() const;
01230 virtual KStringList GetTypeFlags() const;
01231
01232 protected:
01233
01234
01235
01236 public:
01237 virtual void SetDocument(KFbxDocument* pDocument);
01238
01239 inline KFbxObjectHandle &GetPropertyHandle() { return RootProperty.mPropertyHandle; }
01240
01241 private:
01242 _KFbxObjectData* mData;
01243
01244
01245 friend class KFbxScene;
01246 friend class KFbxObject_internal;
01247 friend class KFbxProperty;
01248 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01249
01250 };
01251
01252
01253 inline bool KFbxConnectSrc(KFbxObject *pDstObject,KFbxObject *pSrcObject) { return (pSrcObject && pDstObject) ? pDstObject->ConnectSrcObject(pSrcObject) : 0; }
01254 inline bool KFbxConnectDst(KFbxObject *pSrcObject,KFbxObject *pDstObject) { return (pSrcObject && pDstObject) ? pSrcObject->ConnectDstObject(pDstObject) : 0; }
01255
01256 typedef KFbxObject* HKFbxObject;
01257
01258
01259 template < class T > inline int KFbxGetSrcCount(KFbxObject const *pObject, T const* VC6Dummy = 0) { return pObject ? pObject->GetSrcObjectCount(T::ClassId) : 0; }
01260 template < class T > inline int KFbxGetSrcCount(KFbxObject const *pObject,kFbxClassId pClassId, T const* VC6Dummy = 0) { return pObject ? pObject->GetSrcObjectCount(pClassId) : 0; }
01261 template < class T > inline T* KFbxGetSrc(KFbxObject const *pObject,int pIndex=0) { return pObject ? (T *) pObject->GetSrcObject(T::ClassId,pIndex) : 0; }
01262 template < class T > inline T* KFbxGetSrc(KFbxObject const *pObject,int pIndex,kFbxClassId pClassId) { return pObject ? (T *) pObject->GetSrcObject(pClassId,pIndex) : 0; }
01263 template < class T > inline T* KFbxFindSrc(KFbxObject const *pObject,char const *pName,int pIndex=0) { return pObject ? (T *) pObject->FindSrcObject(T::ClassId,pName,pIndex) : 0; }
01264 template < class T > inline T* KFbxFindSrc(KFbxObject const *pObject,char const *pName,kFbxClassId pClassId,int pIndex=0) { return pObject ? (T *) pObject->FindSrcObject(pClassId,pName,pIndex) : 0; }
01265
01266 template < class T > inline bool KFbxDisconnectAllSrc(KFbxObject *pObject,T *VC6Dummy=0) { return pObject->DisconnectAllSrcObject(T::ClassId); }
01267
01268
01269 template < class T > inline int KFbxGetDstCount(KFbxObject const *pObject, T const* VC6Dummy = 0) { return pObject ? pObject->GetDstObjectCount(T::ClassId) : 0; }
01270 template < class T > inline int KFbxGetDstCount(KFbxObject const *pObject,kFbxClassId pClassId, T const* VC6Dummy = 0) { return pObject ? pObject->GetDstObjectCount(pClassId) : 0; }
01271 template < class T > inline T* KFbxGetDst(KFbxObject const *pObject,int pIndex=0) { return pObject ? (T *) pObject->GetDstObject(T::ClassId,pIndex) : 0; }
01272 template < class T > inline T* KFbxGetDst(KFbxObject const *pObject,int pIndex,kFbxClassId pClassId) { return pObject ? (T *) pObject->GetDstObject(pClassId,pIndex) : 0; }
01273 template < class T > inline T* KFbxFindDst(KFbxObject const *pObject,char const *pName,int pIndex=0) { return pObject ? (T *) pObject->FindDstObject(T::ClassId,pName,pIndex) : 0; }
01274 template < class T > inline T* KFbxFindDst(KFbxObject const *pObject,char const *pName,kFbxClassId pClassId,int pIndex=0) { return pObject ? (T *) pObject->FindDstObject(pClassId,pName,pIndex) : 0; }
01275 template < class T > inline bool KFbxDisconnectAllDst(KFbxObject *pObject,T *VC6Dummy=0) { return pObject->DisconnectAllDstObject(T::ClassId); }
01276
01277
01278
01279
01280
01281
01285 template<typename KFbxProperty> class KFbxIterator
01286 {
01287 public:
01291 KFbxIterator(KFbxObject const *pObject) : mObject(pObject) {}
01292
01296 inline KFbxProperty const &GetFirst() { mProperty = mObject->GetFirstProperty(); return mProperty; }
01297
01301 inline KFbxProperty const &GetNext() { mProperty = mObject->GetNextProperty(mProperty); return mProperty; }
01302
01303 private:
01304 KFbxProperty mProperty;
01305 KFbxObject const* mObject;
01306 };
01307
01308 class KFbxIteratorSrcBase
01309 {
01310 protected:
01311 KFbxProperty mProperty;
01312 kFbxClassId mClassId;
01313 int mSize;
01314 int mIndex;
01315 public:
01316 inline KFbxIteratorSrcBase(KFbxProperty &pProperty,kFbxClassId pClassId) :
01317 mProperty(pProperty),
01318 mClassId(pClassId),
01319 mSize(0),
01320 mIndex(-1)
01321 {
01322 ResetToBegin();
01323 }
01324 inline KFbxIteratorSrcBase(KFbxObject* pObject,kFbxClassId pClassId) :
01325 mProperty(pObject->RootProperty),
01326 mClassId(pClassId),
01327 mSize(0),
01328 mIndex(-1)
01329 {
01330 ResetToBegin();
01331 }
01332 inline KFbxObject* GetFirst()
01333 {
01334 ResetToBegin();
01335 return GetNext();
01336 }
01337 inline KFbxObject* GetNext()
01338 {
01339 mIndex++;
01340 return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetSrcObject(mClassId,mIndex) : NULL;
01341 }
01342 inline KFbxObject* GetSafeNext()
01343 {
01344 mSize = mProperty.GetSrcObjectCount(mClassId);
01345 return GetNext();
01346 }
01347 inline KFbxObject* GetLast()
01348 {
01349 ResetToEnd();
01350 return GetPrevious();
01351 }
01352 inline KFbxObject* GetPrevious()
01353 {
01354 mIndex--;
01355 return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetSrcObject(mClassId,mIndex) : NULL;
01356 }
01357 inline KFbxObject* GetSafePrevious()
01358 {
01359 mSize = mProperty.GetSrcObjectCount(mClassId);
01360 while (mIndex>mSize) mIndex--;
01361 return GetPrevious();
01362 }
01363
01364
01365
01366 protected:
01367 inline void ResetToBegin()
01368 {
01369 mSize = mProperty.GetSrcObjectCount(mClassId);
01370 mIndex = -1;
01371 }
01372 inline void ResetToEnd()
01373 {
01374 mSize = mProperty.GetSrcObjectCount(mClassId);
01375 mIndex = mSize;
01376 }
01377 };
01378
01379 template<class Type> class KFbxIteratorSrc : protected KFbxIteratorSrcBase
01380 {
01381 public:
01382 inline KFbxIteratorSrc(KFbxObject* pObject) : KFbxIteratorSrcBase(pObject,Type::ClassId) {}
01383 inline KFbxIteratorSrc(KFbxProperty& pProperty) : KFbxIteratorSrcBase(pProperty,Type::ClassId) {}
01384 inline Type *GetFirst() { return (Type *)KFbxIteratorSrcBase::GetFirst(); }
01385 inline Type *GetNext() { return (Type *)KFbxIteratorSrcBase::GetNext(); }
01386 inline Type *GetSafeNext() { return (Type *)KFbxIteratorSrcBase::GetSafeNext(); }
01387 inline Type *GetLast() { return (Type *)KFbxIteratorSrcBase::GetLast(); }
01388 inline Type *GetPrevious() { return (Type *)KFbxIteratorSrcBase::GetPrevious(); }
01389 inline Type *GetSafePrevious() { return (Type *)KFbxIteratorSrcBase::GetSafePrevious(); }
01390
01391
01392 protected:
01393 };
01394
01395 class KFbxIteratorDstBase
01396 {
01397 protected:
01398 KFbxProperty mProperty;
01399 kFbxClassId mClassId;
01400 int mSize;
01401 int mIndex;
01402 public:
01403 inline KFbxIteratorDstBase(KFbxProperty &pProperty,kFbxClassId pClassId) :
01404 mProperty(pProperty),
01405 mClassId(pClassId),
01406 mSize(0),
01407 mIndex(-1)
01408 {
01409 ResetToBegin();
01410 }
01411 inline KFbxIteratorDstBase(KFbxObject* pObject,kFbxClassId pClassId) :
01412 mProperty(pObject->RootProperty),
01413 mClassId(pClassId),
01414 mSize(0),
01415 mIndex(-1)
01416 {
01417 ResetToBegin();
01418 }
01419 inline KFbxObject* GetFirst()
01420 {
01421 ResetToBegin();
01422 return GetNext();
01423 }
01424 inline KFbxObject* GetNext()
01425 {
01426 mIndex++;
01427 return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(mClassId,mIndex) : NULL;
01428 }
01429 inline KFbxObject* GetSafeNext()
01430 {
01431 mSize = mProperty.GetDstObjectCount(mClassId);
01432 return GetNext();
01433 }
01434 inline KFbxObject* GetLast()
01435 {
01436 ResetToEnd();
01437 return GetPrevious();
01438 }
01439 inline KFbxObject* GetPrevious()
01440 {
01441 mIndex--;
01442 return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(mClassId,mIndex) : NULL;
01443 }
01444 inline KFbxObject* GetSafePrevious()
01445 {
01446 mSize = mProperty.GetDstObjectCount(mClassId);
01447 while (mIndex>mSize) mIndex--;
01448 return GetPrevious();
01449 }
01450
01451
01452
01453 protected:
01454 inline void ResetToBegin()
01455 {
01456 mSize = mProperty.GetDstObjectCount(mClassId);
01457 mIndex = -1;
01458 }
01459 inline void ResetToEnd()
01460 {
01461 mSize = mProperty.GetDstObjectCount(mClassId);
01462 mIndex = mSize;
01463 }
01464 };
01465
01466 template<class Type> class KFbxIteratorDst : protected KFbxIteratorDstBase
01467 {
01468 public:
01469 inline KFbxIteratorDst(KFbxObject* pObject) : KFbxIteratorDstBase(pObject,Type::ClassId) {}
01470 inline KFbxIteratorDst(KFbxProperty& pProperty) : KFbxIteratorDstBase(pProperty,Type::ClassId) {}
01471 inline Type *GetFirst() { return (Type *)KFbxIteratorDstBase::GetFirst(); }
01472 inline Type *GetNext() { return (Type *)KFbxIteratorDstBase::GetNext(); }
01473 inline Type *GetSafeNext() { return (Type *)KFbxIteratorDstBase::GetSafeNext(); }
01474 inline Type *GetLast() { return (Type *)KFbxIteratorDstBase::GetLast(); }
01475 inline Type *GetPrevious() { return (Type *)KFbxIteratorDstBase::GetPrevious(); }
01476 inline Type *GetSafePrevious() { return (Type *)KFbxIteratorDstBase::GetSafePrevious(); }
01477 };
01478
01479 #define KFbxForEach(Iterator,Object) for ( (Object)=(Iterator).GetFirst(); (Object)!=0; (Object)=(Iterator).GetNext() )
01480 #define KFbxReverseForEach(Iterator,Object) for ( Object=(Iterator).GetLast(); (Object)!=0; Object=(Iterator).GetPrevious() )
01481 #define KFbxForEach_Safe(Iterator,Object) for ( Object=(Iterator).GetFirst(); (Object)!=0; Object=(Iterator).GetSafeNext() )
01482 #define KFbxReverseForEach_Safe(Iterator,Object) for ( Object=(Iterator).GetLast(); (Object)!=0; Object=(Iterator).GetSafePrevious() )
01483
01484
01485 #include <fbxfilesdk/fbxfilesdk_nsend.h>
01486
01487 #endif // FBXFILESDK_KFBXPLUGINS_KFBXOBJECT_H
01488