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 - 2010 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/fbxfilesdk_def.h>
00042 
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 
00071     class KFBX_DLL KFbxDocument : public KFbxCollection
00072     {
00073         KFBXOBJECT_DECLARE(KFbxDocument,KFbxCollection);
00074 
00075     public:
00080             KFbxTypedProperty<fbxReference*>                    Roots;
00082 
00087 
00088             virtual void    Clear();
00092             inline  void    AddRootMember   (KFbxObject *pMember)   { AddMember(pMember); Roots.ConnectSrcObject(pMember); }
00096             inline  void    RootRootRemoveMember(KFbxObject *pMember)   { RemoveMember(pMember); Roots.DisconnectSrcObject(pMember); }
00101             template <class T> inline T *       FindRootMember(T const *pfbxType, char *pName) { return Roots.FindSrcObject(pfbxType, pName); }
00102 
00104             inline int                          GetRootMemberCount () const { return Roots.GetSrcObjectCount(); }
00109             template < class T > inline int     GetRootMemberCount (T const *pFBX_TYPE) const { return Roots.GetSrcObjectCount(T::ClassId); }
00114             int                                 GetRootMemberCount( KFbxCriteria pCriteria ) const;
00115 
00119             inline KFbxObject*                  GetRootMember (int pIndex=0) const                  { return Roots.GetSrcObject(pIndex); }
00124             template < class T > inline T*      GetRootMember (T const *pFBX_TYPE, int pIndex=0) const  { return (T *)Roots.GetSrcObject(T::ClassId,pIndex); }
00129             KFbxObject*                         GetRootMember (KFbxCriteria pCriteria, int pIndex=0) const;
00130  
00135             virtual bool    IsRootMember(KFbxObject *pMember) const;
00137 
00138 
00146             KFbxDocumentInfo* GetDocumentInfo() const;
00147 
00151             void SetDocumentInfo(KFbxDocumentInfo* pSceneInfo);
00153 
00168         public:
00172             void SetPeripheral(KFbxPeripheral* pPeripheral);
00173 
00177             virtual KFbxPeripheral* GetPeripheral();
00178 
00185             int UnloadContent();
00186 
00193             int LoadContent();
00194 
00196 
00201 
00208             int GetReferencingDocuments(KArrayTemplate<KFbxDocument*> & pReferencingDocuments) const;
00209 
00218             int GetReferencingObjects(KFbxDocument const * pFromDoc, KArrayTemplate<KFbxObject*> & pReferencingObjects) const;
00219 
00226             int GetReferencedDocuments(KArrayTemplate<KFbxDocument*> & pReferencedDocuments) const;
00227 
00236             int GetReferencedObjects(KFbxDocument const * pToDoc, KArrayTemplate<KFbxObject*> & pReferencedObjects) const;
00237 
00242             KString GetPathToRootDocument(void) const;
00248             void GetDocumentPathToRootDocument(KArrayTemplate<KFbxDocument*> & pDocumentPath, bool pFirstCall = true) const;
00249 
00254             bool IsARootDocument(void) { return (NULL == GetDocument()); }
00256 
00264             KFbxTypedProperty<fbxString>    ActiveAnimStackName;
00265 
00274             bool CreateAnimStack(const char* pName);
00275 
00280             bool RemoveAnimStack(const char* pName);
00281 
00286             void FillAnimStackNameArray(KArrayTemplate<KString*>& pNameArray);
00287 
00289 
00296 
00302             bool SetTakeInfo(const KFbxTakeInfo& pTakeInfo);
00303 
00309             KFbxTakeInfo* GetTakeInfo(const KString& pTakeName) const;
00310 
00312 
00318 
00322             KError& GetError();
00323 
00327             typedef enum
00328             {
00330                 eTAKE_ERROR,
00332                 eKFBX_OBJECT_IS_NULL,
00334                 eKFBX_OBJECT_ALREADY_OWNED,
00336                 eKFBX_OBJECT_UNKNOWN,
00338                 eKFBX_MISSING_PERIPHERAL,
00340                 eKFBX_OBJECT_PERIPHERAL_FAILURE,
00342                 eERROR_COUNT
00343             } EError;
00344 
00348             EError GetLastErrorID() const;
00349 
00353             const char* GetLastErrorString() const;
00354 
00356 
00358         //  WARNING!
00359         //  Anything beyond these lines may not be Documented accurately and is
00360         //  subject to change without notice.
00362         #ifndef DOXYGEN_SHOULD_SKIP_THIS
00363 
00364                 virtual KFbxObject& Copy(const KFbxObject& pObject);
00365 
00366             // Constructor / Destructor
00367             protected:
00368 
00369                 KFbxDocument(KFbxSdkManager& pManager, char const* pName);
00370                 virtual void Construct  (const KFbxDocument* pFrom);
00371                 virtual void Destruct   (bool pRecursive, bool pDependents);
00372                 bool    ConstructProperties(bool pForceSet);
00373 
00374             // Notification and connection management
00375             protected:
00376                 virtual bool    ConnecNotify (KFbxConnectEvent const &pEvent);
00377                 virtual void    SetDocument(KFbxDocument* pDocument);
00378 
00379             // Helper functions
00380             public:
00381                 void ConnectVideos();
00382 
00383             // Take management
00384             protected:
00385                 bool FindTakeName(const KString& pTakeName);
00386               
00387             //
00388             protected:
00389                 KFbxSdkManager*                     mSdkManager;
00390                 KFbxPeripheral*                     mPeripheral;
00391                 KArrayTemplate<KFbxTakeInfo *>      mTakeInfoArray;
00392                 KError                              mError;
00393                 KFbxDocumentInfo*                   mDocumentInfo;
00394 
00395 
00396 
00397             friend class KFbxLayerContainer;
00398             friend class KFbxNodeFinderDuplicateName;
00399         #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00400     };
00401 
00402 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00403 
00404 #endif // FBXFILESDK_FBXCORE_FBXCOLLECTION_KFBXDOCUMENT_H
00405