fbxdocument.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_SCENE_DOCUMENT_H_
00014 #define _FBXSDK_SCENE_DOCUMENT_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/scene/fbxcollection.h>
00019 
00020 #include <fbxsdk/fbxsdk_nsbegin.h>
00021 
00022 // Forward declaration
00023 class FbxTakeInfo;
00024 class FbxPeripheral;
00025 class FbxDocumentInfo;
00026 
00046 class FBXSDK_DLL FbxDocument : public FbxCollection
00047 {
00048     FBXSDK_OBJECT_DECLARE(FbxDocument,FbxCollection);
00049 
00050 public:
00055         FbxPropertyT<FbxReference>                    Roots;
00057 
00062 
00063         virtual void    Clear();
00067         inline  void    AddRootMember   (FbxObject *pMember)   { AddMember(pMember); Roots.ConnectSrcObject(pMember); }
00071         inline  void    RootRootRemoveMember(FbxObject *pMember)   { RemoveMember(pMember); Roots.DisconnectSrcObject(pMember); }
00076         template <class T> inline T*       FindRootMember(const T* pfbxType, char* pName) { return Roots.FindSrcObject(pfbxType, pName); }
00077 
00079         inline int                          GetRootMemberCount () const { return Roots.GetSrcObjectCount(); }
00084         template < class T > inline int     GetRootMemberCount (const T* pFBX_TYPE) const { return Roots.GetSrcObjectCount(T::ClassId); }
00089         int                                 GetRootMemberCount( FbxCriteria pCriteria ) const;
00090 
00094         inline FbxObject*                  GetRootMember (int pIndex=0) const                  { return Roots.GetSrcObject(pIndex); }
00099         template < class T > inline T*      GetRootMember (const T* pFBX_TYPE, int pIndex=0) const  { return (T*)Roots.GetSrcObject(T::ClassId,pIndex); }
00104         FbxObject*                         GetRootMember (FbxCriteria pCriteria, int pIndex=0) const;
00105 
00110         virtual bool    IsRootMember(FbxObject* pMember) const;
00112 
00113 
00121         FbxDocumentInfo* GetDocumentInfo() const;
00122 
00126         void SetDocumentInfo(FbxDocumentInfo* pSceneInfo);
00128 
00143     public:
00147         void SetPeripheral(FbxPeripheral* pPeripheral);
00148 
00152         virtual FbxPeripheral* GetPeripheral();
00153 
00160         int UnloadContent();
00161 
00168         int LoadContent();
00169 
00171 
00176 
00183         int GetReferencingDocuments(FbxArray<FbxDocument*>& pReferencingDocuments) const;
00184 
00193         int GetReferencingObjects(const FbxDocument* pFromDoc, FbxArray<FbxObject*>& pReferencingObjects) const;
00194 
00201         int GetReferencedDocuments(FbxArray<FbxDocument*>& pReferencedDocuments) const;
00202 
00211         int GetReferencedObjects(const FbxDocument* pToDoc, FbxArray<FbxObject*>& pReferencedObjects) const;
00212 
00217         FbxString GetPathToRootDocument(void) const;
00223         void GetDocumentPathToRootDocument(FbxArray<FbxDocument*>& pDocumentPath, bool pFirstCall = true) const;
00224 
00229         bool IsARootDocument(void) { return (NULL == GetDocument()); }
00231 
00239         FbxPropertyT<FbxString>    ActiveAnimStackName;
00240 
00249         bool CreateAnimStack(const char* pName);
00250 
00255         bool RemoveAnimStack(const char* pName);
00256 
00261         void FillAnimStackNameArray(FbxArray<FbxString*>& pNameArray);
00262 
00264 
00271 
00277         bool SetTakeInfo(const FbxTakeInfo& pTakeInfo);
00278 
00284         FbxTakeInfo* GetTakeInfo(const FbxString& pTakeName) const;
00285 
00287 
00293 
00297         FbxError& GetError();
00298 
00302         enum EErrorCode
00303         {
00304             eTakeError,                 
00305             eObjectIsNull,              
00306             eObjectAlreadyOwned,        
00307             eObjectUnknown,             
00308             eMissingPeripheral,         
00309             eObjectPeripheralFailure,   
00310             eErrorCount                 
00311         };
00312 
00316         EErrorCode GetLastErrorID() const;
00317 
00321         const char* GetLastErrorString() const;
00322 
00324 
00326     //  WARNING!
00327     //  Anything beyond these lines may not be Documented accurately and is
00328     //  subject to change without notice.
00330     #ifndef DOXYGEN_SHOULD_SKIP_THIS
00331 
00332             virtual FbxObject& Copy(const FbxObject& pObject);
00333 
00334         // Constructor / Destructor
00335         protected:
00336 
00337             FbxDocument(FbxManager& pManager, const char* pName);
00338             virtual void Construct  (const FbxDocument* pFrom);
00339             virtual void Destruct   (bool pRecursive, bool pDependents);
00340             bool    ConstructProperties(bool pForceSet);
00341 
00342         // Notification and connection management
00343         protected:
00344             virtual bool    ConnecNotify (const FbxConnectEvent& pEvent);
00345             virtual void    SetDocument(FbxDocument* pDocument);
00346 
00347         // Helper functions
00348         public:
00349             void ConnectVideos();
00350 
00351         // Take management
00352         protected:
00353             bool FindTakeName(const FbxString& pTakeName);
00354           
00355         //
00356         protected:
00357             FbxManager*                     mSdkManager;
00358             FbxPeripheral*                     mPeripheral;
00359             FbxArray<FbxTakeInfo*>              mTakeInfoArray;
00360             FbxError                            mError;
00361             FbxDocumentInfo*                   mDocumentInfo;
00362 
00363 
00364 
00365         friend class FbxLayerContainer;
00366         friend class FbxNodeFinderDuplicateName;
00367     #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00368 };
00369 
00370 #include <fbxsdk/fbxsdk_nsend.h>
00371 
00372 #endif /* _FBXSDK_SCENE_DOCUMENT_H_ */