/* * 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 * */ #pragma once #include #include #include #include #include #include namespace AzToolsFramework { class LinearManipulator; } namespace LmbrCentral { /// The specific ComponentMode responsible for handling polygon prism editing. class EditorPolygonPrismShapeComponentMode : public AzToolsFramework::ComponentModeFramework::EditorBaseComponentMode , private AZ::TransformNotificationBus::Handler , private PolygonPrismShapeComponentNotificationBus::Handler , private ShapeComponentNotificationsBus::Handler { public: AZ_CLASS_ALLOCATOR_DECL EditorPolygonPrismShapeComponentMode( const AZ::EntityComponentIdPair& entityComponentIdPair, AZ::Uuid componentType); ~EditorPolygonPrismShapeComponentMode(); private: // EditorBaseComponentMode void Refresh() override; AZStd::vector PopulateActionsImpl() override; bool HandleMouseInteraction( const AzToolsFramework::ViewportInteraction::MouseInteractionEvent& mouseInteraction) override; // Manipulator handling void CreateManipulators(); void DestroyManipulators(); void RefreshManipulators(); void ContainerChanged(); // PolygonPrismShapeComponentNotificationBus void OnVertexAdded(size_t index) override; void OnVertexRemoved(size_t index) override; void OnVerticesSet(const AZStd::vector& vertices) override; void OnVerticesCleared() override; // ShapeComponentNotificationsBus void OnShapeChanged(ShapeChangeReasons changeReason) override; // TransformNotificationBus void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override; void OnNonUniformScaleChanged(const AZ::Vector3& scale); AZ::Transform m_currentTransform; AZ::Vector3 m_currentNonUniformScale; AzToolsFramework::EditorVertexSelectionVariable m_vertexSelection; ///< Handles all manipulator interactions with vertices (inserting and translating). AZStd::shared_ptr m_heightManipulator; ///< Manipulator to control the height of the polygon prism. AZ::NonUniformScaleChangedEvent::Handler m_nonUniformScaleChangedHandler; ///< Responds to changes in non-uniform scale. }; } // namespace LmbrCentral