| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- /*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
- #include "ROS2EditorSystemComponent.h"
- #include <AzCore/Serialization/SerializeContext.h>
- #include <Frame/ROS2FrameEditorComponent.h>
- #include <ROS2/ROS2TypeIds.h>
- namespace ROS2
- {
- AZ_COMPONENT_IMPL(ROS2EditorSystemComponent, "ROS2EditorSystemComponent", ROS2EditorSystemComponentTypeId, BaseSystemComponent);
- void ROS2EditorSystemComponent::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
- {
- serializeContext->Class<ROS2EditorSystemComponent, ROS2SystemComponent>()->Version(0);
- }
- }
- ROS2EditorSystemComponent::ROS2EditorSystemComponent()
- {
- if (ROS2EditorInterface::Get() == nullptr)
- {
- ROS2EditorInterface::Register(this);
- }
- }
- ROS2EditorSystemComponent::~ROS2EditorSystemComponent()
- {
- if (ROS2EditorInterface::Get() == this)
- {
- ROS2EditorInterface::Unregister(this);
- }
- }
- void ROS2EditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
- {
- BaseSystemComponent::GetProvidedServices(provided);
- provided.push_back(AZ_CRC_CE("ROS2EditorService"));
- }
- void ROS2EditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
- {
- BaseSystemComponent::GetIncompatibleServices(incompatible);
- incompatible.push_back(AZ_CRC_CE("ROS2EditorService"));
- }
- void ROS2EditorSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
- {
- BaseSystemComponent::GetRequiredServices(required);
- }
- void ROS2EditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
- {
- BaseSystemComponent::GetDependentServices(dependent);
- }
- void ROS2EditorSystemComponent::Activate()
- {
- AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
- AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
- ROS2NamesRequestBus::Handler::BusConnect();
- }
- void ROS2EditorSystemComponent::Deactivate()
- {
- ROS2NamesRequestBus::Handler::BusDisconnect();
- AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
- AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
- }
- void ROS2EditorSystemComponent::OnStartPlayInEditorBegin()
- {
- ROS2NamesRequestBus::Handler::BusDisconnect(); // ROS2NamesRequestBus will be handled by ROS2SystemComponent
- ROS2SystemComponent::Activate();
- }
- void ROS2EditorSystemComponent::OnStopPlayInEditor()
- {
- ROS2SystemComponent::Deactivate();
- ROS2NamesRequestBus::Handler::BusConnect(); // ROS2NamesRequestBus will not be handled by ROS2SystemComponent anymore
- }
- AZ::Component* ROS2EditorSystemComponent::CreateROS2FrameEditorComponent(AZ::Entity& entity)
- {
- return CreateComponent<ROS2FrameEditorComponent>(entity);
- }
- AZ::Component* ROS2EditorSystemComponent::CreateROS2FrameEditorComponent(
- AZ::Entity& entity, const ROS2::ROS2FrameConfiguration& frameConfiguration)
- {
- return CreateComponent<ROS2FrameEditorComponent>(entity, frameConfiguration);
- }
- } // namespace ROS2
|