00001 
00004 #ifndef FBXFILESDK_FBXCORE_FBXCOLLECTION_KFBXDOCUMENT_H
00005 #define FBXFILESDK_FBXCORE_FBXCOLLECTION_KFBXDOCUMENT_H
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 #include <fbxfilesdk/fbxfilesdk_def.h>
00042 
00043 #include <fbxfilesdk/fbxcore/fbxcollection/kfbxcollection.h>
00044 
00045 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00046 
00047     
00048     class KFbxTakeInfo;
00049     class KFbxPeripheral;
00050     class KFbxDocumentInfo;
00051 
00058     class KFBX_DLL KFbxDocument : public KFbxCollection
00059     {
00060         KFBXOBJECT_DECLARE(KFbxDocument,KFbxCollection);
00061 
00062     public:
00067             KFbxTypedProperty<fbxReference*>                    Roots;
00069 
00074 
00075             virtual void    Clear();
00079             inline  void    AddRootMember   (KFbxObject *pMember)   { AddMember(pMember); Roots.ConnectSrcObject(pMember); }
00083             inline  void    RootRootRemoveMember(KFbxObject *pMember)   { RemoveMember(pMember); Roots.DisconnectSrcObject(pMember); }
00088             template <class T> inline T *       FindRootMember(T const *pfbxType, char *pName) { return Roots.FindSrcObject(pfbxType, pName); }
00089 
00091             inline int                          GetRootMemberCount () const { return Roots.GetSrcObjectCount(); }
00096             template < class T > inline int     GetRootMemberCount (T const *pFBX_TYPE) const { return Roots.GetSrcObjectCount(T::ClassId); }
00101             int                                 GetRootMemberCount( KFbxCriteria pCriteria ) const;
00102 
00106             inline KFbxObject*                  GetRootMember (int pIndex=0) const                  { return Roots.GetSrcObject(pIndex); }
00111             template < class T > inline T*      GetRootMember (T const *pFBX_TYPE, int pIndex=0) const  { return (T *)Roots.GetSrcObject(T::ClassId,pIndex); }
00116             KFbxObject*                         GetRootMember (KFbxCriteria pCriteria, int pIndex=0) const;
00117  
00122             virtual bool    IsRootMember(KFbxObject *pMember) const;
00124 
00125 
00133             KFbxDocumentInfo* GetDocumentInfo() const;
00134 
00138             void SetDocumentInfo(KFbxDocumentInfo* pSceneInfo);
00140 
00150         public:
00154             void SetPeripheral(KFbxPeripheral* pPeripheral);
00155 
00160             virtual KFbxPeripheral* GetPeripheral();
00161 
00168             int UnloadContent();
00169 
00176             int LoadContent();
00177 
00179 
00184 
00191             int GetReferencingDocuments(KArrayTemplate<KFbxDocument*> & pReferencingDocuments) const;
00192 
00201             int GetReferencingObjects(KFbxDocument const * pFromDoc, KArrayTemplate<KFbxObject*> & pReferencingObjects) const;
00202 
00209             int GetReferencedDocuments(KArrayTemplate<KFbxDocument*> & pReferencedDocuments) const;
00210 
00219             int GetReferencedObjects(KFbxDocument const * pToDoc, KArrayTemplate<KFbxObject*> & pReferencedObjects) const;
00220 
00224             KString GetPathToRootDocument(void) const;
00230             void GetDocumentPathToRootDocument(KArrayTemplate<KFbxDocument*> & pDocumentPath, bool pFirstCall = true) const;
00231 
00235             bool IsARootDocument(void) { return (NULL == GetDocument()); }
00237 
00244             KFbxTypedProperty<fbxString>    ActiveAnimStackName;
00245 
00254             bool CreateAnimStack(const char* pName);
00255 
00260             K_DEPRECATED bool CreateTake(const char* pName);
00261 
00266             bool RemoveAnimStack(const char* pName);
00267 
00272             K_DEPRECATED bool RemoveTake(const char* pName);
00273 
00283             K_DEPRECATED bool SetCurrentTake(const char* pName);
00284 
00292             K_DEPRECATED char* GetCurrentTakeName();
00293 
00299             K_DEPRECATED void FillTakeNameArray(KArrayTemplate<KString*>& pNameArray);
00300 
00305             void FillAnimStackNameArray(KArrayTemplate<KString*>& pNameArray);
00306 
00308 
00313 
00319             bool SetTakeInfo(const KFbxTakeInfo& pTakeInfo);
00320 
00326             KFbxTakeInfo* GetTakeInfo(const KString& pTakeName) const;
00327 
00329 
00335 
00339             KError& GetError();
00340 
00344             typedef enum
00345             {
00346                 eTAKE_ERROR,
00347                 eKFBX_OBJECT_IS_NULL,
00348                 eKFBX_OBJECT_ALREADY_OWNED,
00349                 eKFBX_OBJECT_UNKNOWN,
00350                 eKFBX_MISSING_PERIPHERAL,
00351                 eKFBX_OBJECT_PERIPHERAL_FAILURE,
00352                 eERROR_COUNT
00353             } EError;
00354 
00358             EError GetLastErrorID() const;
00359 
00363             const char* GetLastErrorString() const;
00364 
00366 
00368         
00369         
00370         
00372         #ifndef DOXYGEN_SHOULD_SKIP_THIS
00373 
00374                 virtual KFbxObject& Copy(const KFbxObject& pObject);
00375                 virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00376 
00377             
00378             protected:
00379 
00380                 KFbxDocument(KFbxSdkManager& pManager, char const* pName);
00381                 virtual void Construct  (const KFbxDocument* pFrom);
00382                 virtual void Destruct   (bool pRecursive, bool pDependents);
00383                 bool    ConstructProperties(bool pForceSet);
00384 
00385             
00386             protected:
00387                 virtual bool    ConnecNotify (KFbxConnectEvent const &pEvent);
00388                 virtual void    SetDocument(KFbxDocument* pDocument);
00389 
00390             
00391             public:
00392                 void ConnectVideos();
00393 
00394             
00395             protected:
00396                 bool FindTakeName(const KString& pTakeName);
00397 
00398             
00399             private:    
00400                 KString mDeprecatedCurrentTakeName;
00401                 
00402             
00403             protected:
00404                 KFbxSdkManager*                     mSdkManager;
00405                 KFbxPeripheral*                     mPeripheral;
00406                 KArrayTemplate<KFbxTakeInfo *>      mTakeInfoArray;
00407                 KError                              mError;
00408                 KFbxDocumentInfo*                   mDocumentInfo;
00409 
00410 
00411 
00412             friend class KFbxLayerContainer;
00413             friend class KFbxNodeFinderDuplicateName;
00414         #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00415     };
00416 
00417 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00418 
00419 #endif // FBXFILESDK_FBXCORE_FBXCOLLECTION_KFBXDOCUMENT_H
00420