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 
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         //  WARNING!
00369         //  Anything beyond these lines may not be Documented accurately and is
00370         //  subject to change without notice.
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             // Constructor / Destructor
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             // 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             // this section will exist while the deprecated GetCurrentTakeName() exists
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