EditorWhiteBoxEdgeRestoreMode.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 "EditorWhiteBoxComponentModeTypes.h"
  10. namespace AZ
  11. {
  12. class EntityComponentIdPair;
  13. }
  14. namespace AzFramework
  15. {
  16. struct ViewportInfo;
  17. }
  18. namespace AzToolsFramework
  19. {
  20. namespace ViewportInteraction
  21. {
  22. struct MouseInteractionEvent;
  23. }
  24. struct ActionOverride;
  25. } // namespace AzToolsFramework
  26. namespace WhiteBox
  27. {
  28. struct IntersectionAndRenderData;
  29. //! The mode where 'mesh' edges can be promoted/restored to 'user' edges so the user can interact
  30. //! with them again or form new polygons to manipulate.
  31. class EdgeRestoreMode
  32. {
  33. public:
  34. AZ_CLASS_ALLOCATOR_DECL
  35. EdgeRestoreMode() = default;
  36. EdgeRestoreMode(EdgeRestoreMode&&) = default;
  37. EdgeRestoreMode& operator=(EdgeRestoreMode&&) = default;
  38. ~EdgeRestoreMode() = default;
  39. static void RegisterActionUpdaters();
  40. static void RegisterActions();
  41. static void BindActionsToModes(const AZStd::string& modeIdentifier);
  42. static void BindActionsToMenus();
  43. // Submode interface
  44. void Refresh();
  45. AZStd::vector<AzToolsFramework::ActionOverride> PopulateActions(
  46. const AZ::EntityComponentIdPair& entityComponentIdPair);
  47. void Display(
  48. const AZ::EntityComponentIdPair& entityComponentIdPair, const AZ::Transform& worldFromLocal,
  49. const IntersectionAndRenderData& renderData, const AzFramework::ViewportInfo& viewportInfo,
  50. AzFramework::DebugDisplayRequests& debugDisplay);
  51. bool HandleMouseInteraction(
  52. const AzToolsFramework::ViewportInteraction::MouseInteractionEvent& mouseInteraction,
  53. const AZ::EntityComponentIdPair& entityComponentIdPair,
  54. const AZStd::optional<EdgeIntersection>& edgeIntersection,
  55. const AZStd::optional<PolygonIntersection>& polygonIntersection,
  56. const AZStd::optional<VertexIntersection>& vertexIntersection);
  57. private:
  58. AZStd::optional<EdgeIntersection> m_edgeIntersection; //!< The hovered edge if one exists.
  59. AZStd::optional<VertexIntersection> m_vertexIntersection; //!< The hovered vertex if one exists.
  60. Api::EdgeHandles m_edgeHandlesBeingRestored; //!< The edge handles currently attempting to be restored.
  61. };
  62. } // namespace WhiteBox