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 - 2009 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         virtual ~Class(){};                                                                                         \
00099         Class*  TypedClone(KFbxObject* pContainer = NULL, KFbxObject::ECloneType pCloneType = eDEEP_CLONE) const;   \
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 
00182             KFbxObject* GetReferenceTo(void) const;
00183 
00187             bool        IsReferencedBy(void) const;
00188 
00192             int         GetReferencedByCount(void) const;
00193 
00198             KFbxObject* GetReferencedBy(int pIndex) const;
00199 
00200         protected:
00201             //KFbxObject*   SetReferenceTo(KFbxObject* pRef);
00203 
00207         public:
00208 
00212             void SetName(char const* pName);
00213 
00217             char const* GetName() const;
00218 
00222             KString GetNameWithoutNameSpacePrefix() const;
00223 
00227             KString GetNameWithNameSpacePrefix() const;
00228 
00232             void SetInitialName(char const* pName);
00233 
00237             char const* GetInitialName() const;
00238 
00242             KString GetNameSpaceOnly( );
00243 
00247             void SetNameSpace(KString pNameSpace);
00248 
00253             KArrayTemplate<KString*> GetNameSpaceArray( char identifier );
00254 
00258             KString GetNameOnly() const;
00259 
00263             KString GetNameSpacePrefix() const;
00264 
00269             static KString RemovePrefix(char* pName);
00270 
00275             static KString StripPrefix(KString& lName);
00276 
00281             static KString StripPrefix(const char* pName);
00282 
00284             KFbxObjectID const& GetUniqueID() const;
00286 
00291         public:
00292 
00297             typedef enum {
00298                 eUpdateId_Object,
00299                 eUpdateId_Dependency
00300             } eFbxUpdateIdType;
00301 
00306             virtual kFbxUpdateId GetUpdateId(eFbxUpdateIdType pUpdateId=eUpdateId_Object) const;
00307 
00308 
00310 
00318         public:
00328             int ContentUnload();
00329 
00336             int ContentLoad();
00337 
00343             bool ContentIsLoaded() const;
00344 
00348             void ContentDecrementLockCount();
00349 
00353             void ContentIncrementLockCount();
00354 
00361             bool ContentIsLocked() const;
00362 
00363 
00364         protected:
00369             virtual void ContentClear();
00370 
00375             virtual KFbxPeripheral* GetPeripheral();
00377         public:
00389             virtual bool ContentWriteTo(KFbxStream& pStream) const;
00390 
00396             virtual bool ContentReadFrom(const KFbxStream& pStream);
00398 
00403         public:
00404 
00408             virtual bool GetSelected();
00409 
00413             virtual void SetSelected(bool pSelected);
00415 
00420 
00427             virtual bool Evaluate(KFbxProperty & pProperty,KFbxEvaluationInfo const *pEvaluationInfo);
00429 
00430 
00435         public:
00436 
00440             inline KFbxProperty GetFirstProperty() const
00441             {
00442                 return RootProperty.GetFirstDescendent();
00443             }
00444 
00449             inline KFbxProperty GetNextProperty(KFbxProperty const &pProperty) const
00450             {
00451                 return RootProperty.GetNextDescendent(pProperty);
00452             }
00453 
00459             inline KFbxProperty FindProperty(const char* pName, bool pCaseSensitive = true)const
00460             {
00461                 return RootProperty.Find(pName, pCaseSensitive );
00462             }
00463 
00470             inline KFbxProperty FindProperty(const char* pName, KFbxDataType const &pDataType, bool pCaseSensitive = true) const
00471             {
00472                 return RootProperty.Find(pName, pDataType, pCaseSensitive );
00473             }
00474 
00481             inline KFbxProperty FindPropertyHierarchical(const char* pName, bool pCaseSensitive = true)const
00482             {
00483                 return RootProperty.FindHierarchical(pName, pCaseSensitive );
00484             }
00485 
00493             inline KFbxProperty FindPropertyHierarchical(const char* pName, KFbxDataType const &pDataType, bool pCaseSensitive = true) const
00494             {
00495                 return RootProperty.FindHierarchical(pName, pDataType, pCaseSensitive );
00496             }
00497 
00501             inline KFbxProperty &GetRootProperty() { return RootProperty; }
00502 
00506             inline const KFbxProperty& GetRootProperty()const{ return RootProperty; }
00507 
00512             KFbxProperty GetClassRootProperty();
00513 
00514         public:
00515             KFbxProperty RootProperty;
00516 
00517         private:
00518             void SetClassRootProperty(KFbxProperty &lProperty);
00519 
00521 
00526 
00527 
00532         public:
00533             // SrcObjects
00539             inline bool ConnectSrcObject        (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone)   { return RootProperty.ConnectSrcObject(pObject,pType); }
00540 
00545             inline bool IsConnectedSrcObject    (const KFbxObject* pObject) const { return RootProperty.IsConnectedSrcObject  (pObject); }
00546 
00551             inline bool DisconnectSrcObject (KFbxObject* pObject)       { return RootProperty.DisconnectSrcObject(pObject); }
00552 
00556             inline bool DisconnectAllSrcObject() { return RootProperty.DisconnectAllSrcObject(); }
00557 
00562             inline bool DisconnectAllSrcObject(KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllSrcObject(pCriteria); }
00563 
00568             inline bool DisconnectAllSrcObject(kFbxClassId pClassId) { return RootProperty.DisconnectAllSrcObject(pClassId); }
00569 
00575             inline bool DisconnectAllSrcObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllSrcObject(pClassId,pCriteria); }
00576 
00580             inline int GetSrcObjectCount    () const { return RootProperty.GetSrcObjectCount(); }
00581 
00586             inline int GetSrcObjectCount    (KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pCriteria); }
00587 
00592             inline int GetSrcObjectCount    (kFbxClassId pClassId) const { return RootProperty.GetSrcObjectCount(pClassId); }
00593 
00599             inline int GetSrcObjectCount    (kFbxClassId pClassId,KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pClassId,pCriteria); }
00600 
00605             inline KFbxObject*  GetSrcObject (int pIndex=0) const { return RootProperty.GetSrcObject(pIndex); }
00606 
00612             inline KFbxObject*  GetSrcObject (KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pCriteria,pIndex); }
00613 
00619             inline KFbxObject*  GetSrcObject (kFbxClassId pClassId,int pIndex=0) const { return RootProperty.GetSrcObject(pClassId,pIndex); }
00620 
00627             inline KFbxObject*  GetSrcObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pClassId,pCriteria,pIndex); }
00628 
00634             inline KFbxObject*  FindSrcObject (const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pName,pStartIndex); }
00635 
00642             inline KFbxObject*  FindSrcObject (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pCriteria,pName,pStartIndex); }
00643 
00650             inline KFbxObject*  FindSrcObject (kFbxClassId pClassId,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pClassId,pName,pStartIndex); }
00651 
00659             inline KFbxObject*  FindSrcObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pClassId,pCriteria,pName,pStartIndex); }
00660 
00665             template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE) { return RootProperty.DisconnectAllSrcObject(pFBX_TYPE);   }
00666 
00672             template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria)  { return RootProperty.DisconnectAllSrcObject(pFBX_TYPE,pCriteria);  }
00673 
00678             template < class T > inline int  GetSrcObjectCount(T const *pFBX_TYPE) const { return RootProperty.GetSrcObjectCount(pFBX_TYPE);    }
00679 
00685             template < class T > inline int  GetSrcObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return RootProperty.GetSrcObjectCount(pFBX_TYPE,pCriteria);    }
00686 
00692             template < class T > inline T*   GetSrcObject(T const *pFBX_TYPE,int pIndex=0) const { return RootProperty.GetSrcObject(pFBX_TYPE,pIndex);  }
00693 
00700             template < class T > inline T*   GetSrcObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetSrcObject(pFBX_TYPE,pCriteria,pIndex);  }
00701 
00708             template < class T > inline T*   FindSrcObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcObject(pFBX_TYPE,pName,pStartIndex);  }
00709 
00717             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);  }
00718 
00719             // DstObjects
00725             inline bool ConnectDstObject        (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone)   { return RootProperty.ConnectDstObject(pObject,pType); }
00726 
00731             inline bool IsConnectedDstObject    (const KFbxObject* pObject) const { return RootProperty.IsConnectedDstObject  (pObject); }
00732 
00737             inline bool DisconnectDstObject (KFbxObject* pObject)       { return RootProperty.DisconnectDstObject(pObject); }
00738 
00742             inline bool DisconnectAllDstObject() { return RootProperty.DisconnectAllDstObject(); }
00743 
00748             inline bool DisconnectAllDstObject(KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllDstObject(pCriteria); }
00749 
00754             inline bool DisconnectAllDstObject(kFbxClassId pClassId) { return RootProperty.DisconnectAllDstObject(pClassId); }
00755 
00761             inline bool DisconnectAllDstObject(kFbxClassId pClassId,KFbxCriteria const &pCriteria) { return RootProperty.DisconnectAllDstObject(pClassId,pCriteria); }
00762 
00766             inline int GetDstObjectCount    () const { return RootProperty.GetDstObjectCount(); }
00767 
00772             inline int GetDstObjectCount    (KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pCriteria); }
00773 
00778             inline int GetDstObjectCount    (kFbxClassId pClassId) const { return RootProperty.GetDstObjectCount(pClassId); }
00779 
00785             inline int GetDstObjectCount    (kFbxClassId pClassId,KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pClassId,pCriteria); }
00786 
00791             inline KFbxObject*  GetDstObject (int pIndex=0) const { return RootProperty.GetDstObject(pIndex); }
00792 
00798             inline KFbxObject*  GetDstObject (KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pCriteria,pIndex); }
00799 
00805             inline KFbxObject*  GetDstObject (kFbxClassId pClassId,int pIndex=0) const { return RootProperty.GetDstObject(pClassId,pIndex); }
00806 
00813             inline KFbxObject*  GetDstObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pClassId,pCriteria,pIndex); }
00814 
00820             inline KFbxObject*  FindDstObject (const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pName,pStartIndex); }
00821 
00828             inline KFbxObject*  FindDstObject (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pCriteria,pName,pStartIndex); }
00829 
00836             inline KFbxObject*  FindDstObject (kFbxClassId pClassId,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pClassId,pName,pStartIndex); }
00837 
00845             inline KFbxObject*  FindDstObject (kFbxClassId pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pClassId,pCriteria,pName,pStartIndex); }
00846 
00851             template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE) { return RootProperty.DisconnectAllDstObject(pFBX_TYPE);   }
00852 
00858             template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria)  { return RootProperty.DisconnectAllDstObject(pFBX_TYPE,pCriteria);  }
00859 
00864             template < class T > inline int  GetDstObjectCount(T const *pFBX_TYPE) const { return RootProperty.GetDstObjectCount(pFBX_TYPE);    }
00865 
00871             template < class T > inline int  GetDstObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return RootProperty.GetDstObjectCount(pFBX_TYPE,pCriteria);    }
00872 
00878             template < class T > inline T*   GetDstObject(T const *pFBX_TYPE,int pIndex=0) const { return RootProperty.GetDstObject(pFBX_TYPE,pIndex);  }
00879 
00886             template < class T > inline T*   GetDstObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return RootProperty.GetDstObject(pFBX_TYPE,pCriteria,pIndex);  }
00887 
00894             template < class T > inline T*   FindDstObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return RootProperty.FindDstObject(pFBX_TYPE,pName,pStartIndex);  }
00895 
00903             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);  }
00905 
00910             // Properties
00915             inline bool         ConnectSrcProperty      (KFbxProperty const & pProperty) { return RootProperty.ConnectSrcProperty(pProperty); }
00916 
00921             inline bool         IsConnectedSrcProperty  (KFbxProperty const & pProperty) { return RootProperty.IsConnectedSrcProperty(pProperty); }
00922 
00927             inline bool         DisconnectSrcProperty   (KFbxProperty const & pProperty) { return RootProperty.DisconnectSrcProperty(pProperty); }
00928 
00932             inline int          GetSrcPropertyCount     () const { return RootProperty.GetSrcPropertyCount(); }
00933 
00938             inline KFbxProperty GetSrcProperty          (int pIndex=0) const { return RootProperty.GetSrcProperty(pIndex); }
00939 
00945             inline KFbxProperty FindSrcProperty         (const char *pName,int pStartIndex=0) const { return RootProperty.FindSrcProperty(pName,pStartIndex); }
00946 
00951             inline bool         ConnectDstProperty      (KFbxProperty const & pProperty) { return RootProperty.ConnectDstProperty(pProperty); }
00952 
00957             inline bool         IsConnectedDstProperty  (KFbxProperty const & pProperty) { return RootProperty.IsConnectedDstProperty(pProperty); }
00958 
00963             inline bool         DisconnectDstProperty   (KFbxProperty const & pProperty) { return RootProperty.DisconnectDstProperty(pProperty); }
00964 
00968             inline int          GetDstPropertyCount     () const { return RootProperty.GetDstPropertyCount(); }
00969 
00974             inline KFbxProperty GetDstProperty          (int pIndex=0) const { return RootProperty.GetDstProperty(pIndex); }
00975 
00981             inline KFbxProperty FindDstProperty         (const char *pName,int pStartIndex=0) const { return RootProperty.FindDstProperty(pName,pStartIndex); }
00983 
00988 
00995             void        SetUserDataPtr(KFbxObjectID const& pUserID, void* pUserData);
00996 
01001             void*       GetUserDataPtr(KFbxObjectID const& pUserID) const;
01002 
01008             inline void SetUserDataPtr(void* pUserData)     { SetUserDataPtr( GetUniqueID(), pUserData ); }
01009 
01013             inline void* GetUserDataPtr() const             { return GetUserDataPtr( GetUniqueID() ); }
01015 
01016 
01025             KFbxDocument* GetDocument() const;
01026 
01033             KFbxDocument* GetRootDocument() const;
01034 
01039             KFbxScene* GetScene() const;
01041 
01042 
01051             void EmitMessage(KFbxMessage * pMessage) const;
01053 
01064             virtual const char * Localize( const char * pID, const char * pDefault = NULL ) const;
01066 
01074             KFbxLibrary* GetParentLibrary(void) const;
01075 
01081             bool AddImplementation(KFbxImplementation* pImplementation);
01082 
01088             bool RemoveImplementation(KFbxImplementation* pImplementation);
01089 
01093             bool HasDefaultImplementation(void) const;
01094 
01098             KFbxImplementation* GetDefaultImplementation(void) const;
01099 
01106             bool SetDefaultImplementation(KFbxImplementation* pImplementation);
01107 
01112             int GetImplementationCount(
01113                 const KFbxImplementationFilter* pCriteria = NULL
01114             ) const;
01115 
01121             KFbxImplementation* GetImplementation(
01122                 int                             pIndex,
01123                 const KFbxImplementationFilter* pCriteria = NULL
01124             ) const;
01126 
01131         public:
01136             virtual KString GetUrl() const;
01137 
01143             virtual bool    SetUrl(char *pUrl);
01144 
01149             virtual bool    PopulateLoadSettings(KFbxObject *pSettings,char *pFileName=0);
01150 
01155             virtual bool    Load(char *pFileName=0);
01156 
01161             virtual bool    PopulateSaveSettings(KFbxObject *pSettings,char *pFileName=0);
01162 
01167             virtual bool    Save(char *pFileName=0);
01169 
01171     //
01172     //  WARNING!
01173     //
01174     //  Anything beyond these lines may not be documented accurately and is
01175     //  subject to change without notice.
01176     //
01178 
01179     #ifndef DOXYGEN_SHOULD_SKIP_THIS
01180 
01181     protected:
01182         KFbxObject(KFbxSdkManager& pManager, char const* pName);
01183 
01184         // Constructs the object. Each subclass should call the base
01185         // KFbxObject::Construct first. Note that property initialization
01186         // should be done in the ConstructProperties() method, not this one.
01187         // pFrom - The object this object should be cloned from. NULL to
01188         // construct an independent object.
01189         virtual void Construct(const KFbxObject* pFrom);
01190 
01191         // Initialize the KFbxProperty member variables of this class.
01192         // Each subclass should call its parent, and initialize its properties
01193         // in this method.
01194         // pForceSet - Forces the property values to be set to default values.
01195         virtual bool ConstructProperties(bool pForceSet);
01196         virtual void Destruct(bool pRecursive, bool pDependents);
01197 
01198     public:
01199         virtual bool Compare(KFbxObject *pOtherObject,eFbxCompare pCompareMethod=eFbxCompareProperties);
01200 
01201         virtual KFbxSdkManager* GetFbxSdkManager() const;
01202         virtual kFbxClassId     GetRuntimeClassId() const;
01203 
01204         typedef enum
01205         {
01206             eNONE                   = 0x00000000,
01207             eSYSTEM_FLAG            = 0x00000001,
01208             eSAVABLE_FLAG           = 0x00000002,
01209             eHIDDEN_FLAG            = 0x00000008,
01210 
01211             eSYSTEM_FLAGS           = 0x0000ffff,
01212 
01213             eUSER_FLAGS             = 0x000f0000,
01214 
01215             // These flags are not saved to the fbx file
01216             eSYSTEM_RUNTIME_FLAGS   = 0x0ff00000,
01217 
01218             eCONTENT_LOADED_FLAG    = 0x00100000,
01219 
01220             eUSER_RUNTIME_FIRST_FLAG= 0x10000000,
01221             eUSER_RUNTIME_FLAGS     = 0xf0000000,
01222 
01223             eRUNTIME_FLAGS          = 0xfff00000
01224         } EObjectFlag;
01225 
01226         void                    SetObjectFlags(EObjectFlag pFlags, bool pValue);
01227         bool                    GetObjectFlags(EObjectFlag pFlags) const;
01228 
01229         // All flags replaced at once. This includes overriding the runtime flags, so
01230         // most likely you'd want to do something like this:
01231         //
01232         // SetObjectFlags(pFlags | (GetObjectFlags() & KFbxObject::eRUNTIME_FLAGS));
01233         void                    SetObjectFlags(kUInt pFlags);
01234         kUInt                   GetObjectFlags() const; // All flags at once, as a bitmask
01235 
01236     protected:
01237         virtual KFbxTakeNodeContainer* GetTakeNodeContainer();
01238 
01239         KFbxObject& operator=(KFbxObject const& pObject);
01240 
01241         // Currently not called from operator=; you must call it yourself if you
01242         // want properties to be copied.  Most likely it will be called automatically
01243         // by operator=(), at which point this method may become private.
01244         // At the very least it should be renamed to spot everyone that's currently
01245         // using it in their operator=, since it would then become irrelevant (and slow)
01246         void CopyPropertiesFrom(const KFbxObject& pFrom);
01247 
01248         virtual bool            SetRuntimeClassId(kFbxClassId pClassId);
01249         virtual                 bool ConnecNotify (KFbxConnectEvent const &pEvent);
01250         virtual kFbxUpdateId IncUpdateId(eFbxUpdateIdType pUpdateId=eUpdateId_Object);
01251 
01252         // property callbacks
01253         typedef enum {
01254             eFbxProperty_SetRequest,
01255             eFbxProperty_Set,
01256             eFbxProperty_Get
01257         } eFbxPropertyNotify;
01258         virtual bool PropertyNotify(eFbxPropertyNotify pType, KFbxProperty* pProperty);
01259 
01260 
01261     public:
01262         virtual KString         GetTypeName() const;
01263         virtual KStringList     GetTypeFlags() const;
01264 
01265     protected:
01266         virtual void            PropertyAdded(KFbxProperty* pProperty);
01267         virtual void            PropertyRemoved(KFbxProperty* pProperty);
01268 
01269         // Animation Management
01270         virtual void            AddChannels(KFbxTakeNode *pTakeNode);
01271         virtual void            UpdateChannelFromProperties(KFbxTakeNode *pTakeNode);
01272 
01273     public:
01274         virtual void            SetDocument(KFbxDocument* pDocument);
01275 
01276         inline KFbxObjectHandle &GetPropertyHandle() { return RootProperty.mPropertyHandle; }
01277 
01278     private:
01279         _KFbxObjectData*        mData;
01280 
01281         // friend classes for sdk access
01282         friend class KFbxScene;
01283         friend class KFbxObject_internal;
01284         friend class KFbxProperty;
01285     #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01286 
01287     };
01288 
01289     // need to be declared here instead or we get an INTERNAL COMPILER ERROR with VC6
01290     inline bool KFbxConnectSrc(KFbxObject *pDstObject,KFbxObject *pSrcObject)   { return (pSrcObject && pDstObject) ? pDstObject->ConnectSrcObject(pSrcObject) : 0; }
01291     inline bool KFbxConnectDst(KFbxObject *pSrcObject,KFbxObject *pDstObject)   { return (pSrcObject && pDstObject) ? pSrcObject->ConnectDstObject(pDstObject) : 0; }
01292 
01293     typedef KFbxObject* HKFbxObject;
01294 
01295     // template access functions SRC
01296     template < class T > inline int KFbxGetSrcCount(KFbxObject const *pObject, T const* VC6Dummy = 0)                               { return pObject ? pObject->GetSrcObjectCount(T::ClassId) : 0; }
01297     template < class T > inline int KFbxGetSrcCount(KFbxObject const *pObject,kFbxClassId pClassId, T const* VC6Dummy = 0)          { return pObject ? pObject->GetSrcObjectCount(pClassId) : 0;     }
01298     template < class T > inline T* KFbxGetSrc(KFbxObject const *pObject,int pIndex=0)                                               { return pObject ? (T *) pObject->GetSrcObject(T::ClassId,pIndex) : 0; }
01299     template < class T > inline T* KFbxGetSrc(KFbxObject const *pObject,int pIndex,kFbxClassId pClassId)                            { return pObject ? (T *) pObject->GetSrcObject(pClassId,pIndex) : 0;    }
01300     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;   }
01301     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; }
01302 
01303     template < class T > inline bool KFbxDisconnectAllSrc(KFbxObject *pObject,T *VC6Dummy=0)                                        { return pObject->DisconnectAllSrcObject(T::ClassId);   }
01304 
01305     // template access functions DST
01306     template < class T > inline int KFbxGetDstCount(KFbxObject const *pObject, T const* VC6Dummy = 0)                               { return pObject ? pObject->GetDstObjectCount(T::ClassId) : 0; }
01307     template < class T > inline int KFbxGetDstCount(KFbxObject const *pObject,kFbxClassId pClassId, T const* VC6Dummy = 0)          { return pObject ? pObject->GetDstObjectCount(pClassId) : 0;     }
01308     template < class T > inline T* KFbxGetDst(KFbxObject const *pObject,int pIndex=0)                                               { return pObject ? (T *) pObject->GetDstObject(T::ClassId,pIndex) : 0; }
01309     template < class T > inline T* KFbxGetDst(KFbxObject const *pObject,int pIndex,kFbxClassId pClassId)                            { return pObject ? (T *) pObject->GetDstObject(pClassId,pIndex) : 0;    }
01310     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;   }
01311     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; }
01312     template < class T > inline bool KFbxDisconnectAllDst(KFbxObject *pObject,T *VC6Dummy=0)                                        { return pObject->DisconnectAllDstObject(T::ClassId);   }
01313 
01314 
01315     /**********************************************************************
01316     * Object Iterator
01317     **********************************************************************/
01318     template<typename KFbxProperty> class KFbxIterator
01319     {
01320         public:
01321             KFbxIterator(KFbxObject const *pObject) : mObject(pObject) {}
01322 
01323             inline KFbxProperty const &GetFirst() { mProperty = mObject->GetFirstProperty(); return mProperty; }
01324             inline KFbxProperty const &GetNext() { mProperty = mObject->GetNextProperty(mProperty); return mProperty; }
01325 
01326         private:
01327             KFbxProperty        mProperty;
01328             KFbxObject const*   mObject;
01329     };
01330 
01331     class KFbxIteratorSrcBase
01332     {
01333     protected:
01334         KFbxProperty    mProperty;
01335         kFbxClassId     mClassId;
01336         int             mSize;
01337         int             mIndex;
01338     public:
01339         inline KFbxIteratorSrcBase(KFbxProperty &pProperty,kFbxClassId pClassId) :
01340             mClassId(pClassId),
01341             mProperty(pProperty),
01342             mSize(0),
01343             mIndex(-1)
01344         {
01345             ResetToBegin();
01346         }
01347         inline KFbxIteratorSrcBase(KFbxObject* pObject,kFbxClassId pClassId) :
01348             mClassId(pClassId),
01349             mProperty(pObject->RootProperty),
01350             mSize(0),
01351             mIndex(-1)
01352         {
01353             ResetToBegin();
01354         }
01355         inline KFbxObject* GetFirst()
01356         {
01357             ResetToBegin();
01358             return GetNext();
01359         }
01360         inline KFbxObject* GetNext()
01361         {
01362             mIndex++;
01363             return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetSrcObject(mClassId,mIndex) : NULL;
01364         }
01365         inline KFbxObject* GetSafeNext()
01366         {
01367             mSize = mProperty.GetSrcObjectCount(mClassId);
01368             return GetNext();
01369         }
01370         inline KFbxObject* GetLast()
01371         {
01372             ResetToEnd();
01373             return GetPrevious();
01374         }
01375         inline KFbxObject* GetPrevious()
01376         {
01377             mIndex--;
01378             return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetSrcObject(mClassId,mIndex) : NULL;
01379         }
01380         inline KFbxObject* GetSafePrevious()
01381         {
01382             mSize = mProperty.GetSrcObjectCount(mClassId);
01383             while (mIndex>mSize) mIndex--;
01384             return GetPrevious();
01385         }
01386 
01387 
01388     // Internal Access Function
01389     protected:
01390         inline void ResetToBegin()
01391         {
01392             mSize = mProperty.GetSrcObjectCount(mClassId);
01393             mIndex = -1;
01394         }
01395         inline void ResetToEnd()
01396         {
01397             mSize = mProperty.GetSrcObjectCount(mClassId);
01398             mIndex = mSize;
01399         }
01400     };
01401 
01402     template<class Type> class KFbxIteratorSrc : protected KFbxIteratorSrcBase
01403     {
01404     public:
01405         inline KFbxIteratorSrc(KFbxObject* pObject) : KFbxIteratorSrcBase(pObject,Type::ClassId) {}
01406         inline KFbxIteratorSrc(KFbxProperty& pProperty) : KFbxIteratorSrcBase(pProperty,Type::ClassId) {}
01407         inline Type *GetFirst()         { return (Type *)KFbxIteratorSrcBase::GetFirst(); }
01408         inline Type *GetNext()          { return (Type *)KFbxIteratorSrcBase::GetNext(); }
01409         inline Type *GetSafeNext()      { return (Type *)KFbxIteratorSrcBase::GetSafeNext(); }
01410         inline Type *GetLast()          { return (Type *)KFbxIteratorSrcBase::GetLast(); }
01411         inline Type *GetPrevious()      { return (Type *)KFbxIteratorSrcBase::GetPrevious(); }
01412         inline Type *GetSafePrevious()  { return (Type *)KFbxIteratorSrcBase::GetSafePrevious(); }
01413 
01414     // Internal Access Function
01415     protected:
01416     };
01417 
01418     class KFbxIteratorDstBase
01419     {
01420     protected:
01421         KFbxProperty    mProperty;
01422         kFbxClassId     mClassId;
01423         int             mSize;
01424         int             mIndex;
01425     public:
01426         inline KFbxIteratorDstBase(KFbxProperty &pProperty,kFbxClassId pClassId) :
01427             mClassId(pClassId),
01428             mProperty(pProperty),
01429             mSize(0),
01430             mIndex(-1)
01431         {
01432             ResetToBegin();
01433         }
01434         inline KFbxIteratorDstBase(KFbxObject* pObject,kFbxClassId pClassId) :
01435             mClassId(pClassId),
01436             mProperty(pObject->RootProperty),
01437             mSize(0),
01438             mIndex(-1)
01439         {
01440             ResetToBegin();
01441         }
01442         inline KFbxObject* GetFirst()
01443         {
01444             ResetToBegin();
01445             return GetNext();
01446         }
01447         inline KFbxObject* GetNext()
01448         {
01449             mIndex++;
01450             return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(mClassId,mIndex) : NULL;
01451         }
01452         inline KFbxObject* GetSafeNext()
01453         {
01454             mSize = mProperty.GetDstObjectCount(mClassId);
01455             return GetNext();
01456         }
01457         inline KFbxObject* GetLast()
01458         {
01459             ResetToEnd();
01460             return GetPrevious();
01461         }
01462         inline KFbxObject* GetPrevious()
01463         {
01464             mIndex--;
01465             return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(mClassId,mIndex) : NULL;
01466         }
01467         inline KFbxObject* GetSafePrevious()
01468         {
01469             mSize = mProperty.GetDstObjectCount(mClassId);
01470             while (mIndex>mSize) mIndex--;
01471             return GetPrevious();
01472         }
01473 
01474 
01475     // Internal Access Function
01476     protected:
01477         inline void ResetToBegin()
01478         {
01479             mSize = mProperty.GetDstObjectCount(mClassId);
01480             mIndex = -1;
01481         }
01482         inline void ResetToEnd()
01483         {
01484             mSize = mProperty.GetDstObjectCount(mClassId);
01485             mIndex = mSize;
01486         }
01487     };
01488 
01489     template<class Type> class KFbxIteratorDst : protected KFbxIteratorDstBase
01490     {
01491     public:
01492         inline KFbxIteratorDst(KFbxObject* pObject) : KFbxIteratorDstBase(pObject,Type::ClassId) {}
01493         inline KFbxIteratorDst(KFbxProperty& pProperty) : KFbxIteratorDstBase(pProperty,Type::ClassId) {}
01494         inline Type *GetFirst()         { return (Type *)KFbxIteratorDstBase::GetFirst(); }
01495         inline Type *GetNext()          { return (Type *)KFbxIteratorDstBase::GetNext(); }
01496         inline Type *GetSafeNext()      { return (Type *)KFbxIteratorDstBase::GetSafeNext(); }
01497         inline Type *GetLast()          { return (Type *)KFbxIteratorDstBase::GetLast(); }
01498         inline Type *GetPrevious()      { return (Type *)KFbxIteratorDstBase::GetPrevious(); }
01499         inline Type *GetSafePrevious()  { return (Type *)KFbxIteratorDstBase::GetSafePrevious(); }
01500     };
01501 
01502     #define KFbxForEach(Iterator,Object) for ( (Object)=(Iterator).GetFirst(); (Object)!=0; (Object)=(Iterator).GetNext() )
01503     #define KFbxReverseForEach(Iterator,Object) for ( Object=(Iterator).GetLast(); (Object)!=0;  Object=(Iterator).GetPrevious() )
01504     #define KFbxForEach_Safe(Iterator,Object) for ( Object=(Iterator).GetFirst(); (Object)!=0; Object=(Iterator).GetSafeNext() )
01505     #define KFbxReverseForEach_Safe(Iterator,Object) for ( Object=(Iterator).GetLast(); (Object)!=0;  Object=(Iterator).GetSafePrevious() )
01506 
01507 
01508 #include <fbxfilesdk/fbxfilesdk_nsend.h>
01509 
01510 #endif // FBXFILESDK_KFBXPLUGINS_KFBXOBJECT_H
01511