00001 /**************************************************************************************** 00002 00003 Copyright (C) 2013 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/fbxset.h> 00019 #include <fbxsdk/core/base/fbxcharptrset.h> 00020 #include <fbxsdk/scene/fbxdocument.h> 00021 #include <fbxsdk/scene/animation/fbxanimevaluator.h> 00022 #include <fbxsdk/scene/geometry/fbxlayer.h> 00023 #include <fbxsdk/scene/geometry/fbxnodeattribute.h> 00024 #include <fbxsdk/fileio/fbxiosettings.h> 00025 #include <fbxsdk/fileio/fbxglobalsettings.h> 00026 00027 #include <fbxsdk/fbxsdk_nsbegin.h> 00028 00029 class FbxGeometry; 00030 class FbxTexture; 00031 class FbxSurfaceMaterial; 00032 class FbxCharacter; 00033 class FbxControlSetPlug; 00034 class FbxGenericNode; 00035 class FbxPose; 00036 class FbxCharacterPose; 00037 class FbxVideo; 00038 class FbxGlobalLightSettings; 00039 class FbxGlobalCameraSettings; 00040 00061 class FBXSDK_DLL FbxScene : public FbxDocument 00062 { 00063 FBXSDK_OBJECT_DECLARE(FbxScene, FbxDocument); 00064 00065 public: 00070 00071 void Clear(); 00073 00078 00085 FbxNode* GetRootNode() const; 00087 00092 00096 void FillTextureArray(FbxArray<FbxTexture*>& pTextureArray); 00097 00101 void FillMaterialArray(FbxArray<FbxSurfaceMaterial*>& pMaterialArray); 00102 00104 00109 00113 int GetGenericNodeCount() const; 00114 00119 FbxGenericNode* GetGenericNode(int pIndex); 00120 00125 FbxGenericNode* GetGenericNode(char* pName); 00126 00131 bool AddGenericNode(FbxGenericNode* pGenericNode); 00132 00138 bool RemoveGenericNode(FbxGenericNode* pGenericNode); 00139 00141 00142 00147 00151 int GetCharacterCount() const; 00152 00157 FbxCharacter* GetCharacter(int pIndex); 00158 00163 int CreateCharacter(const char* pName); 00164 00168 void DestroyCharacter(int pIndex); 00169 00171 00176 00180 int GetControlSetPlugCount() const; 00181 00186 FbxControlSetPlug* GetControlSetPlug(int pIndex); 00187 00192 int CreateControlSetPlug(char* pName); 00193 00197 void DestroyControlSetPlug(int pIndex); 00198 00200 00205 00210 int GetCharacterPoseCount() const; 00211 00216 FbxCharacterPose* GetCharacterPose(int pIndex); 00217 00222 int CreateCharacterPose(char* pName); 00223 00227 void DestroyCharacterPose(int pIndex); 00228 00230 00235 00240 int GetPoseCount() const; 00241 00246 FbxPose* GetPose(int pIndex); 00247 00253 bool AddPose(FbxPose* pPose); 00254 00260 bool RemovePose(FbxPose* pPose); 00261 00267 bool RemovePose(int pIndex); 00268 00269 00271 00275 00279 inline FbxDocumentInfo* GetSceneInfo() { return GetDocumentInfo(); } 00280 00284 inline void SetSceneInfo(FbxDocumentInfo* pSceneInfo) { SetDocumentInfo(pSceneInfo); } 00285 00287 00292 00296 FbxGlobalSettings& GetGlobalSettings(); 00297 00301 const FbxGlobalSettings& GetGlobalSettings() const; 00303 00324 00328 void SetEvaluator(FbxAnimEvaluator* pEvaluator); 00329 00335 FbxAnimEvaluator* GetEvaluator(); 00336 00338 00342 void FillPoseArray(FbxArray<FbxPose*>& pPoseArray); 00343 00344 00349 00353 int GetMaterialCount () const; 00354 00360 FbxSurfaceMaterial* GetMaterial (int pIndex); 00361 00366 FbxSurfaceMaterial* GetMaterial (char* pName); 00367 00372 bool AddMaterial (FbxSurfaceMaterial* pMaterial); 00373 00378 bool RemoveMaterial (FbxSurfaceMaterial* pMaterial); 00379 00381 00386 00396 int GetTextureCount () const; 00397 00408 FbxTexture* GetTexture (int pIndex); 00409 00414 FbxTexture* GetTexture (char* pName); 00415 00420 bool AddTexture (FbxTexture* pTexture); 00421 00426 bool RemoveTexture (FbxTexture* pTexture); 00427 00429 00434 00438 int GetNodeCount () const; 00439 00445 FbxNode* GetNode (int pIndex); 00446 00451 bool AddNode (FbxNode* pNode); 00452 00457 bool RemoveNode (FbxNode* pNode); 00458 00465 int GetCurveOnSurfaceCount (); 00466 00471 FbxNode* FindNodeByName ( const FbxString& pName ); 00472 00474 00479 00483 int GetGeometryCount () const; 00484 00490 FbxGeometry* GetGeometry (int pIndex); 00491 00496 bool AddGeometry (FbxGeometry* pGeometry); 00497 00502 bool RemoveGeometry (FbxGeometry* pGeometry); 00503 00505 00510 00514 int GetVideoCount () const; 00515 00521 FbxVideo* GetVideo (int pIndex); 00522 00527 bool AddVideo (FbxVideo* pVideo); 00528 00533 bool RemoveVideo (FbxVideo* pVideo); 00534 00536 00553 void SyncShowPropertyForInstance(); 00555 00556 /***************************************************************************************************************************** 00557 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** 00558 *****************************************************************************************************************************/ 00559 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00560 00568 virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL) const; 00569 00570 virtual FbxObject& Copy(const FbxObject& pObject); 00571 00572 void ConnectMaterials(); 00573 00574 void BuildMaterialLayersDirectArray(); 00575 void ReindexMaterialConnections(); // called to make sure that eIndex is remapped to eIndexToDirect 00576 00577 FbxSet* AddTakeTimeWarpSet(char *pTakeName); 00578 FbxSet* GetTakeTimeWarpSet(char *pTakeName); 00579 00580 // This function will destroy the scene (and all the objects directly connected to it) without sending 00581 // the Connect notifications nor trying to disconnect the objects first. This is a bypass of the intended 00582 // workflow and should be used with care. 00583 void ForceKill(); 00584 00585 private: 00586 virtual void Construct(const FbxScene* pFrom); 00587 virtual void Destruct(bool pRecursive); 00588 00589 void ConnectTextureLayerElement(FbxLayerContainer* pLayerContainer, 00590 FbxLayerElement::EType pLayerType, 00591 FbxNode* pParentNode); 00592 00593 void BuildTextureLayersDirectArrayForLayerType(FbxLayerContainer* pLayerContainer, 00594 FbxLayerElement::EType pLayerType); 00595 00596 public: 00597 void ConvertNurbsSurfaceToNurbs(); 00598 void ConvertMeshNormals(); 00599 void ConvertNurbsCurvesToNulls(); 00600 void ConnectTextures(); 00601 void BuildTextureLayersDirectArray(); 00602 void FixInheritType(FbxNode *pNode); 00603 00604 void UpdateScaleCompensate(FbxNode *pNode, FbxIOSettings& pIOS); 00605 00606 FbxClassId ConvertAttributeTypeToClassID(FbxNodeAttribute::EType pAttributeType); 00607 00608 // These data structures are only used for legacy FBX files (version 6.x and earlier). The 00609 // validity of their content is not guaranteed with the most recent versions. 00610 FbxGlobalLightSettings& GlobalLightSettings() { return *mGlobalLightSettings; } 00611 FbxGlobalCameraSettings& GlobalCameraSettings() { return *mGlobalCameraSettings; } 00612 00613 private: 00614 FbxNode* mRootNode; 00615 FbxGlobalLightSettings* mGlobalLightSettings; 00616 FbxGlobalCameraSettings* mGlobalCameraSettings; 00617 FbxAnimEvaluator* mEvaluator; 00618 FbxCharPtrSet mTakeTimeWarpSet; 00619 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ 00620 }; 00621 00622 #include <fbxsdk/fbxsdk_nsend.h> 00623 00624 #endif /* _FBXSDK_SCENE_H_ */