NamedPoseEditorComponent.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 <AzCore/Component/EntityBus.h>
  10. #include <AzCore/Component/EntityId.h>
  11. #include <AzCore/Component/TransformBus.h>
  12. #include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
  13. #include <LmbrCentral/Scripting/TagComponentBus.h>
  14. #include <SimulationInterfaces/NamedPose.h>
  15. #include <SimulationInterfaces/SimulationInterfacesTypeIds.h>
  16. namespace SimulationInterfaces
  17. {
  18. class NamedPoseEditorComponent
  19. : public AzToolsFramework::Components::EditorComponentBase
  20. , public LmbrCentral::TagComponentNotificationsBus::Handler
  21. , public AZ::TransformNotificationBus::Handler
  22. , public AZ::EntityBus::Handler
  23. {
  24. public:
  25. AZ_EDITOR_COMPONENT(NamedPoseEditorComponent, NamedPoseEditorComponentTypeId, AzToolsFramework::Components::EditorComponentBase);
  26. NamedPoseEditorComponent() = default;
  27. ~NamedPoseEditorComponent() override = default;
  28. // EditorComponentBase interface overrides ...
  29. void Activate() override;
  30. void Deactivate() override;
  31. void BuildGameEntity(AZ::Entity* gameEntity) override;
  32. static void Reflect(AZ::ReflectContext* context);
  33. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  34. private:
  35. // methods to update named pose configuration (name, pose and added tags. Native O3DE component and systems are used to define this
  36. // data and it needs to be updated in case of change)
  37. // LmbrCentral::TagComponentNotificationsBus overrides
  38. void OnTagAdded(const LmbrCentral::Tag&) override;
  39. void OnTagRemoved(const LmbrCentral::Tag&) override;
  40. // AZ::TransformNotificationBus overrides
  41. void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
  42. // AZ::EntityBus overrides
  43. void OnEntityNameChanged(const AZStd::string& name) override;
  44. void UpdateConfiguration();
  45. NamedPose m_config;
  46. };
  47. } // namespace SimulationInterfaces