EditorToolsApplication.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. ~EditorToolsApplication();
  27. bool IsStartupAborted() const;
  28. void RegisterCoreComponents() override;
  29. AZ::ComponentTypeList GetRequiredSystemComponents() const override;
  30. void StartCommon(AZ::Entity* systemEntity) override;
  31. using AzToolsFramework::ToolsApplication::Start;
  32. bool Start();
  33. //////////////////////////////////////////////////////////////////////////
  34. // AzFramework::ApplicationRequests::Bus
  35. void QueryApplicationType(AZ::ApplicationTypeQuery& appType) const override;
  36. //////////////////////////////////////////////////////////////////////////
  37. // From AzToolsFramework::ToolsApplication
  38. void CreateReflectionManager() override;
  39. void Reflect(AZ::ReflectContext* context) override;
  40. // EditorModifierKeyRequestBus overrides ...
  41. AzToolsFramework::ViewportInteraction::KeyboardModifiers QueryKeyboardModifiers() override;
  42. // EditorViewportInputTimeNowRequestBus overrides ...
  43. AZStd::chrono::milliseconds EditorViewportInputTimeNow() override;
  44. protected:
  45. // From EditorToolsApplicationRequests
  46. bool OpenLevel(AZStd::string_view levelName) override;
  47. bool OpenLevelNoPrompt(AZStd::string_view levelName) override;
  48. int CreateLevel(AZStd::string_view levelName, bool bUseTerrain) override;
  49. int CreateLevelNoPrompt(AZStd::string_view levelName, int terrainExportTextureSize, bool useTerrain) override;
  50. void Exit() override;
  51. void ExitNoPrompt() override;
  52. AZStd::string GetGameFolder() const override;
  53. AZStd::string GetCurrentLevelName() const override;
  54. AZStd::string GetCurrentLevelPath() const override;
  55. const char* GetOldCryLevelExtension() const override;
  56. const char* GetLevelExtension() const override;
  57. private:
  58. static constexpr char DefaultLevelFolder[] = "Levels";
  59. bool m_StartupAborted = false;
  60. Editor::EditorMetricsPlainTextNameRegistrationBusListener m_metricsPlainTextRegistrar;
  61. };
  62. }