UiEditorAnimationBus.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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/EBus/EBus.h>
  10. #include <LyShine/UiBase.h>
  11. ////////////////////////////////////////////////////////////////////////////////////////////////////
  12. //! Interface class that the UI Editor Animation Window needs to implement
  13. //! (e.g. UiAnimViewDialog)
  14. class CUiAnimViewDialog;
  15. class CUiAnimViewSequence;
  16. class CUiAnimationContext;
  17. struct IUiAnimationSystem;
  18. class UiEditorAnimationInterface
  19. : public AZ::EBusTraits
  20. {
  21. public: // member functions
  22. virtual ~UiEditorAnimationInterface(){}
  23. //! Get the animation context for the UI animation window
  24. virtual CUiAnimationContext* GetAnimationContext() = 0;
  25. //! Get the active UI animation system, this is the animation system for the active canvas
  26. virtual IUiAnimationSystem* GetAnimationSystem() = 0;
  27. //! Get the active UI animation sequence in the UI Animation Window
  28. virtual CUiAnimViewSequence* GetCurrentSequence() = 0;
  29. //! Called when the active canvas in the UI Editor window changes so that the UI Editor
  30. //! animation window can update to show the correct sequences. Active canvas could change
  31. //! from a valid entity Id to an invalid entity Id and vice versa
  32. virtual void ActiveCanvasChanged() = 0;
  33. public: // static member functions
  34. static const char* GetUniqueName() { return "UiEditorAnimationInterface"; }
  35. };
  36. typedef AZ::EBus<UiEditorAnimationInterface> UiEditorAnimationBus;
  37. ////////////////////////////////////////////////////////////////////////////////////////////////////
  38. //! Interface class that the UI Editor Animation Window needs to implement
  39. //! (e.g. UiAnimViewDialog)
  40. class UiEditorAnimationStateInterface
  41. : public AZ::EBusTraits
  42. {
  43. public: // types
  44. struct UiEditorAnimationEditState
  45. {
  46. AZStd::string m_sequenceName;
  47. float m_time;
  48. float m_timelineScale;
  49. int m_timelineScrollOffset;
  50. };
  51. public: // member functions
  52. virtual ~UiEditorAnimationStateInterface(){}
  53. //! Get the current animation edit state
  54. virtual UiEditorAnimationEditState GetCurrentEditState() = 0;
  55. //! Restore the current animation edit state
  56. virtual void RestoreCurrentEditState(const UiEditorAnimationEditState& animEditState) = 0;
  57. public: // static member functions
  58. static const char* GetUniqueName() { return "UiEditorAnimationStateInterface"; }
  59. };
  60. typedef AZ::EBus<UiEditorAnimationStateInterface> UiEditorAnimationStateBus;
  61. ////////////////////////////////////////////////////////////////////////////////////////////////////
  62. //! Listener class that any UI Editor Animation class can implement to get notifications
  63. class UiEditorAnimListenerInterface
  64. : public AZ::EBusTraits
  65. {
  66. public: // member functions
  67. virtual ~UiEditorAnimListenerInterface(){}
  68. //! Called when the active canvas in the UI Editor window changes.
  69. //! When this is called the UiEditorAnimationBus may be used to get the new active canvas.
  70. //! Active canvas could change from a valid entity Id to an invalid entity Id and vice versa
  71. virtual void OnActiveCanvasChanged() = 0;
  72. //! Called when UI elements have been deleted from or re-added to the canvas
  73. //! This requires the sequences to be updated
  74. virtual void OnUiElementsDeletedOrReAdded() {};
  75. public: // static member functions
  76. static const char* GetUniqueName() { return "UiEditorAnimListenerInterface"; }
  77. };
  78. typedef AZ::EBus<UiEditorAnimListenerInterface> UiEditorAnimListenerBus;