kfbxdocument.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_FBXCORE_FBXCOLLECTION_KFBXDOCUMENT_H
00005 #define FBXFILESDK_FBXCORE_FBXCOLLECTION_KFBXDOCUMENT_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 
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 #include <fbxfilesdk/fbxcore/fbxcollection/kfbxcollection.h>
00044 
00045 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00046 
00047     // Forward declaration
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 
00067             KFbxTypedProperty<fbxReference*>                    Roots;
00069 
00074         public:
00076             virtual void    Clear();
00080             inline  void    AddRootMember   (KFbxObject *pMember)   { AddMember(pMember); Roots.ConnectSrcObject(pMember); }
00084             inline  void    RootRootRemoveMember(KFbxObject *pMember)   { RemoveMember(pMember); Roots.DisconnectSrcObject(pMember); }
00089             template <class T> inline T *       FindRootMember(T const *pfbxType, char *pName) { return Roots.FindSrcObject(pfbxType, pName); }
00090 
00092             inline int                          GetRootMemberCount () const { return Roots.GetSrcObjectCount(); }
00097             template < class T > inline int     GetRootMemberCount (T const *pFBX_TYPE) const { return Roots.GetSrcObjectCount(T::ClassId); }
00102             int                                 GetRootMemberCount( KFbxCriteria pCriteria ) const;
00103 
00107             inline KFbxObject*                  GetRootMember (int pIndex=0) const                  { return Roots.GetSrcObject(pIndex); }
00112             template < class T > inline T*      GetRootMember (T const *pFBX_TYPE, int pIndex=0) const  { return (T *)Roots.GetSrcObject(T::ClassId,pIndex); }
00117             KFbxObject*                         GetRootMember (KFbxCriteria pCriteria, int pIndex=0) const;
00118  
00123             virtual bool    IsRootMember(KFbxObject *pMember) const;
00125 
00126 
00134             KFbxDocumentInfo* GetDocumentInfo() const;
00135 
00139             void SetDocumentInfo(KFbxDocumentInfo* pSceneInfo);
00141 
00151         public:
00155             void SetPeripheral(KFbxPeripheral* pPeripheral);
00156 
00161             virtual KFbxPeripheral* GetPeripheral();
00162 
00169             int UnloadContent();
00170 
00177             int LoadContent();
00178 
00180 
00185 
00192             int GetReferencingDocuments(KArrayTemplate<KFbxDocument*> & pReferencingDocuments) const;
00193 
00202             int GetReferencingObjects(KFbxDocument const * pFromDoc, KArrayTemplate<KFbxObject*> & pReferencingObjects) const;
00203 
00210             int GetReferencedDocuments(KArrayTemplate<KFbxDocument*> & pReferencedDocuments) const;
00211 
00220             int GetReferencedObjects(KFbxDocument const * pToDoc, KArrayTemplate<KFbxObject*> & pReferencedObjects) const;
00221 
00225             KString GetPathToRootDocument(void) const;
00231             void GetDocumentPathToRootDocument(KArrayTemplate<KFbxDocument*> & pDocumentPath, bool pFirstCall = true) const;
00232 
00236             bool IsARootDocument(void) { return (NULL == GetDocument()); }
00238 
00243 
00257             bool CreateTake(char* pName);
00258 
00270             bool RemoveTake(char* pName);
00271 
00287             bool SetCurrentTake(char* pName);
00288 
00295             char* GetCurrentTakeName();
00296 
00304             void FillTakeNameArray(KArrayTemplate<KString*>& pNameArray);
00305 
00307 
00312 
00318             bool SetTakeInfo(const KFbxTakeInfo& pTakeInfo);
00319 
00325             KFbxTakeInfo* GetTakeInfo(const KString& pTakeName);
00326 
00328 
00334 
00338             KError& GetError();
00339 
00343             typedef enum
00344             {
00345                 eTAKE_ERROR,
00346                 eKFBX_OBJECT_IS_NULL,
00347                 eKFBX_OBJECT_ALREADY_OWNED,
00348                 eKFBX_OBJECT_UNKNOWN,
00349                 eKFBX_MISSING_PERIPHERAL,
00350                 eKFBX_OBJECT_PERIPHERAL_FAILURE,
00351                 eERROR_COUNT
00352             } EError;
00353 
00357             EError GetLastErrorID() const;
00358 
00362             const char* GetLastErrorString() const;
00363 
00365 
00367         //  WARNING!
00368         //  Anything beyond these lines may not be Documented accurately and is
00369         //  subject to change without notice.
00371         #ifndef DOXYGEN_SHOULD_SKIP_THIS
00372             public:
00373                 virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00374 
00375             // Constructor / Destructor
00376             protected:
00377 
00378                 KFbxDocument(KFbxSdkManager& pManager, char const* pName);
00379                 virtual void Construct  (const KFbxDocument* pFrom);
00380                 virtual void Destruct   (bool pRecursive, bool pDependents);
00381                 bool    ConstructProperties(bool pForceSet);
00382 
00383                 KFbxDocument& operator=(const KFbxDocument& pOther);
00384 
00385             // Notification and connection management
00386             protected:
00387                 virtual bool    ConnecNotify (KFbxConnectEvent const &pEvent);
00388                 virtual void    SetDocument(KFbxDocument* pDocument);
00389 
00390             // Helper functions
00391             public:
00392                 void ConnectVideos();
00393 
00394             // Take management
00395             protected:
00396                 bool FindTakeName(const KString& pTakeName);
00397 
00398             //
00399             protected:
00400                 KFbxSdkManager*                     mSdkManager;
00401                 KFbxPeripheral*                     mPeripheral;
00402                 KString                             mCurrentTakeName;
00403                 KArrayTemplate<KFbxTakeInfo *>      mTakeInfoArray;
00404                 KError                              mError;
00405                 KFbxDocumentInfo*                   mDocumentInfo;
00406 
00407 
00408 
00409             friend class KFbxLayerContainer;
00410             friend class KFbxNodeFinderDuplicateName;
00411         #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00412     };
00413 
00414 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00415 
00416 #endif // FBXFILESDK_FBXCORE_FBXCOLLECTION_KFBXDOCUMENT_H
00417