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_H_ 00014 #define _FBXSDK_SCENE_H_ 00015 00016 #include <fbxsdk/fbxsdk_def.h> 00017 00018 #include <fbxsdk/core/base/fbxarray.h> 00019 #include <fbxsdk/core/base/fbxerror.h> 00020 #include <fbxsdk/core/base/fbxstring.h> 00021 #include <fbxsdk/core/base/fbxcharptrset.h> 00022 00023 #include <fbxsdk/scene/fbxdocument.h> 00024 #include <fbxsdk/scene/geometry/fbxdeformer.h> 00025 #include <fbxsdk/scene/geometry/fbxsubdeformer.h> 00026 #include <fbxsdk/scene/geometry/fbxlayer.h> 00027 #include <fbxsdk/scene/geometry/fbxnodeattribute.h> 00028 #include <fbxsdk/scene/animation/fbxanimevaluator.h> 00029 00030 #include <fbxsdk/fileio/fbxglobalsettings.h> 00031 00032 #include <fbxsdk/fbxsdk_nsbegin.h> 00033 00034 class FbxManager; 00035 class FbxObject; 00036 class FbxNode; 00037 class FbxVideo; 00038 class FbxTexture; 00039 class FbxSurfaceMaterial; 00040 class FbxCharacter; 00041 class FbxControlSetPlug; 00042 class FbxCharacterPose; 00043 class FbxPose; 00044 class FbxDocumentInfo; 00045 class FbxTakeInfo; 00046 class FbxGlobalSettings; 00047 class FbxGenericNode; 00048 class FbxConstraint; 00049 class FbxGeometry; 00050 class FbxLayerContainer; 00051 class FbxSet; 00052 00053 class FbxGlobalLightSettings; 00054 class FbxGlobalCameraSettings; 00055 class FbxGlobalTimeSettings; 00056 00057 00078 class FBXSDK_DLL FbxScene : public FbxDocument 00079 { 00080 FBXSDK_OBJECT_DECLARE(FbxScene, FbxDocument); 00081 00082 public: 00087 00088 void Clear(); 00090 00095 00102 FbxNode* GetRootNode() const; 00104 00109 00113 void FillTextureArray(FbxArray<FbxTexture*>& pTextureArray); 00114 00118 void FillMaterialArray(FbxArray<FbxSurfaceMaterial*>& pMaterialArray); 00119 00121 00126 00130 int GetGenericNodeCount() const; 00131 00136 FbxGenericNode* GetGenericNode(int pIndex); 00137 00142 FbxGenericNode* GetGenericNode(char* pName); 00143 00148 bool AddGenericNode(FbxGenericNode* pGenericNode); 00149 00155 bool RemoveGenericNode(FbxGenericNode* pGenericNode); 00156 00158 00159 00164 00168 int GetCharacterCount() const; 00169 00174 FbxCharacter* GetCharacter(int pIndex); 00175 00180 int CreateCharacter(const char* pName); 00181 00185 void DestroyCharacter(int pIndex); 00186 00188 00193 00197 int GetControlSetPlugCount() const; 00198 00203 FbxControlSetPlug* GetControlSetPlug(int pIndex); 00204 00209 int CreateControlSetPlug(char* pName); 00210 00214 void DestroyControlSetPlug(int pIndex); 00215 00217 00222 00227 int GetCharacterPoseCount() const; 00228 00233 FbxCharacterPose* GetCharacterPose(int pIndex); 00234 00239 int CreateCharacterPose(char* pName); 00240 00244 void DestroyCharacterPose(int pIndex); 00245 00247 00252 00257 int GetPoseCount() const; 00258 00263 FbxPose* GetPose(int pIndex); 00264 00270 bool AddPose(FbxPose* pPose); 00271 00277 bool RemovePose(FbxPose* pPose); 00278 00284 bool RemovePose(int pIndex); 00285 00286 00288 00292 00296 inline FbxDocumentInfo* GetSceneInfo() { return GetDocumentInfo(); } 00297 00301 inline void SetSceneInfo(FbxDocumentInfo* pSceneInfo) { SetDocumentInfo(pSceneInfo); } 00302 00304 00309 00313 FbxGlobalSettings& GetGlobalSettings(); 00314 00318 const FbxGlobalSettings& GetGlobalSettings() const; 00320 00341 00345 void SetEvaluator(FbxAnimEvaluator* pEvaluator); 00346 00352 FbxAnimEvaluator* GetEvaluator(); 00353 00355 00359 void FillPoseArray(FbxArray<FbxPose*>& pPoseArray); 00360 00361 00366 00370 int GetMaterialCount () const; 00371 00377 FbxSurfaceMaterial* GetMaterial (int pIndex); 00378 00383 FbxSurfaceMaterial* GetMaterial (char* pName); 00384 00389 bool AddMaterial (FbxSurfaceMaterial* pMaterial); 00390 00395 bool RemoveMaterial (FbxSurfaceMaterial* pMaterial); 00396 00398 00403 00413 int GetTextureCount () const; 00414 00425 FbxTexture* GetTexture (int pIndex); 00426 00431 FbxTexture* GetTexture (char* pName); 00432 00437 bool AddTexture (FbxTexture* pTexture); 00438 00443 bool RemoveTexture (FbxTexture* pTexture); 00444 00446 00451 00455 int GetNodeCount () const; 00456 00462 FbxNode* GetNode (int pIndex); 00463 00468 bool AddNode (FbxNode* pNode); 00469 00474 bool RemoveNode (FbxNode* pNode); 00475 00482 int GetCurveOnSurfaceCount (); 00483 00488 FbxNode* FindNodeByName ( const FbxString& pName ); 00489 00491 00496 00500 int GetGeometryCount () const; 00501 00507 FbxGeometry* GetGeometry (int pIndex); 00508 00513 bool AddGeometry (FbxGeometry* pGeometry); 00514 00519 bool RemoveGeometry (FbxGeometry* pGeometry); 00520 00522 00527 00531 int GetVideoCount () const; 00532 00538 FbxVideo* GetVideo (int pIndex); 00539 00544 bool AddVideo (FbxVideo* pVideo); 00545 00550 bool RemoveVideo (FbxVideo* pVideo); 00551 00553 00570 void SyncShowPropertyForInstance(); 00572 00573 // 00574 // WARNING! 00575 // 00576 // Anything beyond these lines may not be documented accurately and is 00577 // subject to change without notice. 00578 // 00580 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00581 virtual FbxObject& Copy(const FbxObject& pObject); 00582 00583 void ConnectMaterials(); 00584 00585 void BuildMaterialLayersDirectArray(); 00586 void ReindexMaterialConnections(); // called to make sure that eIndex is remapped to eIndexToDirect 00587 00588 FbxSet* AddTakeTimeWarpSet(char *pTakeName); 00589 FbxSet* GetTakeTimeWarpSet(char *pTakeName); 00590 00591 // This function will destroy the scene (and all the objects directly connected to it) without sending 00592 // the Connect notifications nor trying to disconnect the objects first. This is a bypass of the intended 00593 // workflow and should be used with care. 00594 void ForceKill(); 00595 00596 private: 00597 FbxScene(FbxManager& pManager, char const* pName); 00598 00599 virtual void Construct(const FbxScene* pFrom); 00600 virtual void Destruct(bool pRecursive, bool pDependents); 00601 00602 void ConnectTextureLayerElement(FbxLayerContainer* pLayerContainer, 00603 FbxLayerElement::EType pLayerType, 00604 FbxNode* pParentNode); 00605 00606 void BuildTextureLayersDirectArrayForLayerType(FbxLayerContainer* pLayerContainer, 00607 FbxLayerElement::EType pLayerType); 00608 00609 public: 00610 void ConvertNurbsSurfaceToNurbs(); 00611 void ConvertMeshNormals(); 00612 void ConvertNurbsCurvesToNulls(); 00613 void ConnectTextures(); 00614 void BuildTextureLayersDirectArray(); 00615 void FixInheritType(FbxNode *pNode); 00616 00622 void UpdateScaleCompensate(FbxNode *pNode, FbxIOSettings& pIOS); 00623 00624 FbxClassId ConvertAttributeTypeToClassID(FbxNodeAttribute::EType pAttributeType); 00625 00631 FbxGlobalLightSettings& GlobalLightSettings() { return *mGlobalLightSettings; } 00633 FbxGlobalCameraSettings& GlobalCameraSettings() { return *mGlobalCameraSettings; } 00635 FbxGlobalTimeSettings& GlobalTimeSettings() { return *mGlobalTimeSettings; } 00636 00637 private: 00638 FbxNode* mRootNode; 00639 00640 FbxGlobalLightSettings* mGlobalLightSettings; 00641 FbxGlobalCameraSettings* mGlobalCameraSettings; 00642 FbxGlobalTimeSettings* mGlobalTimeSettings; 00643 00644 FbxAnimEvaluator* mEvaluator; 00645 00646 FbxCharPtrSet mTakeTimeWarpSet; 00647 00648 friend class FbxLayerContainer; 00649 friend class FbxNodeFinderDuplicateName; 00650 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS 00651 }; 00652 00653 #include <fbxsdk/fbxsdk_nsend.h> 00654 00655 #endif /* _FBXSDK_SCENE_H_ */