ExportEventContext.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #pragma once
  2. /*
  3. * Copyright (c) Contributors to the Open 3D Engine Project.
  4. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. *
  6. * SPDX-License-Identifier: Apache-2.0 OR MIT
  7. *
  8. */
  9. #include <AzCore/RTTI/RTTI.h>
  10. #include <AzCore/std/string/string.h>
  11. #include <SceneAPI/SceneCore/Events/CallProcessorBus.h>
  12. #include <SceneAPI/SceneCore/SceneCoreConfiguration.h>
  13. namespace AZ
  14. {
  15. namespace SceneAPI
  16. {
  17. namespace Containers
  18. {
  19. class Scene;
  20. }
  21. namespace DataTypes
  22. {
  23. class IGroup;
  24. }
  25. namespace Events
  26. {
  27. class ExportProductList;
  28. // Signals an export of the contained scene is about to happen.
  29. class PreExportEventContext
  30. : public ICallContext
  31. {
  32. public:
  33. AZ_RTTI(PreExportEventContext, "{6B303E35-8BF0-43DD-9AD7-7D7F24F18F37}", ICallContext);
  34. ~PreExportEventContext() override = default;
  35. SCENE_CORE_API PreExportEventContext(ExportProductList& productList, const AZStd::string& outputDirectory, const Containers::Scene& scene, const char* platformIdentifier, bool debug = false);
  36. SCENE_CORE_API PreExportEventContext(ExportProductList& productList, AZStd::string&& outputDirectory, const Containers::Scene& scene, const char* platformIdentifier, bool debug = false);
  37. SCENE_CORE_API const AZStd::string& GetOutputDirectory() const;
  38. SCENE_CORE_API ExportProductList& GetProductList();
  39. SCENE_CORE_API const ExportProductList& GetProductList() const;
  40. SCENE_CORE_API const Containers::Scene& GetScene() const;
  41. SCENE_CORE_API const char* GetPlatformIdentifier() const;
  42. SCENE_CORE_API bool GetDebug() const;
  43. private:
  44. AZStd::string m_outputDirectory;
  45. ExportProductList& m_productList;
  46. const Containers::Scene& m_scene;
  47. /**
  48. * The platform identifier is configured in the AssetProcessorPlatformConfig.ini and is data driven
  49. * it is generally a value like "pc" or "ios" or such.
  50. * this const char* points at memory owned by the caller but it will always survive for the duration of the call.
  51. */
  52. const char* m_platformIdentifier = nullptr;
  53. bool m_debug = false;
  54. };
  55. // Signals the scene that the contained scene needs to be exported to the specified directory.
  56. class ExportEventContext
  57. : public ICallContext
  58. {
  59. public:
  60. AZ_RTTI(ExportEventContext, "{ECE4A3BD-CE48-4B17-9609-6D97F8A887D3}", ICallContext);
  61. ~ExportEventContext() override = default;
  62. SCENE_CORE_API ExportEventContext(ExportProductList& productList, const AZStd::string& outputDirectory, const Containers::Scene& scene, const char* platformIdentifier);
  63. SCENE_CORE_API ExportEventContext(ExportProductList& productList, AZStd::string&& outputDirectory, const Containers::Scene& scene, const char* platformIdentifier);
  64. SCENE_CORE_API const AZStd::string& GetOutputDirectory() const;
  65. SCENE_CORE_API ExportProductList& GetProductList();
  66. SCENE_CORE_API const ExportProductList& GetProductList() const;
  67. SCENE_CORE_API const Containers::Scene& GetScene() const;
  68. SCENE_CORE_API const char* GetPlatformIdentifier() const;
  69. private:
  70. AZStd::string m_outputDirectory;
  71. ExportProductList& m_productList;
  72. const Containers::Scene& m_scene;
  73. /**
  74. * The platform identifier is configured in the AssetProcessorPlatformConfig.ini and is data driven
  75. * it is generally a value like "pc" or "ios" or such.
  76. * this const char* points at memory owned by the caller but it will always survive for the duration of the call.
  77. */
  78. const char* m_platformIdentifier = nullptr;
  79. };
  80. // Signals that an export has completed and written (if successful) to the specified directory.
  81. class PostExportEventContext
  82. : public ICallContext
  83. {
  84. public:
  85. AZ_RTTI(PostExportEventContext, "{92E0AD59-62CA-45E3-BB73-5659D10FF0DE}", ICallContext);
  86. ~PostExportEventContext() override = default;
  87. SCENE_CORE_API PostExportEventContext(ExportProductList& productList, const AZStd::string& outputDirectory, const char* platformIdentifier);
  88. SCENE_CORE_API PostExportEventContext(ExportProductList& productList, AZStd::string&& outputDirectory, const char* platformIdentifier);
  89. SCENE_CORE_API const AZStd::string GetOutputDirectory() const;
  90. SCENE_CORE_API ExportProductList& GetProductList();
  91. SCENE_CORE_API const ExportProductList& GetProductList() const;
  92. SCENE_CORE_API const char* GetPlatformIdentifier() const;
  93. private:
  94. AZStd::string m_outputDirectory;
  95. /**
  96. * The platform identifier is configured in the AssetProcessorPlatformConfig.ini and is data driven
  97. * it is generally a value like "pc" or "ios" or such.
  98. * this const char* points at memory owned by the caller but it will always survive for the duration of the call.
  99. */
  100. const char* m_platformIdentifier = nullptr;
  101. ExportProductList& m_productList;
  102. };
  103. } // namespace Events
  104. } // namespace SceneAPI
  105. } // namespace AZ