Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.0 KiB

  1. //============ Copyright (c) Valve Corporation, All rights reserved. ==========
  2. //
  3. //=============================================================================
  4. // Valve includes
  5. #include "fbxsystem/ifbxsystem.h"
  6. #include "tier0/dbg.h"
  7. // Local includes
  8. #include "fbxsystem.h"
  9. // Last include
  10. #include "tier0/memdbgon.h"
  11. //-----------------------------------------------------------------------------
  12. //
  13. //-----------------------------------------------------------------------------
  14. DEFINE_LOGGING_CHANNEL_NO_TAGS( LOG_FBX_SYSTEM, "FbxSystem" );
  15. //-----------------------------------------------------------------------------
  16. //
  17. //-----------------------------------------------------------------------------
  18. CFbxSystem s_fbxSystem;
  19. IFbxSystem *g_pFbx = &s_fbxSystem;
  20. //-----------------------------------------------------------------------------
  21. //
  22. //-----------------------------------------------------------------------------
  23. CFbxSystem::CFbxSystem()
  24. : m_pFbxManager( NULL )
  25. {
  26. }
  27. //-----------------------------------------------------------------------------
  28. //
  29. //-----------------------------------------------------------------------------
  30. CFbxSystem::~CFbxSystem()
  31. {
  32. }
  33. //-----------------------------------------------------------------------------
  34. // Initialize the FBX SDK, hook up the pointer, FBX is started up on first use
  35. // via CFbxSystem::GetFbxManager
  36. //-----------------------------------------------------------------------------
  37. InitReturnVal_t CFbxSystem::Init()
  38. {
  39. return INIT_OK;
  40. }
  41. //-----------------------------------------------------------------------------
  42. //
  43. //-----------------------------------------------------------------------------
  44. void CFbxSystem::Shutdown()
  45. {
  46. if ( m_pFbxManager )
  47. {
  48. m_pFbxManager->Destroy();
  49. m_pFbxManager = NULL;
  50. }
  51. }
  52. //-----------------------------------------------------------------------------
  53. //
  54. //-----------------------------------------------------------------------------
  55. FbxManager *CFbxSystem::GetFbxManager()
  56. {
  57. if ( m_pFbxManager )
  58. return m_pFbxManager;
  59. m_pFbxManager = FbxManager::Create();
  60. if ( m_pFbxManager )
  61. {
  62. FbxIOSettings *pFbxIOSettings = FbxIOSettings::Create( m_pFbxManager, IOSROOT );
  63. if ( !pFbxIOSettings )
  64. {
  65. m_pFbxManager->Destroy();
  66. m_pFbxManager = NULL;
  67. Log_Error( LOG_FBX_SYSTEM, "Error! Cannot create FbxIOSettings\n" );
  68. }
  69. m_pFbxManager->SetIOSettings( pFbxIOSettings );
  70. // TODO: This can be slow... and currently no FBX plug-ins exist (must be looking at all files to see if they are plug-ins)
  71. // TODO: Do we need FBX plug-ins? - sApplicationPath will be d:/dev/main/game/bin, for example (wherever studiomdl.exe is)
  72. // TODO: If we need plug-ins in the future, then we should put them in a specific directory under game/bin maybe?
  73. /*
  74. const FbxString sApplicationPath = FbxGetApplicationDirectory();
  75. pFbxManager->LoadPluginsDirectory( sApplicationPath.Buffer() );
  76. */
  77. }
  78. else
  79. {
  80. Log_Error( LOG_FBX_SYSTEM, "Error! Cannot create FbxManager\n" );
  81. }
  82. return m_pFbxManager;
  83. }