FBX SDK Reference Guide: kfbxobject.h Source File
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 © 2001 - 2008 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/components/kbaselib/kaydaradef_h.h>
00042 #include <fbxfilesdk/components/kbaselib/kaydara.h>
00043 
00044 // FBX includes
00045 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00046 #include <fbxfilesdk/components/kbaselib/klib/kstringlist.h>
00047 #include <fbxfilesdk/components/kbaselib/klib/kname.h>
00048 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00049 #include <fbxfilesdk/components/kbaselib/klib/kscopedptr.h>
00050 #include <fbxfilesdk/kfbxplugins/kfbxplug.h>
00051 #include <fbxfilesdk/kfbxplugins/kfbxproperty.h>
00052 #include <fbxfilesdk/kfbxevents/kfbxevents.h>
00053 
00054 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00055 
00056 // FBX namespace
00057 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00058 
00059     class KFbxSdkManager;
00060     class KFbxDocument;
00061     class KFbxScene;
00062     class KFbxObject_internal;
00063     class KFbxProperty_internal;
00064     class KFbxTakeNodeContainer;
00065     class KFbxTakeNode;
00066     class UserDataRecord;
00067     class KFbxImplementation;
00068     class KFbxImplementationFilter;
00069     class KFbxLibrary;
00070     class KFbxStream;
00071     class KFbxPeripheral;
00072     class KFbxObject;
00073     class KFbxMessage;
00074 
00076     class KFbxObjectPropertyChanged : public kfbxevents::KFbxEvent<KFbxObjectPropertyChanged>
00077     {
00078     public:
00079        KFBXEVENT_DECLARE(KFbxObjectPropertyChanged)
00080 
00081     public:
00082         KFbxObjectPropertyChanged(KFbxProperty pProp):mProp(pProp){}
00083         KFbxProperty mProp;
00084     };
00086 
00087     enum eFbxCompare {
00088         eFbxCompareProperties
00089     };
00090 
00091     #define KFBXOBJECT_DECLARE(Class,Parent) \
00092     private: \
00093         KFBXPLUG_DECLARE(Class) \
00094         typedef Parent ParentClass;\
00095         static Class* Create(KFbxObject *pContainer,  char const *pName); \
00096         static Class* CreateForClone( KFbxSdkManager *pManager, char const *pName, const Class* pFrom ); \
00097     public: \
00098         Class*  TypedClone(KFbxObject* pContainer = NULL, KFbxObject::ECloneType pCloneType = eDEEP_CLONE) const; \
00099         virtual bool Compare(KFbxObject *pOtherObject,eFbxCompare pCompareMethod=eFbxCompareProperties);\
00100 
00101     #define KFBXOBJECT_DECLARE_ABSTRACT(Class,Parent) \
00102     private: \
00103         KFBXPLUG_DECLARE_ABSTRACT(Class) \
00104         typedef Parent ParentClass; \
00105 
00106     #define KFBXOBJECT_IMPLEMENT(Class) \
00107         KFBXPLUG_IMPLEMENT(Class) \
00108         Class* Class::Create(KFbxObject *pContainer, char const *pName) \
00109         {                                                                   \
00110           Class* ClassPtr=Class::Create(pContainer->GetFbxSdkManager(),pName); \
00111             pContainer->ConnectSrcObject(ClassPtr);                         \
00112             return ClassPtr;                                                \
00113         } \
00114         Class* Class::TypedClone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const \
00115         { \
00116             KFbxObject* lObjClone = Clone(pContainer, pCloneType); \
00117             if (lObjClone == NULL) \
00118             { \
00119                 return NULL; \
00120             } \
00121             Class* lTypedClone = KFbxCast<Class>(lObjClone); \
00122             if (lTypedClone == NULL) \
00123             { \
00124                 lObjClone->Destroy(); \
00125             } \
00126             return lTypedClone; \
00127         }   \
00128         Class* Class::CreateForClone(KFbxSdkManager *pManager, char const *pName, const Class* pFrom )  \
00129         {   \
00130             return (Class *)pManager->CreateClassFrom(Class::ClassId, pName, pFrom); \
00131         }
00132 
00133     #define KFBXOBJECT_IMPLEMENT_ABSTRACT(Class) \
00134         KFBXPLUG_IMPLEMENT_ABSTRACT(Class) \
00135 
00136     typedef size_t KFbxObjectID;
00137 
00138     class _KFbxObjectData;
00139 
00140     typedef int kFbxUpdateId;
00141 
00145     class KFBX_DLL KFbxObject : public KFbxPlug
00146     {
00147         public:
00148 
00151             typedef enum
00152             {
00153                 eSURFACE_CLONE,     
00154                 eREFERENCE_CLONE,   
00155                 eDEEP_CLONE         
00156             } ECloneType;
00157 
00158             KFBXOBJECT_DECLARE(KFbxObject,KFbxPlug);
00159 
00164         public:
00165             // Clone
00166 
00172             virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00173 
00177             bool        IsAReferenceTo(void) const;
00178 
00183             KFbxObject* GetReferenceTo(void) const;
00184 
00188             bool        IsReferencedBy(void) const;
00189 
00193             int         GetReferencedByCount(void) const;
00194 
00199             KFbxObject* GetReferencedBy(int pIndex) const;
00200 
00201         protected:
00202             //KFbxObject*   SetReferenceTo(KFbxObject* pRef);
00204 
00208         public:
00209 
00213             void SetName(char const* pName);
00214 
00218             char const* GetName() const;
00219 
00223             KString GetNameWithoutNameSpacePrefix() const;
00224 
00228             KString GetNameWithNameSpacePrefix() const;
00229 
00233             void SetInitialName(char const* pName);
00234 
00238             char const* GetInitialName() const;
00239 
00243             KString GetNameSpaceOnly( );
00244 
00249             void SetNameSpace(KString pNameSpace);
00250 
00255             KArrayTemplate<KString*> GetNameSpaceArray( char identifier );
00256 
00260             KString GetNameOnly() const;
00261 
00265             KString GetNameSpacePrefix() const;
00266 
00271             static KString RemovePrefix(char* pName);
00272 
00277             static KString StripPrefix(KString& lName);
00278 
00283             static KString StripPrefix(const char* pName);
00284 
00286             KFbxObjectID const& GetUniqueID() const;
00288 
00293         public:
00294             typedef enum {
00295                 eUpdateId_Object,
00296                 eUpdateId_Dependency
00297             } eFbxUpdateIdType;
00298 
00299             virtual kFbxUpdateId GetUpdateId(eFbxUpdateIdType pUpdateId=eUpdateId_Object) const;
00300         protected:
00301             virtual kFbxUpdateId IncUpdateId(eFbxUpdateIdType pUpdateId=eUpdateId_Object);
00302 
00303 
00305 
00313         public:
00324             int ContentUnload();
00325 
00332             int ContentLoad();
00333 
00338             bool ContentIsLoaded() const;
00339 
00343             void ContentDecrementLockCount();
00344 
00348             void ContentIncrementLockCount();
00349 
00355             bool ContentIsLocked() const;
00356 
00357 
00358         protected:
00363             virtual void ContentClear();
00364 
00369             virtual KFbxPeripheral* GetPeripheral();
00371         public:
00383             virtual bool ContentWriteTo(KFbxStream& pStream) const;
00384 
00390             virtual bool ContentReadFrom(const KFbxStream& pStream);
00392 
00397         public:
00398             virtual bool GetSelected();
00399             virtual void SetSelected(bool pSelected);
00401 
00406             virtual bool Evaluate(KFbxProperty & pProperty,KFbxEvaluationInfo const *pEvaluationInfo);
00408 
00409 
00414         public:
00415             inline KFbxProperty GetFirstProperty() const
00416             {
00417                 return RootProperty.GetFirstDescendent();
00418             }
00419 
00420             inline KFbxProperty GetNextProperty(KFbxProperty const &pProperty) const
00421             {
00422                 return RootProperty.GetNextDescendent(pProperty);
00423             }
00424 
00431             inline KFbxProperty FindProperty(const char* pName, bool pCaseSensitive = true)const
00432             {
00433                 return RootProperty.Find(pName, pCaseSensitive );
00434             }
00435 
00436             inline KFbxProperty FindProperty(const char* pName, KFbxDataType const &pDataType, bool pCaseSensitive = true) const
00437             {
00438                 return RootProperty.Find(pName, pDataType, pCaseSensitive );
00439             }
00440 
00441             inline KFbxProperty FindPropertyHierarchical(const char* pName, bool pCaseSensitive = true)const
00442             {
00443                 return RootProperty.FindHierarchical(pName, pCaseSensitive );
00444             }
00445 
00446             inline KFbxProperty FindPropertyHierarchical(const char* pName, KFbxDataType const &pDataType, bool pCaseSensitive = true) const
00447             {
00448                 return RootProperty.FindHierarchical(pName, pDataType, pCaseSensitive );
00449             }
00450 
00451             inline KFbxProperty &GetRootProperty() { return RootProperty; }
00452             inline const KFbxProperty& GetRootProperty()const{ return RootProperty; }
00453 
00454             KFbxProperty GetClassRootProperty();
00455 
00456         public:
00457             KFbxProperty RootProperty;
00458 
00459         private:
00460             void SetClassRootProperty(KFbxProperty &lProperty);
00461 
00462         // property callbacks
00463         protected:
00464             typedef enum {
00465                 eFbxProperty_SetRequest,
00466                 eFbxProperty_Set,
00467                 eFbxProperty_Get
00468             } eFbxPropertyNotify;
00469             virtual bool PropertyNotify(eFbxPropertyNotify pType, KFbxProperty* pProperty);
00471 
00476 
00477 
00482         public:
00483             // SrcObjects
00484             inline bool ConnectSrcObject        (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone)   { return RootProperty.ConnectSrcObject(pObject,pType); }
00485             inline bool IsConnectedSrcObject    (const KFbxObject* pObject) const { return RootProperty.IsConnectedSrcObject  (pObject); }
00486             inline bool DisconnectSrcObject (KFbxObject* pObject)       { return RootProperty.DisconnectSrcObject(pObject); }
00487 
00488             inline bool DisconnectAllSrcObject() { return RootProperty.DisconnectAllSrcObject(); }
00489             inline bool DisconnectAllSrcObject(KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllSrcObject(pCriteria); }
00490             inline bool DisconnectAllSrcObject(kFbxClassId pClassId) { return RootProperty.DisconnectAllSrcObject(pClassId); }
00491             inline bool DisconnectAllSrcObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllSrcObject(pClassId,pCriteria); }
00492 
00493             inline int GetSrcObjectCount    () const { return RootProperty.GetSrcObjectCount(); }
00494             inline int GetSrcObjectCount    (KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pCriteria); }
00495             inline int GetSrcObjectCount    (kFbxClassId pClassId) const { return RootProperty.GetSrcObjectCount(pClassId); }
00496             inline int GetSrcObjectCount    (kFbxClassId pClassId,KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pClassId,pCriteria); }
00497 
00498             inline KFbxObject*  GetSrcObject (int pIndex=0) const { return RootProperty.GetSrcObject(pIndex); }
00499             inline KFbxObject*  GetSrcObject (KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pCriteria,pIndex); }
00500             inline KFbxObject*  GetSrcObject (kFbxClassId pClassId,int pIndex=0) const { return RootProperty.GetSrcObject(pClassId,pIndex); }
00501             inline KFbxObject*  GetSrcObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pClassId,pCriteria,pIndex); }
00502 
00503             inline KFbxObject*  FindSrcObject (const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pName,pStartIndex); }
00504             inline KFbxObject*  FindSrcObject (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pCriteria,pName,pStartIndex); }
00505             inline KFbxObject*  FindSrcObject (kFbxClassId pClassId,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pClassId,pName,pStartIndex); }
00506             inline KFbxObject*  FindSrcObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pClassId,pCriteria,pName,pStartIndex); }
00507 
00508             template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE) { return RootProperty.DisconnectAllSrcObject(pFBX_TYPE);   }
00509             template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria)  { return RootProperty.DisconnectAllSrcObject(pFBX_TYPE,pCriteria);  }
00510             template < class T > inline int  GetSrcObjectCount(T const *pFBX_TYPE) const { return RootProperty.GetSrcObjectCount(pFBX_TYPE);    }
00511             template < class T > inline int  GetSrcObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pFBX_TYPE,pCriteria);    }
00512             template < class T > inline T*   GetSrcObject(T const *pFBX_TYPE,int pIndex=0) const { return RootProperty.GetSrcObject(pFBX_TYPE,pIndex);  }
00513             template < class T > inline T*   GetSrcObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pFBX_TYPE,pCriteria,pIndex);  }
00514             template < class T > inline T*   FindSrcObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pFBX_TYPE,pName,pStartIndex);  }
00515             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);  }
00516 
00517             // DstObjects
00518             inline bool ConnectDstObject        (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone)   { return RootProperty.ConnectDstObject(pObject,pType); }
00519             inline bool IsConnectedDstObject    (const KFbxObject* pObject) const { return RootProperty.IsConnectedDstObject  (pObject); }
00520             inline bool DisconnectDstObject (KFbxObject* pObject)       { return RootProperty.DisconnectDstObject(pObject); }
00521 
00522             inline bool DisconnectAllDstObject() { return RootProperty.DisconnectAllDstObject(); }
00523             inline bool DisconnectAllDstObject(KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllDstObject(pCriteria); }
00524             inline bool DisconnectAllDstObject(kFbxClassId pClassId) { return RootProperty.DisconnectAllDstObject(pClassId); }
00525             inline bool DisconnectAllDstObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllDstObject(pClassId,pCriteria); }
00526 
00527             inline int GetDstObjectCount    () const { return RootProperty.GetDstObjectCount(); }
00528             inline int GetDstObjectCount    (KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pCriteria); }
00529             inline int GetDstObjectCount    (kFbxClassId pClassId) const { return RootProperty.GetDstObjectCount(pClassId); }
00530             inline int GetDstObjectCount    (kFbxClassId pClassId,KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pClassId,pCriteria); }
00531 
00532             inline KFbxObject*  GetDstObject (int pIndex=0) const { return RootProperty.GetDstObject(pIndex); }
00533             inline KFbxObject*  GetDstObject (KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pCriteria,pIndex); }
00534             inline KFbxObject*  GetDstObject (kFbxClassId pClassId,int pIndex=0) const { return RootProperty.GetDstObject(pClassId,pIndex); }
00535             inline KFbxObject*  GetDstObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pClassId,pCriteria,pIndex); }
00536 
00537             inline KFbxObject*  FindDstObject (const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pName,pStartIndex); }
00538             inline KFbxObject*  FindDstObject (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pCriteria,pName,pStartIndex); }
00539             inline KFbxObject*  FindDstObject (kFbxClassId pClassId,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pClassId,pName,pStartIndex); }
00540             inline KFbxObject*  FindDstObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pClassId,pCriteria,pName,pStartIndex); }
00541 
00542             template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE) { return RootProperty.DisconnectAllDstObject(pFBX_TYPE);   }
00543             template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria)  { return RootProperty.DisconnectAllDstObject(pFBX_TYPE,pCriteria);  }
00544             template < class T > inline int  GetDstObjectCount(T const *pFBX_TYPE) const { return RootProperty.GetDstObjectCount(pFBX_TYPE);    }
00545             template < class T > inline int  GetDstObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pFBX_TYPE,pCriteria);    }
00546             template < class T > inline T*   GetDstObject(T const *pFBX_TYPE,int pIndex=0) const { return RootProperty.GetDstObject(pFBX_TYPE,pIndex);  }
00547             template < class T > inline T*   GetDstObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pFBX_TYPE,pCriteria,pIndex);  }
00548             template < class T > inline T*   FindDstObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pFBX_TYPE,pName,pStartIndex);  }
00549             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);  }
00551 
00552         // Optimized routine
00553         KFbxProperty FindProperty(const char* pName, int pStartIndex, int pSearchDomain) const;
00554 
00559             // Properties
00560             inline bool         ConnectSrcProperty      (KFbxProperty const & pProperty) { return RootProperty.ConnectSrcProperty(pProperty); }
00561             inline bool         IsConnectedSrcProperty  (KFbxProperty const & pProperty) { return RootProperty.IsConnectedSrcProperty(pProperty); }
00562             inline bool         DisconnectSrcProperty   (KFbxProperty const & pProperty) { return RootProperty.DisconnectSrcProperty(pProperty); }
00563             inline int          GetSrcPropertyCount     () const { return RootProperty.GetSrcPropertyCount(); }
00564             inline KFbxProperty GetSrcProperty          (int pIndex=0) const { return RootProperty.GetSrcProperty(pIndex); }
00565             inline KFbxProperty FindSrcProperty         (const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcProperty(pName,pStartIndex); }
00566 
00567             inline bool         ConnectDstProperty      (KFbxProperty const & pProperty) { return RootProperty.ConnectDstProperty(pProperty); }
00568             inline bool         IsConnectedDstProperty  (KFbxProperty const & pProperty) { return RootProperty.IsConnectedDstProperty(pProperty); }
00569             inline bool         DisconnectDstProperty   (KFbxProperty const & pProperty) { return RootProperty.DisconnectDstProperty(pProperty); }
00570             inline int          GetDstPropertyCount     () const { return RootProperty.GetDstPropertyCount(); }
00571             inline KFbxProperty GetDstProperty          (int pIndex=0) const { return RootProperty.GetDstProperty(pIndex); }
00572             inline KFbxProperty FindDstProperty         (const char *pName,int pStartIndex=0) const { return RootProperty.FindDstProperty(pName,pStartIndex); }
00574 
00579             void        SetUserDataPtr(KFbxObjectID const& pUserID, void* pUserData);
00580             void*       GetUserDataPtr(KFbxObjectID const& pUserID) const;
00581 
00582             inline void SetUserDataPtr(void* pUserData)     { SetUserDataPtr( GetUniqueID(), pUserData ); }
00583             inline void* GetUserDataPtr() const             { return GetUserDataPtr( GetUniqueID() ); }
00585 
00586 
00595             KFbxDocument* GetDocument() const;
00596 
00601             KFbxDocument* GetRootDocument() const;
00602 
00607             KFbxScene* GetScene() const;
00609 
00610 
00618             void EmitMessage(KFbxMessage * pMessage) const;
00620 
00631             virtual const char * Localize( const char * pID, const char * pDefault = NULL ) const;
00633 
00638 
00639             KFbxLibrary* GetParentLibrary(void) const;
00640 
00650             bool AddImplementation(KFbxImplementation* pImplementation);
00651 
00661             bool RemoveImplementation(KFbxImplementation* pImplementation);
00662 
00664             bool HasDefaultImplementation(void) const;
00665 
00667             KFbxImplementation* GetDefaultImplementation(void) const;
00668 
00678             bool SetDefaultImplementation(KFbxImplementation* pImplementation);
00679 
00687             int GetImplementationCount(
00688                 const KFbxImplementationFilter* pCriteria = NULL
00689             ) const;
00690 
00699             KFbxImplementation* GetImplementation(
00700                 int                             pIndex,
00701                 const KFbxImplementationFilter* pCriteria = NULL
00702             ) const;
00704 
00709         public:
00710             virtual KString GetUrl() const;
00711             virtual bool    SetUrl(char *pUrl);
00712             virtual bool    PopulateLoadSettings(KFbxObject *pSettings,char *pFileName=0);
00713             virtual bool    Load(char *pFileName=0);
00714             virtual bool    PopulateSaveSettings(KFbxObject *pSettings,char *pFileName=0);
00715             virtual bool    Save(char *pFileName=0);
00717 
00719     //
00720     //  WARNING!
00721     //
00722     //  Anything beyond these lines may not be documented accurately and is
00723     //  subject to change without notice.
00724     //
00726 
00727     #ifndef DOXYGEN_SHOULD_SKIP_THIS
00728 
00729     protected:
00730         KFbxObject(KFbxSdkManager& pManager, char const* pName);
00731         virtual ~KFbxObject();
00732 
00733         // Constructs the object. Each subclass should call the base
00734         // KFbxObject::Construct first. Note that property initialization
00735         // should be done in the ConstructProperties() method, not this one.
00736         // pFrom - The object this object should be cloned from. NULL to
00737         // construct an independent object.
00738         virtual void Construct(const KFbxObject* pFrom);
00739 
00740         // Initialize the KFbxProperty member variables of this class.
00741         // Each subclass should call its parent, and initialize its properties
00742         // in this method.
00743         // pForceSet - Forces the property values to be set to default values.
00744         virtual bool ConstructProperties(bool pForceSet);
00745         virtual void Destruct(bool pRecursive, bool pDependents);
00746 
00747     public:
00748         virtual KFbxSdkManager* GetFbxSdkManager() const;
00749         virtual kFbxClassId     GetRuntimeClassId() const;
00750 
00751         typedef enum
00752         {
00753             eNONE                   = 0x00000000,
00754             eSYSTEM_FLAG            = 0x00000001,
00755             eSAVABLE_FLAG           = 0x00000002,
00756             eHIDDEN_FLAG            = 0x00000008,
00757 
00758             eSYSTEM_FLAGS           = 0x0000ffff,
00759 
00760             eUSER_FLAGS             = 0x000f0000,
00761 
00762             // These flags are not saved to the fbx file
00763             eSYSTEM_RUNTIME_FLAGS   = 0x0ff00000,
00764 
00765             eCONTENT_LOADED_FLAG    = 0x00100000,
00766 
00767             eUSER_RUNTIME_FIRST_FLAG= 0x10000000,
00768             eUSER_RUNTIME_FLAGS     = 0xf0000000,
00769 
00770             eRUNTIME_FLAGS          = 0xfff00000
00771         } EObjectFlag;
00772 
00773         void                    SetObjectFlags(EObjectFlag pFlags, bool pValue);
00774         bool                    GetObjectFlags(EObjectFlag pFlags) const;
00775 
00776         // All flags replaced at once. This includes overriding the runtime flags, so
00777         // most likely you'd want to do something like this:
00778         //
00779         // SetObjectFlags(pFlags | (GetObjectFlags() & KFbxObject::eRUNTIME_FLAGS));
00780         void                    SetObjectFlags(kUInt pFlags);
00781         kUInt                   GetObjectFlags() const; // All flags at once, as a bitmask
00782 
00783     protected:
00784         virtual KFbxTakeNodeContainer* GetTakeNodeContainer();
00785 
00786         KFbxObject& operator=(KFbxObject const& pObject);
00787 
00788         // Currently not called from operator=; you must call it yourself if you
00789         // want properties to be copied.  Most likely it will be called automatically
00790         // by operator=(), at which point this method may become private.
00791         // At the very least it should be renamed to spot everyone that's currently
00792         // using it in their operator=, since it would then become irrelevant (and slow)
00793         void CopyPropertiesFrom(const KFbxObject& pFrom);
00794 
00795         virtual bool            SetRuntimeClassId(kFbxClassId pClassId);
00796         virtual                 bool ConnecNotify (KFbxConnectEvent const &pEvent);
00797 
00798     public:
00799         virtual KString         GetTypeName() const;
00800         virtual KStringList     GetTypeFlags() const;
00801 
00802     protected:
00803         virtual void            PropertyAdded(KFbxProperty* pProperty);
00804         virtual void            PropertyRemoved(KFbxProperty* pProperty);
00805 
00806         // Animation Management
00807         virtual void            AddChannels(KFbxTakeNode *pTakeNode);
00808         virtual void            UpdateChannelFromProperties(KFbxTakeNode *pTakeNode);
00809 
00810     public:
00811         virtual void            SetDocument(KFbxDocument* pDocument);
00812 
00813         inline KFbxObjectHandle &GetPropertyHandle() { return RootProperty.mPropertyHandle; }
00814 
00815     private:
00816         KScopedPtr<_KFbxObjectData> mData;
00817 
00818         // friend classes for sdk access
00819         friend class KFbxScene;
00820         friend class KFbxObject_internal;
00821         friend class KFbxProperty;
00822     #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00823 
00824     };
00825 
00826     // need to be declared here instead or we get an INTERNAL COMPILER ERROR with VC6
00827     inline bool KFbxConnectSrc(KFbxObject *pDstObject,KFbxObject *pSrcObject)   { return (pSrcObject && pDstObject) ? pDstObject->ConnectSrcObject(pSrcObject) : 0; }
00828     inline bool KFbxConnectDst(KFbxObject *pSrcObject,KFbxObject *pDstObject)   { return (pSrcObject && pDstObject) ? pSrcObject->ConnectDstObject(pDstObject) : 0; }
00829 
00830     typedef KFbxObject* HKFbxObject;
00831 
00832     // template access functions SRC
00833     template < class T > inline int KFbxGetSrcCount(KFbxObject const *pObject, T const* VC6Dummy = 0)                               { return pObject ? pObject->GetSrcObjectCount(T::ClassId) : 0; }
00834     template < class T > inline int KFbxGetSrcCount(KFbxObject const *pObject,kFbxClassId pClassId, T const* VC6Dummy = 0)          { return pObject ? pObject->GetSrcObjectCount(pClassId) : 0;     }
00835     template < class T > inline T* KFbxGetSrc(KFbxObject const *pObject,int pIndex=0)                                               { return pObject ? (T *) pObject->GetSrcObject(T::ClassId,pIndex) : 0; }
00836     template < class T > inline T* KFbxGetSrc(KFbxObject const *pObject,int pIndex,kFbxClassId pClassId)                            { return pObject ? (T *) pObject->GetSrcObject(pClassId,pIndex) : 0;    }
00837     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;   }
00838     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; }
00839 
00840     template < class T > inline bool KFbxDisconnectAllSrc(KFbxObject *pObject,T *VC6Dummy=0)                                        { return pObject->DisconnectAllSrcObject(T::ClassId);   }
00841 
00842     // template access functions DST
00843     template < class T > inline int KFbxGetDstCount(KFbxObject const *pObject, T const* VC6Dummy = 0)                               { return pObject ? pObject->GetDstObjectCount(T::ClassId) : 0; }
00844     template < class T > inline int KFbxGetDstCount(KFbxObject const *pObject,kFbxClassId pClassId, T const* VC6Dummy = 0)          { return pObject ? pObject->GetDstObjectCount(pClassId) : 0;     }
00845     template < class T > inline T* KFbxGetDst(KFbxObject const *pObject,int pIndex=0)                                               { return pObject ? (T *) pObject->GetDstObject(T::ClassId,pIndex) : 0; }
00846     template < class T > inline T* KFbxGetDst(KFbxObject const *pObject,int pIndex,kFbxClassId pClassId)                            { return pObject ? (T *) pObject->GetDstObject(pClassId,pIndex) : 0;    }
00847     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;   }
00848     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; }
00849     template < class T > inline bool KFbxDisconnectAllDst(KFbxObject *pObject,T *VC6Dummy=0)                                        { return pObject->DisconnectAllDstObject(T::ClassId);   }
00850 
00851 
00852     /**********************************************************************
00853     * Object Iterator
00854     **********************************************************************/
00855     template<typename KFbxProperty> class KFbxIterator
00856     {
00857         public:
00858             KFbxIterator(KFbxObject const *pObject) : mObject(pObject) {}
00859 
00860             inline KFbxProperty const &GetFirst() { mProperty = mObject->GetFirstProperty(); return mProperty; }
00861             inline KFbxProperty const &GetNext() { mProperty = mObject->GetNextProperty(mProperty); return mProperty; }
00862 
00863         private:
00864             KFbxProperty        mProperty;
00865             KFbxObject const*   mObject;
00866     };
00867 
00868     class KFbxIteratorSrcBase
00869     {
00870     protected:
00871         KFbxProperty    mProperty;
00872         kFbxClassId     mClassId;
00873         int             mSize;
00874         int             mIndex;
00875     public:
00876         inline KFbxIteratorSrcBase(KFbxProperty &pProperty,kFbxClassId pClassId) :
00877             mClassId(pClassId),
00878             mProperty(pProperty),
00879             mSize(0),
00880             mIndex(-1)
00881         {
00882             ResetToBegin();
00883         }
00884         inline KFbxIteratorSrcBase(KFbxObject* pObject,kFbxClassId pClassId) :
00885             mClassId(pClassId),
00886             mProperty(pObject->RootProperty),
00887             mSize(0),
00888             mIndex(-1)
00889         {
00890             ResetToBegin();
00891         }
00892         inline KFbxObject* GetFirst()
00893         {
00894             ResetToBegin();
00895             return GetNext();
00896         }
00897         inline KFbxObject* GetNext()
00898         {
00899             mIndex++;
00900             return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetSrcObject(mClassId,mIndex) : NULL;
00901         }
00902         inline KFbxObject* GetSafeNext()
00903         {
00904             mSize = mProperty.GetSrcObjectCount(mClassId);
00905             return GetNext();
00906         }
00907         inline KFbxObject* GetLast()
00908         {
00909             ResetToEnd();
00910             return GetPrevious();
00911         }
00912         inline KFbxObject* GetPrevious()
00913         {
00914             mIndex--;
00915             return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetSrcObject(mClassId,mIndex) : NULL;
00916         }
00917         inline KFbxObject* GetSafePrevious()
00918         {
00919             mSize = mProperty.GetSrcObjectCount(mClassId);
00920             while (mIndex>mSize) mIndex--;
00921             return GetPrevious();
00922         }
00923 
00924 
00925     // Internal Access Function
00926     protected:
00927         inline void ResetToBegin()
00928         {
00929             mSize = mProperty.GetSrcObjectCount(mClassId);
00930             mIndex = -1;
00931         }
00932         inline void ResetToEnd()
00933         {
00934             mSize = mProperty.GetSrcObjectCount(mClassId);
00935             mIndex = mSize;
00936         }
00937     };
00938 
00939     template<class Type> class KFbxIteratorSrc : protected KFbxIteratorSrcBase
00940     {
00941     public:
00942         inline KFbxIteratorSrc(KFbxObject* pObject) : KFbxIteratorSrcBase(pObject,Type::ClassId) {}
00943         inline KFbxIteratorSrc(KFbxProperty& pProperty) : KFbxIteratorSrcBase(pProperty,Type::ClassId) {}
00944         inline Type *GetFirst()         { return (Type *)KFbxIteratorSrcBase::GetFirst(); }
00945         inline Type *GetNext()          { return (Type *)KFbxIteratorSrcBase::GetNext(); }
00946         inline Type *GetSafeNext()      { return (Type *)KFbxIteratorSrcBase::GetSafeNext(); }
00947         inline Type *GetLast()          { return (Type *)KFbxIteratorSrcBase::GetLast(); }
00948         inline Type *GetPrevious()      { return (Type *)KFbxIteratorSrcBase::GetPrevious(); }
00949         inline Type *GetSafePrevious()  { return (Type *)KFbxIteratorSrcBase::GetSafePrevious(); }
00950 
00951     // Internal Access Function
00952     protected:
00953     };
00954 
00955     class KFbxIteratorDstBase
00956     {
00957     protected:
00958         KFbxProperty    mProperty;
00959         kFbxClassId     mClassId;
00960         int             mSize;
00961         int             mIndex;
00962     public:
00963         inline KFbxIteratorDstBase(KFbxProperty &pProperty,kFbxClassId pClassId) :
00964             mClassId(pClassId),
00965             mProperty(pProperty),
00966             mSize(0),
00967             mIndex(-1)
00968         {
00969             ResetToBegin();
00970         }
00971         inline KFbxIteratorDstBase(KFbxObject* pObject,kFbxClassId pClassId) :
00972             mClassId(pClassId),
00973             mProperty(pObject->RootProperty),
00974             mSize(0),
00975             mIndex(-1)
00976         {
00977             ResetToBegin();
00978         }
00979         inline KFbxObject* GetFirst()
00980         {
00981             ResetToBegin();
00982             return GetNext();
00983         }
00984         inline KFbxObject* GetNext()
00985         {
00986             mIndex++;
00987             return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(mClassId,mIndex) : NULL;
00988         }
00989         inline KFbxObject* GetSafeNext()
00990         {
00991             mSize = mProperty.GetDstObjectCount(mClassId);
00992             return GetNext();
00993         }
00994         inline KFbxObject* GetLast()
00995         {
00996             ResetToEnd();
00997             return GetPrevious();
00998         }
00999         inline KFbxObject* GetPrevious()
01000         {
01001             mIndex--;
01002             return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(mClassId,mIndex) : NULL;
01003         }
01004         inline KFbxObject* GetSafePrevious()
01005         {
01006             mSize = mProperty.GetDstObjectCount(mClassId);
01007             while (mIndex>mSize) mIndex--;
01008             return GetPrevious();
01009         }
01010 
01011 
01012     // Internal Access Function
01013     protected:
01014         inline void ResetToBegin()
01015         {
01016             mSize = mProperty.GetDstObjectCount(mClassId);
01017             mIndex = -1;
01018         }
01019         inline void ResetToEnd()
01020         {
01021             mSize = mProperty.GetDstObjectCount(mClassId);
01022             mIndex = mSize;
01023         }
01024     };
01025 
01026     template<class Type> class KFbxIteratorDst : protected KFbxIteratorDstBase
01027     {
01028     public:
01029         inline KFbxIteratorDst(KFbxObject* pObject) : KFbxIteratorDstBase(pObject,Type::ClassId) {}
01030         inline KFbxIteratorDst(KFbxProperty& pProperty) : KFbxIteratorDstBase(pProperty,Type::ClassId) {}
01031         inline Type *GetFirst()         { return (Type *)KFbxIteratorDstBase::GetFirst(); }
01032         inline Type *GetNext()          { return (Type *)KFbxIteratorDstBase::GetNext(); }
01033         inline Type *GetSafeNext()      { return (Type *)KFbxIteratorDstBase::GetSafeNext(); }
01034         inline Type *GetLast()          { return (Type *)KFbxIteratorDstBase::GetLast(); }
01035         inline Type *GetPrevious()      { return (Type *)KFbxIteratorDstBase::GetPrevious(); }
01036         inline Type *GetSafePrevious()  { return (Type *)KFbxIteratorDstBase::GetSafePrevious(); }
01037     };
01038 
01039     #define KFbxForEach(Iterator,Object) for ( (Object)=(Iterator).GetFirst(); (Object)!=0; (Object)=(Iterator).GetNext() )
01040     #define KFbxReverseForEach(Iterator,Object) for ( Object=(Iterator).GetLast(); (Object)!=0;  Object=(Iterator).GetPrevious() )
01041     #define KFbxForEach_Safe(Iterator,Object) for ( Object=(Iterator).GetFirst(); (Object)!=0; Object=(Iterator).GetSafeNext() )
01042     #define KFbxReverseForEach_Safe(Iterator,Object) for ( Object=(Iterator).GetLast(); (Object)!=0;  Object=(Iterator).GetSafePrevious() )
01043 
01044 
01045 #include <fbxfilesdk/fbxfilesdk_nsend.h>
01046 
01047 #endif // FBXFILESDK_KFBXPLUGINS_KFBXOBJECT_H
01048