EditorToolsApplication.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzToolsFramework/Application/ToolsApplication.h>
  10. #include <AzToolsFramework/Viewport/ViewportMessages.h>
  11. #include "Core/EditorMetricsPlainTextNameRegistration.h"
  12. #include "EditorToolsApplicationAPI.h"
  13. namespace EditorInternal
  14. {
  15. // Override the ToolsApplication so that we can special case when the config file is not
  16. // found and give the user of the Editor a specific message about it.
  17. class EditorToolsApplication
  18. : public AzToolsFramework::ToolsApplication
  19. , public EditorToolsApplicationRequests::Bus::Handler
  20. , public AzToolsFramework::ViewportInteraction::EditorModifierKeyRequestBus::Handler
  21. , public AzToolsFramework::ViewportInteraction::EditorViewportInputTimeNowRequestBus::Handler
  22. {
  23. public:
  24. AZ_CLASS_ALLOCATOR(EditorToolsApplication, AZ::SystemAllocator);
  25. EditorToolsApplication(int* argc, char*** argv);
  26. explicit EditorToolsApplication(AZ::ComponentApplicationSettings componentAppSettings);
  27. EditorToolsApplication(int* argc, char*** argv, AZ::ComponentApplicationSettings componentAppSettings);
  28. ~EditorToolsApplication();
  29. bool IsStartupAborted() const;
  30. void RegisterCoreComponents() override;
  31. AZ::ComponentTypeList GetRequiredSystemComponents() const override;
  32. void StartCommon(AZ::Entity* systemEntity) override;
  33. using AzToolsFramework::ToolsApplication::Start;
  34. bool Start();
  35. //////////////////////////////////////////////////////////////////////////
  36. // AzFramework::ApplicationRequests::Bus
  37. void QueryApplicationType(AZ::ApplicationTypeQuery& appType) const override;
  38. //////////////////////////////////////////////////////////////////////////
  39. // From AzToolsFramework::ToolsApplication
  40. void CreateReflectionManager() override;
  41. void Reflect(AZ::ReflectContext* context) override;
  42. // EditorModifierKeyRequestBus overrides ...
  43. AzToolsFramework::ViewportInteraction::KeyboardModifiers QueryKeyboardModifiers() override;
  44. // EditorViewportInputTimeNowRequestBus overrides ...
  45. AZStd::chrono::milliseconds EditorViewportInputTimeNow() override;
  46. protected:
  47. // From EditorToolsApplicationRequests
  48. bool OpenLevel(AZStd::string_view levelName) override;
  49. bool OpenLevelNoPrompt(AZStd::string_view levelName) override;
  50. int CreateLevel(AZStd::string_view templateName, AZStd::string_view levelName, bool bUseTerrain) override;
  51. int CreateLevelNoPrompt(AZStd::string_view templateName, AZStd::string_view levelName, int terrainExportTextureSize, bool useTerrain) override;
  52. void Exit() override;
  53. void ExitNoPrompt() override;
  54. AZStd::string GetGameFolder() const override;
  55. AZStd::string GetCurrentLevelName() const override;
  56. AZStd::string GetCurrentLevelPath() const override;
  57. const char* GetOldCryLevelExtension() const override;
  58. const char* GetLevelExtension() const override;
  59. private:
  60. static constexpr char DefaultLevelFolder[] = "Levels";
  61. bool m_StartupAborted = false;
  62. Editor::EditorMetricsPlainTextNameRegistrationBusListener m_metricsPlainTextRegistrar;
  63. };
  64. }