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