FBX SDK Reference Guide: kfbxdocument.h Source File
00001 #ifndef FBXFILESDK_FBXCORE_FBXCOLLECTION_KFBXDOCUMENT_H
00002 #define FBXFILESDK_FBXCORE_FBXCOLLECTION_KFBXDOCUMENT_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 <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00040 #include <fbxfilesdk/fbxcore/fbxcollection/kfbxcollection.h>
00041 
00042 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00043 
00044     // Forward declaration
00045     class KFbxTakeInfo;
00046     class KFbxPeripheral;
00047     class KFbxDocumentInfo;
00048 
00055     class KFBX_DLL KFbxDocument : public KFbxCollection
00056     {
00057         KFBXOBJECT_DECLARE(KFbxDocument,KFbxCollection);
00058 
00059 
00064             KFbxTypedProperty<fbxReference*>                    Roots;
00066 
00071         public:
00073             virtual void    Clear();
00077             inline  void    AddRootMember   (KFbxObject *pMember)   { AddMember(pMember); Roots.ConnectSrcObject(pMember); }
00081             inline  void    RootRootRemoveMember(KFbxObject *pMember)   { RemoveMember(pMember); Roots.DisconnectSrcObject(pMember); }
00086             template <class T> inline T *       FindRootMember(T const *pfbxType, char *pName) { return Roots.FindSrcObject(pfbxType, pName); }
00087 
00089             inline int                          GetRootMemberCount () const { return Roots.GetSrcObjectCount(); }
00094             template < class T > inline int     GetRootMemberCount (T const *pFBX_TYPE) const { return Roots.GetSrcObjectCount(T::ClassId); }
00099             int                                 GetRootMemberCount( KFbxCriteria pCriteria ) const;
00100 
00104             inline KFbxObject*                  GetRootMember (int pIndex=0) const                  { return Roots.GetSrcObject(pIndex); }
00109             template < class T > inline T*      GetRootMember (T const *pFBX_TYPE, int pIndex=0) const  { return (T *)Roots.GetSrcObject(T::ClassId,pIndex); }
00114             KFbxObject*                         GetRootMember (KFbxCriteria pCriteria, int pIndex=0) const;
00115  
00120             virtual bool    IsRootMember(KFbxObject *pMember) const;
00122 
00123 
00131             KFbxDocumentInfo* GetDocumentInfo() const;
00132 
00136             void SetDocumentInfo(KFbxDocumentInfo* pSceneInfo);
00138 
00148         public:
00152             void SetPeripheral(KFbxPeripheral* pPeripheral);
00153 
00158             virtual KFbxPeripheral* GetPeripheral();
00159 
00166             int UnloadContent();
00167 
00174             int LoadContent();
00175 
00177 
00182 
00189             int GetReferencingDocuments(KArrayTemplate<KFbxDocument*> & pReferencingDocuments) const;
00190 
00199             int GetReferencingObjects(KFbxDocument const * pFromDoc, KArrayTemplate<KFbxObject*> & pReferencingObjects) const;
00200 
00207             int GetReferencedDocuments(KArrayTemplate<KFbxDocument*> & pReferencedDocuments) const;
00208 
00217             int GetReferencedObjects(KFbxDocument const * pToDoc, KArrayTemplate<KFbxObject*> & pReferencedObjects) const;
00218 
00222             KString GetPathToRootDocument(void) const;
00228             void GetDocumentPathToRootDocument(KArrayTemplate<KFbxDocument*> & pDocumentPath, bool pFirstCall = true) const;
00229 
00233             bool IsARootDocument(void) { return (NULL == GetDocument()); }
00235 
00240 
00254             bool CreateTake(char* pName);
00255 
00267             bool RemoveTake(char* pName);
00268 
00284             bool SetCurrentTake(char* pName);
00285 
00292             char* GetCurrentTakeName();
00293 
00301             void FillTakeNameArray(KArrayTemplate<KString*>& pNameArray);
00302 
00304 
00309 
00315             bool SetTakeInfo(const KFbxTakeInfo& pTakeInfo);
00316 
00322             KFbxTakeInfo* GetTakeInfo(const KString& pTakeName);
00323 
00325 
00331 
00335             KError& GetError();
00336 
00340             typedef enum
00341             {
00342                 eTAKE_ERROR,
00343                 eKFBX_OBJECT_IS_NULL,
00344                 eKFBX_OBJECT_ALREADY_OWNED,
00345                 eKFBX_OBJECT_UNKNOWN,
00346                 eKFBX_MISSING_PERIPHERAL,
00347                 eKFBX_OBJECT_PERIPHERAL_FAILURE,
00348                 eERROR_COUNT
00349             } EError;
00350 
00354             EError GetLastErrorID() const;
00355 
00359             const char* GetLastErrorString() const;
00360 
00362 
00364         //  WARNING!
00365         //  Anything beyond these lines may not be Documented accurately and is
00366         //  subject to change without notice.
00368         #ifndef DOXYGEN_SHOULD_SKIP_THIS
00369             public:
00370                 virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00371 
00372             // Constructor / Destructor
00373             protected:
00374 
00375                 KFbxDocument(KFbxSdkManager& pManager, char const* pName);
00376                 ~KFbxDocument();
00377                 virtual void Construct  (const KFbxDocument* pFrom);
00378                 virtual void Destruct   (bool pRecursive, bool pDependents);
00379                 bool    ConstructProperties(bool pForceSet);
00380 
00381                 KFbxDocument& operator=(const KFbxDocument& pOther);
00382 
00383             // Notification and connection management
00384             protected:
00385                 virtual bool    ConnecNotify (KFbxConnectEvent const &pEvent);
00386                 virtual void    SetDocument(KFbxDocument* pDocument);
00387 
00388             // Helper functions
00389             public:
00390                 void ConnectVideos();
00391 
00392             // Take management
00393             protected:
00394                 bool FindTakeName(const KString& pTakeName);
00395 
00396             //
00397             protected:
00398                 KFbxSdkManager*                     mSdkManager;
00399                 KFbxPeripheral*                     mPeripheral;
00400                 KString                             mCurrentTakeName;
00401                 KArrayTemplate<KFbxTakeInfo *>      mTakeInfoArray;
00402                 KError                              mError;
00403                 KFbxDocumentInfo*                   mDocumentInfo;
00404 
00405 
00406 
00407             friend class KFbxLayerContainer;
00408             friend class KFbxNodeFinderDuplicateName;
00409         #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00410     };
00411 
00412 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00413 
00414 #endif // FBXFILESDK_FBXCORE_FBXCOLLECTION_KFBXDOCUMENT_H
00415