LmbrCentralEditor.cpp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. #include "LmbrCentralEditor.h"
  9. #include "Audio/EditorAudioAreaEnvironmentComponent.h"
  10. #include "Audio/EditorAudioEnvironmentComponent.h"
  11. #include "Audio/EditorAudioListenerComponent.h"
  12. #include "Audio/EditorAudioMultiPositionComponent.h"
  13. #include "Audio/EditorAudioPreloadComponent.h"
  14. #include "Audio/EditorAudioRtpcComponent.h"
  15. #include "Audio/EditorAudioSwitchComponent.h"
  16. #include "Audio/EditorAudioTriggerComponent.h"
  17. #include "Scripting/EditorLookAtComponent.h"
  18. #include "Scripting/EditorRandomTimedSpawnerComponent.h"
  19. #include "Scripting/EditorSpawnerComponent.h"
  20. #include "Scripting/EditorTagComponent.h"
  21. #include "Editor/EditorCommentComponent.h"
  22. #include "Shape/EditorAxisAlignedBoxShapeComponent.h"
  23. #include "Shape/EditorAxisAlignedBoxShapeComponentMode.h"
  24. #include "Shape/EditorBoxShapeComponent.h"
  25. #include "Shape/EditorCapsuleShapeComponent.h"
  26. #include "Shape/EditorCylinderShapeComponent.h"
  27. #include "Shape/EditorDiskShapeComponent.h"
  28. #include "Shape/EditorPolygonPrismShapeComponent.h"
  29. #include "Shape/EditorQuadShapeComponent.h"
  30. #include "Shape/EditorReferenceShapeComponent.h"
  31. #include "Shape/EditorSphereShapeComponent.h"
  32. #include "Shape/EditorSplineComponent.h"
  33. #include "Shape/EditorSplineComponentMode.h"
  34. #include "Shape/EditorTubeShapeComponent.h"
  35. #include "Shape/EditorTubeShapeComponentMode.h"
  36. #include "Shape/EditorCompoundShapeComponent.h"
  37. #include <AzFramework/Metrics/MetricsPlainTextNameRegistration.h>
  38. #include <AzToolsFramework/ToolsComponents/EditorSelectionAccentSystemComponent.h>
  39. #include <AzToolsFramework/ComponentModes/BoxComponentMode.h>
  40. #include <Builders/BenchmarkAssetBuilder/BenchmarkAssetBuilderComponent.h>
  41. #include <Builders/LevelBuilder/LevelBuilderComponent.h>
  42. #include <Builders/LuaBuilder/LuaBuilderComponent.h>
  43. #include <Builders/SliceBuilder/SliceBuilderComponent.h>
  44. #include <Builders/TranslationBuilder/TranslationBuilderComponent.h>
  45. #include "Builders/CopyDependencyBuilder/CopyDependencyBuilderComponent.h"
  46. namespace LmbrCentral
  47. {
  48. LmbrCentralEditorModule::LmbrCentralEditorModule()
  49. : LmbrCentralModule()
  50. {
  51. m_descriptors.insert(m_descriptors.end(), {
  52. EditorAudioAreaEnvironmentComponent::CreateDescriptor(),
  53. EditorAudioEnvironmentComponent::CreateDescriptor(),
  54. EditorAudioListenerComponent::CreateDescriptor(),
  55. EditorAudioMultiPositionComponent::CreateDescriptor(),
  56. EditorAudioPreloadComponent::CreateDescriptor(),
  57. EditorAudioRtpcComponent::CreateDescriptor(),
  58. EditorAudioSwitchComponent::CreateDescriptor(),
  59. EditorAudioTriggerComponent::CreateDescriptor(),
  60. EditorTagComponent::CreateDescriptor(),
  61. EditorSphereShapeComponent::CreateDescriptor(),
  62. EditorDiskShapeComponent::CreateDescriptor(),
  63. EditorTubeShapeComponent::CreateDescriptor(),
  64. EditorBoxShapeComponent::CreateDescriptor(),
  65. EditorAxisAlignedBoxShapeComponent::CreateDescriptor(),
  66. EditorQuadShapeComponent::CreateDescriptor(),
  67. EditorLookAtComponent::CreateDescriptor(),
  68. EditorCylinderShapeComponent::CreateDescriptor(),
  69. EditorCapsuleShapeComponent::CreateDescriptor(),
  70. EditorCompoundShapeComponent::CreateDescriptor(),
  71. EditorReferenceShapeComponent::CreateDescriptor(),
  72. EditorSplineComponent::CreateDescriptor(),
  73. EditorPolygonPrismShapeComponent::CreateDescriptor(),
  74. EditorCommentComponent::CreateDescriptor(),
  75. EditorRandomTimedSpawnerComponent::CreateDescriptor(),
  76. EditorSpawnerComponent::CreateDescriptor(),
  77. CopyDependencyBuilder::CopyDependencyBuilderComponent::CreateDescriptor(),
  78. LevelBuilder::LevelBuilderComponent::CreateDescriptor(),
  79. SliceBuilder::BuilderPluginComponent::CreateDescriptor(),
  80. TranslationBuilder::BuilderPluginComponent::CreateDescriptor(),
  81. LuaBuilder::BuilderPluginComponent::CreateDescriptor(),
  82. BenchmarkAssetBuilder::BenchmarkAssetBuilderComponent::CreateDescriptor(),
  83. });
  84. AZStd::vector<AZ::Uuid> typeIds;
  85. typeIds.reserve(m_descriptors.size());
  86. for (AZ::ComponentDescriptor* descriptor : m_descriptors)
  87. {
  88. typeIds.emplace_back(descriptor->GetUuid());
  89. }
  90. AzFramework::MetricsPlainTextNameRegistrationBus::Broadcast(
  91. &AzFramework::MetricsPlainTextNameRegistrationBus::Events::RegisterForNameSending, typeIds);
  92. AzToolsFramework::ActionManagerRegistrationNotificationBus::Handler::BusConnect();
  93. }
  94. LmbrCentralEditorModule::~LmbrCentralEditorModule()
  95. {
  96. AzToolsFramework::ActionManagerRegistrationNotificationBus::Handler::BusDisconnect();
  97. }
  98. AZ::ComponentTypeList LmbrCentralEditorModule::GetRequiredSystemComponents() const
  99. {
  100. AZ::ComponentTypeList requiredComponents = LmbrCentralModule::GetRequiredSystemComponents();
  101. requiredComponents.push_back(azrtti_typeid<AzToolsFramework::Components::EditorSelectionAccentSystemComponent>());
  102. return requiredComponents;
  103. }
  104. void LmbrCentralEditorModule::OnActionRegistrationHook()
  105. {
  106. EditorSplineComponentMode::RegisterActions();
  107. EditorTubeShapeComponentMode::RegisterActions();
  108. AzToolsFramework::BoxComponentMode::RegisterActions();
  109. }
  110. void LmbrCentralEditorModule::OnActionContextModeBindingHook()
  111. {
  112. EditorSplineComponentMode::BindActionsToModes();
  113. EditorTubeShapeComponentMode::BindActionsToModes();
  114. AzToolsFramework::BoxComponentMode::BindActionsToModes();
  115. EditorAxisAlignedBoxShapeComponentMode::BindActionsToModes();
  116. }
  117. void LmbrCentralEditorModule::OnMenuBindingHook()
  118. {
  119. EditorSplineComponentMode::BindActionsToMenus();
  120. EditorTubeShapeComponentMode::BindActionsToMenus();
  121. AzToolsFramework::BoxComponentMode::BindActionsToMenus();
  122. }
  123. void LmbrCentralEditorModule::OnPostActionManagerRegistrationHook()
  124. {
  125. AzToolsFramework::EditorVertexSelectionActionManagement::DisableComponentModeEndOnVertexSelection();
  126. }
  127. } // namespace LmbrCentral
  128. #if defined(O3DE_GEM_NAME)
  129. AZ_DECLARE_MODULE_CLASS(AZ_JOIN(Gem_, O3DE_GEM_NAME, _Editor), LmbrCentral::LmbrCentralEditorModule)
  130. #else
  131. AZ_DECLARE_MODULE_CLASS(Gem_LmbrCentral_Editor, LmbrCentral::LmbrCentralEditorModule)
  132. #endif