kfbxobject.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXOBJECT_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXOBJECT_H
00006 
00007 /**************************************************************************************
00008 
00009  Copyright (C) 2001 - 2010 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 #include <fbxfilesdk/fbxfilesdk_def.h>
00042 
00043 #include <fbxfilesdk/kfbxplugins/kfbxplug.h>
00044 #include <fbxfilesdk/kfbxplugins/kfbxproperty.h>
00045 
00046 #include <fbxfilesdk/components/kbaselib/klib/kstringlist.h>
00047 
00048 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00049 
00050 class KFbxDocument;
00051 class KFbxImplementation;
00052 class KFbxImplementationFilter;
00053 class KFbxLibrary;
00054 class KFbxMessage;
00055 class KFbxPeripheral;
00056 class KFbxStream;
00057 class UserDataRecord;
00058 
00059 enum eFbxCompare {
00060     eFbxCompareProperties
00061 };
00062 
00064 #define KFBXOBJECT_DECLARE(Class,Parent)                                                                        \
00065     KFBXPLUG_DECLARE(Class)     /* this also set public */                                                      \
00066     typedef Parent ParentClass;                                                                                 \
00067     static Class* Create(KFbxObject* pContainer,  char const* pName);                                           \
00068     virtual ~Class(){};                                                                                         \
00069 private:                                                                                                        \
00070     Class(const Class&);                                                                                        \
00071     Class& operator=(const Class&);                                                                             \
00072 
00073 
00074 #define KFBXOBJECT_DECLARE_ABSTRACT(Class,Parent)                                                               \
00075     KFBXPLUG_DECLARE_ABSTRACT(Class)    /* this also set public */                                              \
00076     typedef Parent ParentClass;                                                                                 \
00077 private:                                                                                                        \
00078     Class(const Class&);                                                                                        \
00079     Class& operator=(const Class&);                                                                             \
00080 
00081 
00082 #define KFBXOBJECT_IMPLEMENT(Class)                                                                             \
00083     KFBXPLUG_IMPLEMENT(Class)                                                                                   \
00084     Class* Class::Create(KFbxObject* pContainer, char const* pName)                                             \
00085     {                                                                                                           \
00086         if( !pContainer ) return NULL;                                                                          \
00087         Class* ClassPtr = Class::Create(pContainer->GetFbxSdkManager(), pName);                                 \
00088         pContainer->ConnectSrcObject(ClassPtr);                                                                 \
00089         return ClassPtr;                                                                                        \
00090     }                                                                                                           \
00091 
00092 
00093 #define KFBXOBJECT_IMPLEMENT_ABSTRACT(Class)                                                                    \
00094     KFBXPLUG_IMPLEMENT_ABSTRACT(Class)                                                                          \
00095 
00096 typedef size_t KFbxObjectID;
00097 typedef int kFbxUpdateId;
00098 
00099 class _KFbxObjectData;
00100 
00163 class KFBX_DLL KFbxObject : public KFbxPlug
00164 {
00165     KFBXOBJECT_DECLARE(KFbxObject, KFbxPlug);
00166 
00167 public:
00174         typedef enum
00175         {
00176             eDEEP_CLONE,        
00177             eREFERENCE_CLONE    
00178         } ECloneType;
00179 
00188         virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType=eDEEP_CLONE, KFbxObject* pContainer=NULL) const;
00189 
00193         bool IsAReferenceTo() const;
00194 
00198         KFbxObject* GetReferenceTo() const;
00199 
00203         bool IsReferencedBy() const;
00204 
00208         int GetReferencedByCount() const;
00209 
00214         KFbxObject* GetReferencedBy(int pIndex) const;
00216 
00224         void SetName(char const* pName);
00225 
00229         char const* GetName() const;
00230 
00234         KString GetNameWithoutNameSpacePrefix() const;
00235 
00239         KString GetNameWithNameSpacePrefix() const;
00240 
00244         void SetInitialName(char const* pName);
00245 
00249         char const* GetInitialName() const;
00250 
00254         KString GetNameSpaceOnly( );
00255 
00259         void SetNameSpace(KString pNameSpace);
00260 
00265         KArrayTemplate<KString*> GetNameSpaceArray( char identifier );
00266 
00270         KString GetNameOnly() const;
00271 
00275         KString GetNameSpacePrefix() const;
00276 
00281         static KString RemovePrefix(char* pName);
00282 
00287         static KString StripPrefix(KString& lName);
00288 
00293         static KString StripPrefix(const char* pName);
00294 
00296         KFbxObjectID const& GetUniqueID() const;
00298 
00307         typedef enum {
00308             eUpdateId_Object,
00309             eUpdateId_Dependency
00310         } eFbxUpdateIdType;
00311 
00316         virtual kFbxUpdateId GetUpdateId(eFbxUpdateIdType pUpdateId=eUpdateId_Object) const;
00318 
00335         int ContentUnload();
00336 
00343         int ContentLoad();
00344 
00350         bool ContentIsLoaded() const;
00351 
00355         void ContentDecrementLockCount();
00356 
00360         void ContentIncrementLockCount();
00361 
00368         bool ContentIsLocked() const;
00370 
00382         virtual bool ContentWriteTo(KFbxStream& pStream) const;
00383 
00389         virtual bool ContentReadFrom(const KFbxStream& pStream);
00391 
00399         virtual bool GetSelected();
00400 
00404         virtual void SetSelected(bool pSelected);
00406 
00414         inline KFbxProperty GetFirstProperty() const
00415         {
00416             return RootProperty.GetFirstDescendent();
00417         }
00418 
00423         inline KFbxProperty GetNextProperty(KFbxProperty const &pProperty) const
00424         {
00425             return RootProperty.GetNextDescendent(pProperty);
00426         }
00427 
00433         inline KFbxProperty FindProperty(const char* pName, bool pCaseSensitive = true)const
00434         {
00435             return RootProperty.Find(pName, pCaseSensitive );
00436         }
00437 
00444         inline KFbxProperty FindProperty(const char* pName, KFbxDataType const &pDataType, bool pCaseSensitive = true) const
00445         {
00446             return RootProperty.Find(pName, pDataType, pCaseSensitive );
00447         }
00448 
00455         inline KFbxProperty FindPropertyHierarchical(const char* pName, bool pCaseSensitive = true)const
00456         {
00457             return RootProperty.FindHierarchical(pName, pCaseSensitive );
00458         }
00459 
00467         inline KFbxProperty FindPropertyHierarchical(const char* pName, KFbxDataType const &pDataType, bool pCaseSensitive = true) const
00468         {
00469             return RootProperty.FindHierarchical(pName, pDataType, pCaseSensitive );
00470         }
00471 
00475         inline KFbxProperty& GetRootProperty() { return RootProperty; }
00476 
00480         inline const KFbxProperty& GetRootProperty()const{ return RootProperty; }
00481 
00486         KFbxProperty GetClassRootProperty();
00488 
00498         inline bool ConnectSrcObject(KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone){ return RootProperty.ConnectSrcObject(pObject,pType); }
00499 
00504         inline bool IsConnectedSrcObject(const KFbxObject* pObject) const { return RootProperty.IsConnectedSrcObject(pObject); }
00505 
00510         inline bool DisconnectSrcObject(KFbxObject* pObject){ return RootProperty.DisconnectSrcObject(pObject); }
00511 
00515         inline bool DisconnectAllSrcObject() { return RootProperty.DisconnectAllSrcObject(); }
00516 
00521         inline bool DisconnectAllSrcObject(KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllSrcObject(pCriteria); }
00522 
00527         inline bool DisconnectAllSrcObject(kFbxClassId pClassId) { return RootProperty.DisconnectAllSrcObject(pClassId); }
00528 
00534         inline bool DisconnectAllSrcObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllSrcObject(pClassId,pCriteria); }
00535 
00539         inline int GetSrcObjectCount() const { return RootProperty.GetSrcObjectCount(); }
00540 
00545         inline int GetSrcObjectCount(KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pCriteria); }
00546 
00551         inline int GetSrcObjectCount(kFbxClassId pClassId) const { return RootProperty.GetSrcObjectCount(pClassId); }
00552 
00558         inline int GetSrcObjectCount(kFbxClassId pClassId,KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pClassId,pCriteria); }
00559 
00564         inline KFbxObject* GetSrcObject(int pIndex=0) const { return RootProperty.GetSrcObject(pIndex); }
00565 
00571         inline KFbxObject* GetSrcObject(KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pCriteria,pIndex); }
00572 
00578         inline KFbxObject* GetSrcObject(kFbxClassId pClassId,int pIndex=0) const { return RootProperty.GetSrcObject(pClassId,pIndex); }
00579 
00586         inline KFbxObject* GetSrcObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pClassId,pCriteria,pIndex); }
00587 
00593         inline KFbxObject* FindSrcObject(const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pName,pStartIndex); }
00594 
00601         inline KFbxObject* FindSrcObject(KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pCriteria,pName,pStartIndex); }
00602 
00609         inline KFbxObject* FindSrcObject(kFbxClassId pClassId,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pClassId,pName,pStartIndex); }
00610 
00618         inline KFbxObject* FindSrcObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pClassId,pCriteria,pName,pStartIndex); }
00619 
00624         template <class T> inline bool DisconnectAllSrcObject(T const *pFBX_TYPE) { return RootProperty.DisconnectAllSrcObject(pFBX_TYPE); }
00625 
00631         template <class T> inline bool DisconnectAllSrcObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllSrcObject(pFBX_TYPE,pCriteria); }
00632 
00637         template <class T> inline int GetSrcObjectCount(T const *pFBX_TYPE) const { return RootProperty.GetSrcObjectCount(pFBX_TYPE); }
00638 
00644         template <class T> inline int GetSrcObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pFBX_TYPE,pCriteria); }
00645 
00651         template <class T> inline T* GetSrcObject(T const *pFBX_TYPE,int pIndex=0) const { return RootProperty.GetSrcObject(pFBX_TYPE,pIndex); }
00652 
00659         template <class T> inline T* GetSrcObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pFBX_TYPE,pCriteria,pIndex); }
00660 
00667         template <class T> inline T* FindSrcObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pFBX_TYPE,pName,pStartIndex); }
00668 
00676         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); }
00677 
00683         inline bool ConnectDstObject(KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone) { return RootProperty.ConnectDstObject(pObject,pType); }
00684 
00689         inline bool IsConnectedDstObject(const KFbxObject* pObject) const { return RootProperty.IsConnectedDstObject(pObject); }
00690 
00695         inline bool DisconnectDstObject(KFbxObject* pObject) { return RootProperty.DisconnectDstObject(pObject); }
00696 
00700         inline bool DisconnectAllDstObject() { return RootProperty.DisconnectAllDstObject(); }
00701 
00706         inline bool DisconnectAllDstObject(KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllDstObject(pCriteria); }
00707 
00712         inline bool DisconnectAllDstObject(kFbxClassId pClassId) { return RootProperty.DisconnectAllDstObject(pClassId); }
00713 
00719         inline bool DisconnectAllDstObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllDstObject(pClassId,pCriteria); }
00720 
00724         inline int GetDstObjectCount() const { return RootProperty.GetDstObjectCount(); }
00725 
00730         inline int GetDstObjectCount(KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pCriteria); }
00731 
00736         inline int GetDstObjectCount(kFbxClassId pClassId) const { return RootProperty.GetDstObjectCount(pClassId); }
00737 
00743         inline int GetDstObjectCount(kFbxClassId pClassId,KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pClassId,pCriteria); }
00744 
00749         inline KFbxObject* GetDstObject(int pIndex=0) const { return RootProperty.GetDstObject(pIndex); }
00750 
00756         inline KFbxObject* GetDstObject(KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pCriteria,pIndex); }
00757 
00763         inline KFbxObject* GetDstObject(kFbxClassId pClassId,int pIndex=0) const { return RootProperty.GetDstObject(pClassId,pIndex); }
00764 
00771         inline KFbxObject* GetDstObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pClassId,pCriteria,pIndex); }
00772 
00778         inline KFbxObject* FindDstObject(const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pName,pStartIndex); }
00779 
00786         inline KFbxObject* FindDstObject(KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pCriteria,pName,pStartIndex); }
00787 
00794         inline KFbxObject* FindDstObject(kFbxClassId pClassId,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pClassId,pName,pStartIndex); }
00795 
00803         inline KFbxObject* FindDstObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pClassId,pCriteria,pName,pStartIndex); }
00804 
00809         template <class T> inline bool DisconnectAllDstObject(T const *pFBX_TYPE) { return RootProperty.DisconnectAllDstObject(pFBX_TYPE); }
00810 
00816         template <class T> inline bool DisconnectAllDstObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllDstObject(pFBX_TYPE,pCriteria); }
00817 
00822         template <class T> inline int GetDstObjectCount(T const *pFBX_TYPE) const { return RootProperty.GetDstObjectCount(pFBX_TYPE); }
00823 
00829         template <class T> inline int GetDstObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pFBX_TYPE,pCriteria); }
00830 
00836         template <class T> inline T* GetDstObject(T const *pFBX_TYPE,int pIndex=0) const { return RootProperty.GetDstObject(pFBX_TYPE,pIndex); }
00837 
00844         template <class T> inline T* GetDstObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pFBX_TYPE,pCriteria,pIndex); }
00845 
00852         template <class T> inline T* FindDstObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pFBX_TYPE,pName,pStartIndex); }
00853 
00861         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); }
00863 
00872         inline bool ConnectSrcProperty(KFbxProperty const & pProperty) { return RootProperty.ConnectSrcProperty(pProperty); }
00873 
00878         inline bool IsConnectedSrcProperty(KFbxProperty const & pProperty) { return RootProperty.IsConnectedSrcProperty(pProperty); }
00879 
00884         inline bool DisconnectSrcProperty(KFbxProperty const & pProperty) { return RootProperty.DisconnectSrcProperty(pProperty); }
00885 
00889         inline int GetSrcPropertyCount() const { return RootProperty.GetSrcPropertyCount(); }
00890 
00895         inline KFbxProperty GetSrcProperty(int pIndex=0) const { return RootProperty.GetSrcProperty(pIndex); }
00896 
00902         inline KFbxProperty FindSrcProperty(const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcProperty(pName,pStartIndex); }
00903 
00908         inline bool ConnectDstProperty(KFbxProperty const & pProperty) { return RootProperty.ConnectDstProperty(pProperty); }
00909 
00914         inline bool IsConnectedDstProperty(KFbxProperty const & pProperty) { return RootProperty.IsConnectedDstProperty(pProperty); }
00915 
00920         inline bool DisconnectDstProperty(KFbxProperty const & pProperty) { return RootProperty.DisconnectDstProperty(pProperty); }
00921 
00925         inline int GetDstPropertyCount() const { return RootProperty.GetDstPropertyCount(); }
00926 
00931         inline KFbxProperty GetDstProperty(int pIndex=0) const { return RootProperty.GetDstProperty(pIndex); }
00932 
00938         inline KFbxProperty FindDstProperty(const char *pName,int pStartIndex=0) const { return RootProperty.FindDstProperty(pName,pStartIndex); }
00940 
00951         void SetUserDataPtr(KFbxObjectID const& pUserID, void* pUserData);
00952 
00957         void* GetUserDataPtr(KFbxObjectID const& pUserID) const;
00958 
00964         inline void SetUserDataPtr(void* pUserData){ SetUserDataPtr(GetUniqueID(), pUserData); }
00965 
00969         inline void* GetUserDataPtr() const { return GetUserDataPtr(GetUniqueID()); }
00971 
00980         KFbxDocument* GetDocument() const;
00981 
00988         KFbxDocument* GetRootDocument() const;
00989 
00994         KFbxScene* GetScene() const;
00996 
01005         void EmitMessage(KFbxMessage * pMessage) const;
01007 
01018         virtual const char* Localize(const char* pID, const char* pDefault=NULL) const;
01020 
01028         KFbxLibrary* GetParentLibrary() const;
01029 
01035         bool AddImplementation(KFbxImplementation* pImplementation);
01036 
01042         bool RemoveImplementation(KFbxImplementation* pImplementation);
01043 
01047         bool HasDefaultImplementation(void) const;
01048 
01052         KFbxImplementation* GetDefaultImplementation(void) const;
01053 
01060         bool SetDefaultImplementation(KFbxImplementation* pImplementation);
01061 
01066         int GetImplementationCount(const KFbxImplementationFilter* pCriteria=NULL) const;
01067 
01073         KFbxImplementation* GetImplementation(int pIndex, const KFbxImplementationFilter* pCriteria=NULL) const;
01075 
01084         virtual KString GetUrl() const;
01085 
01091         virtual bool SetUrl(char* pUrl);
01093 
01099     virtual KFbxObject& Copy(const KFbxObject& pObject);
01100 
01102     KFbxProperty RootProperty;
01103 
01104 protected:
01109     virtual void ContentClear();
01110 
01115     virtual KFbxPeripheral* GetPeripheral();
01116 
01118 //
01119 //  WARNING!
01120 //
01121 //  Anything beyond these lines may not be documented accurately and is
01122 //  subject to change without notice.
01123 //
01125 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01126 public:
01127     virtual bool            Compare(KFbxObject *pOtherObject,eFbxCompare pCompareMethod=eFbxCompareProperties);
01128 
01129     virtual KFbxSdkManager* GetFbxSdkManager() const;
01130     virtual kFbxClassId     GetRuntimeClassId() const;
01131 
01132     typedef enum
01133     {
01134         eNONE                   = 0x00000000,
01135         eSYSTEM_FLAG            = 0x00000001,
01136         eSAVABLE_FLAG           = 0x00000002,
01137         eHIDDEN_FLAG            = 0x00000008,
01138 
01139         eSYSTEM_FLAGS           = 0x0000ffff,
01140 
01141         eUSER_FLAGS             = 0x000f0000,
01142 
01143         // These flags are not saved to the fbx file
01144         eSYSTEM_RUNTIME_FLAGS   = 0x0ff00000,
01145 
01146         eCONTENT_LOADED_FLAG    = 0x00100000,
01147 
01148         eUSER_RUNTIME_FIRST_FLAG= 0x10000000,
01149         eUSER_RUNTIME_FLAGS     = 0xf0000000,
01150 
01151         eRUNTIME_FLAGS          = 0xfff00000
01152     } EObjectFlag;
01153 
01154     void    SetObjectFlags(EObjectFlag pFlags, bool pValue);
01155     bool    GetObjectFlags(EObjectFlag pFlags) const;
01156 
01157     // All flags replaced at once. This includes overriding the runtime flags, so
01158     // most likely you'd want to do something like this:
01159     //
01160     // SetObjectFlags(pFlags | (GetObjectFlags() & KFbxObject::eRUNTIME_FLAGS));
01161     void    SetObjectFlags(kUInt pFlags);
01162     kUInt   GetObjectFlags() const; // All flags at once, as a bitmask
01163 
01164     //Basic comparison operator implementation. It simply compare property values between source and target.
01165     //NOTE: If a property cannot be found on one of the object, the comparison fails (return false).
01166     //Different classid will fail comparison as well as different property count. Reference properties are not compared.
01167     bool    operator==(KFbxObject const& pObject);
01168     bool    operator!=(KFbxObject const& pObject);
01169 
01170     //Important note: If this function is not implemented, the pFileSubTypeName string used when registering your
01171     //class via KFbxSdkManager::RegisterFbxClass will be used instead. This makes it useless to re-implement this
01172     //function if you do not intend to return a different string for the same class.
01173     virtual const char* GetTypeName() const;
01174 
01175     virtual KStringList GetTypeFlags() const;
01176 
01177     virtual void                SetDocument(KFbxDocument* pDocument);
01178     inline KFbxObjectHandle&    GetPropertyHandle() { return RootProperty.mPropertyHandle; }
01179 
01180     // This function will go as deep as possible to clear the Connection list without sending 
01181     // notifications to the connections to give them the chance to Disconnect themselves. 
01182     // This is a bypass of the intended workflow and should be used with care.
01183     void WipeAllConnections();
01184 
01185 protected:
01186     KFbxObject(KFbxSdkManager& pManager, char const* pName);
01187 
01188     // Constructs the object. Each subclass should call the base
01189     // KFbxObject::Construct first. Note that property initialization
01190     // should be done in the ConstructProperties() method, not this one.
01191     // pFrom - The object this object should be cloned from. NULL to
01192     // construct an independent object.
01193     virtual void            Construct(const KFbxObject* pFrom);
01194 
01195     // Initialize the KFbxProperty member variables of this class.
01196     // Each subclass should call its parent, and initialize its properties
01197     // in this method.
01198     // pForceSet - Forces the property values to be set to default values.
01199     virtual bool            ConstructProperties(bool pForceSet);
01200     virtual void            Destruct(bool pRecursive, bool pDependents);
01201 
01202     bool                    Copyable(const KFbxObject& pObject);
01203 
01204     virtual bool            SetRuntimeClassId(kFbxClassId pClassId);
01205     virtual bool            ConnecNotify(KFbxConnectEvent const& pEvent);
01206     virtual kFbxUpdateId    IncUpdateId(eFbxUpdateIdType pUpdateId=eUpdateId_Object);
01207 
01208     // property callbacks
01209     typedef enum {
01210         eFbxProperty_SetRequest,
01211         eFbxProperty_Set,
01212         eFbxProperty_Get
01213     } eFbxPropertyNotify;
01214     virtual bool PropertyNotify(eFbxPropertyNotify pType, KFbxProperty* pProperty);
01215 
01216 private:
01217     void    CopyPropertiesFrom(const KFbxObject& pFrom);
01218     void    SetClassRootProperty(KFbxProperty &lProperty);
01219     int     GetFlatPropertyCount() const;
01220 
01221     _KFbxObjectData* mData;
01222 
01223     // friend classes for SDK access
01224     friend class KFbxScene;
01225     friend class KFbxProperty;
01226 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01227 };
01228 
01229 inline bool KFbxConnectSrc(KFbxObject *pDstObject,KFbxObject *pSrcObject)   { return (pSrcObject && pDstObject) ? pDstObject->ConnectSrcObject(pSrcObject) : 0; }
01230 inline bool KFbxConnectDst(KFbxObject *pSrcObject,KFbxObject *pDstObject)   { return (pSrcObject && pDstObject) ? pSrcObject->ConnectDstObject(pDstObject) : 0; }
01231 
01232 typedef KFbxObject* HKFbxObject;
01233 
01234 // template access functions SRC
01235 template < class T > inline int KFbxGetSrcCount(KFbxObject const *pObject)                                                      { return pObject ? pObject->GetSrcObjectCount(T::ClassId) : 0; }
01236 template < class T > inline int KFbxGetSrcCount(KFbxObject const *pObject,kFbxClassId pClassId)                                 { return pObject ? pObject->GetSrcObjectCount(pClassId) : 0;     }
01237 template < class T > inline T* KFbxGetSrc(KFbxObject const *pObject,int pIndex=0)                                               { return pObject ? (T *) pObject->GetSrcObject(T::ClassId,pIndex) : 0; }
01238 template < class T > inline T* KFbxGetSrc(KFbxObject const *pObject,int pIndex,kFbxClassId pClassId)                            { return pObject ? (T *) pObject->GetSrcObject(pClassId,pIndex) : 0;    }
01239 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;   }
01240 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; }
01241 
01242 template < class T > inline bool KFbxDisconnectAllSrc(KFbxObject *pObject)                                                      { return pObject->DisconnectAllSrcObject(T::ClassId);   }
01243 
01244 // template access functions DST
01245 template < class T > inline int KFbxGetDstCount(KFbxObject const *pObject)                                                      { return pObject ? pObject->GetDstObjectCount(T::ClassId) : 0; }
01246 template < class T > inline int KFbxGetDstCount(KFbxObject const *pObject,kFbxClassId pClassId)                                 { return pObject ? pObject->GetDstObjectCount(pClassId) : 0;     }
01247 template < class T > inline T* KFbxGetDst(KFbxObject const *pObject,int pIndex=0)                                               { return pObject ? (T *) pObject->GetDstObject(T::ClassId,pIndex) : 0; }
01248 template < class T > inline T* KFbxGetDst(KFbxObject const *pObject,int pIndex,kFbxClassId pClassId)                            { return pObject ? (T *) pObject->GetDstObject(pClassId,pIndex) : 0;    }
01249 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;   }
01250 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; }
01251 template < class T > inline bool KFbxDisconnectAllDst(KFbxObject *pObject)                                                      { return pObject->DisconnectAllDstObject(T::ClassId);   }
01252 
01253 
01254 /**********************************************************************
01255 * Object Iterator
01256 **********************************************************************/
01257 
01261 template<typename KFbxProperty> class KFbxIterator
01262 {
01263     public:
01267         KFbxIterator(KFbxObject const *pObject) : mObject(pObject) {}
01268 
01272         inline KFbxProperty const &GetFirst() { mProperty = mObject->GetFirstProperty(); return mProperty; }
01273 
01277         inline KFbxProperty const &GetNext() { mProperty = mObject->GetNextProperty(mProperty); return mProperty; }
01278 
01279     private:
01280         KFbxProperty        mProperty;
01281         KFbxObject const*   mObject;
01282 };
01283 
01284 class KFbxIteratorSrcBase
01285 {
01286 protected:
01287     KFbxProperty    mProperty;
01288     kFbxClassId     mClassId;
01289     int             mSize;
01290     int             mIndex;
01291 public:
01292     inline KFbxIteratorSrcBase(KFbxProperty &pProperty,kFbxClassId pClassId) :
01293         mProperty(pProperty),
01294         mClassId(pClassId),
01295         mSize(0),
01296         mIndex(-1)
01297     {
01298         ResetToBegin();
01299     }
01300     inline KFbxIteratorSrcBase(KFbxObject* pObject,kFbxClassId pClassId) :
01301         mProperty(pObject->RootProperty),
01302         mClassId(pClassId),
01303         mSize(0),
01304         mIndex(-1)
01305     {
01306         ResetToBegin();
01307     }
01308     inline KFbxObject* GetFirst()
01309     {
01310         ResetToBegin();
01311         return GetNext();
01312     }
01313     inline KFbxObject* GetNext()
01314     {
01315         mIndex++;
01316         return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetSrcObject(mClassId,mIndex) : NULL;
01317     }
01318     inline KFbxObject* GetSafeNext()
01319     {
01320         mSize = mProperty.GetSrcObjectCount(mClassId);
01321         return GetNext();
01322     }
01323     inline KFbxObject* GetLast()
01324     {
01325         ResetToEnd();
01326         return GetPrevious();
01327     }
01328     inline KFbxObject* GetPrevious()
01329     {
01330         mIndex--;
01331         return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetSrcObject(mClassId,mIndex) : NULL;
01332     }
01333     inline KFbxObject* GetSafePrevious()
01334     {
01335         mSize = mProperty.GetSrcObjectCount(mClassId);
01336         while (mIndex>mSize) mIndex--;
01337         return GetPrevious();
01338     }
01339 
01340 
01341 // Internal Access Function
01342 protected:
01343     inline void ResetToBegin()
01344     {
01345         mSize = mProperty.GetSrcObjectCount(mClassId);
01346         mIndex = -1;
01347     }
01348     inline void ResetToEnd()
01349     {
01350         mSize = mProperty.GetSrcObjectCount(mClassId);
01351         mIndex = mSize;
01352     }
01353 };
01354 
01355 template<class Type> class KFbxIteratorSrc : protected KFbxIteratorSrcBase
01356 {
01357 public:
01358     inline KFbxIteratorSrc(KFbxObject* pObject) : KFbxIteratorSrcBase(pObject,Type::ClassId) {}
01359     inline KFbxIteratorSrc(KFbxProperty& pProperty) : KFbxIteratorSrcBase(pProperty,Type::ClassId) {}
01360     inline Type *GetFirst()         { return (Type *)KFbxIteratorSrcBase::GetFirst(); }
01361     inline Type *GetNext()          { return (Type *)KFbxIteratorSrcBase::GetNext(); }
01362     inline Type *GetSafeNext()      { return (Type *)KFbxIteratorSrcBase::GetSafeNext(); }
01363     inline Type *GetLast()          { return (Type *)KFbxIteratorSrcBase::GetLast(); }
01364     inline Type *GetPrevious()      { return (Type *)KFbxIteratorSrcBase::GetPrevious(); }
01365     inline Type *GetSafePrevious()  { return (Type *)KFbxIteratorSrcBase::GetSafePrevious(); }
01366 
01367 // Internal Access Function
01368 protected:
01369 };
01370 
01371 class KFbxIteratorDstBase
01372 {
01373 protected:
01374     KFbxProperty    mProperty;
01375     kFbxClassId     mClassId;
01376     int             mSize;
01377     int             mIndex;
01378 public:
01379     inline KFbxIteratorDstBase(KFbxProperty &pProperty,kFbxClassId pClassId) :
01380         mProperty(pProperty),
01381         mClassId(pClassId),
01382         mSize(0),
01383         mIndex(-1)
01384     {
01385         ResetToBegin();
01386     }
01387     inline KFbxIteratorDstBase(KFbxObject* pObject,kFbxClassId pClassId) :
01388         mProperty(pObject->RootProperty),
01389         mClassId(pClassId),
01390         mSize(0),
01391         mIndex(-1)
01392     {
01393         ResetToBegin();
01394     }
01395     inline KFbxObject* GetFirst()
01396     {
01397         ResetToBegin();
01398         return GetNext();
01399     }
01400     inline KFbxObject* GetNext()
01401     {
01402         mIndex++;
01403         return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(mClassId,mIndex) : NULL;
01404     }
01405     inline KFbxObject* GetSafeNext()
01406     {
01407         mSize = mProperty.GetDstObjectCount(mClassId);
01408         return GetNext();
01409     }
01410     inline KFbxObject* GetLast()
01411     {
01412         ResetToEnd();
01413         return GetPrevious();
01414     }
01415     inline KFbxObject* GetPrevious()
01416     {
01417         mIndex--;
01418         return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(mClassId,mIndex) : NULL;
01419     }
01420     inline KFbxObject* GetSafePrevious()
01421     {
01422         mSize = mProperty.GetDstObjectCount(mClassId);
01423         while (mIndex>mSize) mIndex--;
01424         return GetPrevious();
01425     }
01426 
01427 
01428 // Internal Access Function
01429 protected:
01430     inline void ResetToBegin()
01431     {
01432         mSize = mProperty.GetDstObjectCount(mClassId);
01433         mIndex = -1;
01434     }
01435     inline void ResetToEnd()
01436     {
01437         mSize = mProperty.GetDstObjectCount(mClassId);
01438         mIndex = mSize;
01439     }
01440 };
01441 
01442 template<class Type> class KFbxIteratorDst : protected KFbxIteratorDstBase
01443 {
01444 public:
01445     inline KFbxIteratorDst(KFbxObject* pObject) : KFbxIteratorDstBase(pObject,Type::ClassId) {}
01446     inline KFbxIteratorDst(KFbxProperty& pProperty) : KFbxIteratorDstBase(pProperty,Type::ClassId) {}
01447     inline Type *GetFirst()         { return (Type *)KFbxIteratorDstBase::GetFirst(); }
01448     inline Type *GetNext()          { return (Type *)KFbxIteratorDstBase::GetNext(); }
01449     inline Type *GetSafeNext()      { return (Type *)KFbxIteratorDstBase::GetSafeNext(); }
01450     inline Type *GetLast()          { return (Type *)KFbxIteratorDstBase::GetLast(); }
01451     inline Type *GetPrevious()      { return (Type *)KFbxIteratorDstBase::GetPrevious(); }
01452     inline Type *GetSafePrevious()  { return (Type *)KFbxIteratorDstBase::GetSafePrevious(); }
01453 };
01454 
01455 #define KFbxForEach(Iterator,Object) for ( (Object)=(Iterator).GetFirst(); (Object)!=0; (Object)=(Iterator).GetNext() )
01456 #define KFbxReverseForEach(Iterator,Object) for ( Object=(Iterator).GetLast(); (Object)!=0;  Object=(Iterator).GetPrevious() )
01457 #define KFbxForEach_Safe(Iterator,Object) for ( Object=(Iterator).GetFirst(); (Object)!=0; Object=(Iterator).GetSafeNext() )
01458 #define KFbxReverseForEach_Safe(Iterator,Object) for ( Object=(Iterator).GetLast(); (Object)!=0;  Object=(Iterator).GetSafePrevious() )
01459 
01461 //
01462 //  WARNING!
01463 //
01464 //  Anything beyond these lines may not be documented accurately and is
01465 //  subject to change without notice.
01466 //
01468 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01469 class KFbxObjectPropertyChanged : public kfbxevents::KFbxEvent<KFbxObjectPropertyChanged>
01470 {
01471     KFBXEVENT_DECLARE(KFbxObjectPropertyChanged);
01472 
01473 public:
01474     KFbxObjectPropertyChanged(KFbxProperty pProp) : mProp(pProp) {}
01475     KFbxProperty mProp;
01476 };
01477 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
01478 
01479 #include <fbxfilesdk/fbxfilesdk_nsend.h>
01480 
01481 #endif // FBXFILESDK_KFBXPLUGINS_KFBXOBJECT_H
01482