FBX SDK Reference Guide: kfbxdocument.h Source File
00001 #ifndef _FBXSDK_DOCUMENT_H_
00002 #define _FBXSDK_DOCUMENT_H_
00003 
00004 /**************************************************************************************
00005 
00006  Copyright © 2001 - 2008 Autodesk, Inc. and/or its licensors.
00007  All Rights Reserved.
00008 
00009  The coded instructions, statements, computer programs, and/or related material 
00010  (collectively the "Data") in these files contain unpublished information 
00011  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00012  Canada and United States of America federal copyright law and by international 
00013  treaties. 
00014  
00015  The Data may not be disclosed or distributed to third parties, in whole or in
00016  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00017 
00018  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00019  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00020  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00021  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00022  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00023  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00024  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00028  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00029  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00030  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00031  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00032  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00033  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00034  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00035  OR DAMAGE. 
00036 
00037 **************************************************************************************/
00038 
00039 #include <kaydaradef.h>
00040 #ifndef KFBX_DLL
00041     #define KFBX_DLL K_DLLIMPORT
00042 #endif
00043 
00044 #include <fbxcore/fbxcollection/kfbxcollection.h>
00045 
00046 #include <fbxfilesdk_nsbegin.h>
00047 
00048     // Forward declaration
00049     class KFbxTakeInfo;
00050     class KFbxPeripheral;
00051     class KFbxDocumentInfo;
00052 
00059     class KFBX_DLL KFbxDocument : public KFbxCollection
00060     {
00061         KFBXOBJECT_DECLARE(KFbxDocument,KFbxCollection);
00062 
00063 
00068             KFbxTypedProperty<fbxReference*>                    Roots;
00070 
00075         public:
00077             virtual void    Clear();
00079             inline  void    AddRootMember   (KFbxObject *pMember)   { AddMember(pMember); Roots.ConnectSrcObject(pMember); }
00081             inline  void    RootRootRemoveMember(KFbxObject *pMember)   { RemoveMember(pMember); Roots.DisconnectSrcObject(pMember); }
00083             template <class T> inline T *       FindRootMember(T const *pfbxType, char *pName) { return Roots.FindSrcObject(pfbxType, pName); }
00084 
00086             inline int                          GetRootMemberCount () const { return Roots.GetSrcObjectCount(); }
00088             template < class T > inline int     GetRootMemberCount (T const *pFBX_TYPE) const { return Roots.GetSrcObjectCount(T::ClassId); }
00089             int                                 GetRootMemberCount( KFbxCriteria pCriteria ) const;
00090 
00092             inline KFbxObject*                  GetRootMember (int pIndex=0) const                  { return Roots.GetSrcObject(pIndex); }
00094             template < class T > inline T*      GetRootMember (T const *pFBX_TYPE, int pIndex=0) const  { return (T *)Roots.GetSrcObject(T::ClassId,pIndex); }
00095             KFbxObject*                         GetRootMember (KFbxCriteria pCriteria, int pIndex=0) const;
00097 
00098             virtual bool    IsRootMember(KFbxObject *pMember) const;
00100 
00101 
00109             KFbxDocumentInfo* GetDocumentInfo() const;
00110 
00114             void SetDocumentInfo(KFbxDocumentInfo* pSceneInfo);
00116 
00126         public:
00129             void SetPeripheral(KFbxPeripheral* pPeripheral);
00130 
00135             virtual KFbxPeripheral* GetPeripheral();
00136 
00143             int UnloadContent();
00144 
00151             int LoadContent();
00152 
00154 
00159 
00166             int GetReferencingDocuments(KArrayTemplate<KFbxDocument*> & pReferencingDocuments) const;
00167 
00176             int GetReferencingObjects(KFbxDocument const * pFromDoc, KArrayTemplate<KFbxObject*> & pReferencingObjects) const;
00177 
00184             int GetReferencedDocuments(KArrayTemplate<KFbxDocument*> & pReferencedDocuments) const;
00185 
00194             int GetReferencedObjects(KFbxDocument const * pToDoc, KArrayTemplate<KFbxObject*> & pReferencedObjects) const;
00195 
00196             // Gets the path string to the root document if any.
00197             KString GetPathToRootDocument(void) const;
00198 
00199             // Gets the document path to the root document if any.
00200             void GetDocumentPathToRootDocument(KArrayTemplate<KFbxDocument*> & pDocumentPath, bool pFirstCall = true) const;
00201 
00202             // Tells if this document is a root document.
00203             bool IsARootDocument(void) { return (NULL == GetDocument()); }
00205 
00210 
00224             bool CreateTake(char* pName);
00225 
00237             bool RemoveTake(char* pName);
00238 
00254             bool SetCurrentTake(char* pName);
00255 
00262             char* GetCurrentTakeName();
00263 
00271             void FillTakeNameArray(KArrayTemplate<KString*>& pNameArray);
00272 
00274 
00279 
00285             bool SetTakeInfo(const KFbxTakeInfo& pTakeInfo);
00286 
00292             KFbxTakeInfo* GetTakeInfo(const KString& pTakeName);
00293 
00295 
00301 
00305             KError& GetError();
00306 
00310             typedef enum
00311             {
00312                 eTAKE_ERROR,
00313                 eKFBX_OBJECT_IS_NULL,
00314                 eKFBX_OBJECT_ALREADY_OWNED,
00315                 eKFBX_OBJECT_UNKNOWN,
00316                 eKFBX_MISSING_PERIPHERAL,
00317                 eKFBX_OBJECT_PERIPHERAL_FAILURE,
00318                 eERROR_COUNT
00319             } EError;
00320 
00324             EError GetLastErrorID() const;
00325 
00329             const char* GetLastErrorString() const;
00330 
00332 
00334         //  WARNING!
00335         //  Anything beyond these lines may not be Documented accurately and is
00336         //  subject to change without notice.
00338         #ifndef DOXYGEN_SHOULD_SKIP_THIS
00339             public:
00340                 virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00341 
00342             // Constructor / Destructor
00343             protected:
00344 
00345                 KFbxDocument(KFbxSdkManager& pManager, char const* pName);
00346                 ~KFbxDocument();
00347                 virtual void Construct  (const KFbxDocument* pFrom);
00348                 virtual void Destruct   (bool pRecursive, bool pDependents);
00349                 bool    ConstructProperties(bool pForceSet);
00350 
00351                 KFbxDocument& operator=(const KFbxDocument& pOther);
00352 
00353             // Notification and connection management
00354             protected:
00355                 virtual bool    ConnecNotify (KFbxConnectEvent const &pEvent);
00356                 virtual void    SetDocument(KFbxDocument* pDocument);
00357 
00358             // Helper functions
00359             protected:
00360                 void ConnectVideos();
00361 
00362             // Take management
00363             protected:
00364                 bool FindTakeName(const KString& pTakeName);
00365 
00366             //
00367             protected:
00368                 KFbxSdkManager*                     mSdkManager;
00369                 KFbxPeripheral*                     mPeripheral;
00370                 KString                             mCurrentTakeName;
00371                 KArrayTemplate<KFbxTakeInfo *>      mTakeInfoArray;
00372                 KError                              mError;
00373                 KFbxDocumentInfo*                   mDocumentInfo;
00374 
00375 
00376 
00377             friend class KFbxLayerContainer;
00378             friend class KFbxNodeFinderDuplicateName;
00379 
00380             friend class KFbxWriterFbx;
00381             friend class KFbxWriterFbx6;
00382             friend class KFbxWriterFbx7;
00383             friend struct KFbxWriterFbx7Impl;
00384             friend class KFbxReaderFbx;
00385             friend class KFbxReaderFbx6;
00386             friend class KFbxReaderFbx7;
00387             friend struct KFbxReaderFbx7Impl;
00388 
00389         #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00390 
00391     };
00392 
00393 #include <fbxfilesdk_nsend.h>
00394 
00395 #endif // #ifndef _FBXSDK_Document_H_
00396 
00397