ROS2EditorSystemComponent.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 "ROS2EditorSystemComponent.h"
  9. #include <AzCore/Component/ComponentApplicationBus.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. namespace ROS2
  12. {
  13. void ROS2EditorSystemComponent::Reflect(AZ::ReflectContext* context)
  14. {
  15. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  16. {
  17. serializeContext->Class<ROS2EditorSystemComponent, ROS2SystemComponent>()->Version(0);
  18. }
  19. }
  20. ROS2EditorSystemComponent::ROS2EditorSystemComponent() = default;
  21. ROS2EditorSystemComponent::~ROS2EditorSystemComponent() = default;
  22. void ROS2EditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  23. {
  24. BaseSystemComponent::GetProvidedServices(provided);
  25. provided.push_back(AZ_CRC_CE("ROS2EditorService"));
  26. }
  27. void ROS2EditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  28. {
  29. BaseSystemComponent::GetIncompatibleServices(incompatible);
  30. incompatible.push_back(AZ_CRC_CE("ROS2EditorService"));
  31. }
  32. void ROS2EditorSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
  33. {
  34. BaseSystemComponent::GetRequiredServices(required);
  35. }
  36. void ROS2EditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  37. {
  38. BaseSystemComponent::GetDependentServices(dependent);
  39. }
  40. void ROS2EditorSystemComponent::Activate()
  41. {
  42. AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
  43. }
  44. void ROS2EditorSystemComponent::Deactivate()
  45. {
  46. AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
  47. }
  48. void ROS2EditorSystemComponent::OnStartPlayInEditorBegin()
  49. {
  50. ROS2SystemComponent::Activate();
  51. }
  52. void ROS2EditorSystemComponent::OnStopPlayInEditor()
  53. {
  54. ROS2SystemComponent::Deactivate();
  55. }
  56. } // namespace ROS2