Editor${Name}Component.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 <Atom/Feature/Utils/EditorRenderComponentAdapter.h>
  10. #include <AzCore/Component/TickBus.h>
  11. #include <AzFramework/Entity/EntityDebugDisplayBus.h>
  12. #include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
  13. #include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
  14. #include <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
  15. #include <Components/${Name}Component.h>
  16. #include <${Name}/${Name}TypeIds.h>
  17. namespace ${Name}
  18. {
  19. inline constexpr AZ::TypeId EditorComponentTypeId { "{${Random_Uuid}}" };
  20. class Editor${Name}Component final
  21. : public AZ::Render::EditorRenderComponentAdapter<${Name}ComponentController, ${Name}Component, ${Name}ComponentConfig>
  22. , private AzToolsFramework::EditorComponentSelectionRequestsBus::Handler
  23. , private AzFramework::EntityDebugDisplayEventBus::Handler
  24. , private AZ::TickBus::Handler
  25. , private AzToolsFramework::EditorEntityInfoNotificationBus::Handler
  26. {
  27. public:
  28. using BaseClass = AZ::Render::EditorRenderComponentAdapter <${Name}ComponentController, ${Name}Component, ${Name}ComponentConfig>;
  29. AZ_EDITOR_COMPONENT(Editor${Name}Component, EditorComponentTypeId, BaseClass);
  30. static void Reflect(AZ::ReflectContext* context);
  31. Editor${Name}Component();
  32. Editor${Name}Component(const ${Name}ComponentConfig& config);
  33. // AZ::Component overrides
  34. void Activate() override;
  35. void Deactivate() override;
  36. private:
  37. // AZ::TickBus overrides
  38. void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
  39. };
  40. }