EditorTrackViewEventsBus.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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/std/any.h>
  10. namespace AzToolsFramework
  11. {
  12. /**
  13. * This bus can be used to send commands to the track view.
  14. */
  15. class EditorLayerTrackViewRequests
  16. : public AZ::ComponentBus
  17. {
  18. public:
  19. /**
  20. * Gets the number of sequences.
  21. */
  22. virtual int GetNumSequences() = 0;
  23. /**
  24. * Creates a new sequence of the given type(0 = Object Entity Sequence(Legacy), 1 = Component Entity Sequence(PREVIEW)) with the given name.
  25. */
  26. virtual void NewSequence(const char* name, int sequenceType) = 0;
  27. /**
  28. * Plays the current sequence in TrackView.
  29. */
  30. virtual void PlaySequence() = 0;
  31. /**
  32. * Stops any sequence currently playing in TrackView.
  33. */
  34. virtual void StopSequence() = 0;
  35. /**
  36. * Sets the time of the sequence currently playing in TrackView.
  37. */
  38. virtual void SetSequenceTime(float time) = 0;
  39. /**
  40. * Adds an entity node(s) from viewport selection to the current sequence.
  41. */
  42. virtual void AddSelectedEntities() = 0;
  43. /**
  44. * Adds a layer node from the current layer to the current sequence.
  45. */
  46. virtual void AddLayerNode() = 0;
  47. /**
  48. * Adds a track of the given parameter ID to the node.
  49. */
  50. virtual void AddTrack(const char* paramName, const char* nodeName, const char* parentDirectorName) = 0;
  51. /**
  52. * Deletes a track of the given parameter ID (in the given index in case of a multi-track) from the node.
  53. */
  54. virtual void DeleteTrack(const char* paramName, uint32 index, const char* nodeName, const char* parentDirectorName) = 0;
  55. /**
  56. * Gets number of keys of the specified track.
  57. */
  58. virtual int GetNumTrackKeys(const char* paramName, int trackIndex, const char* nodeName, const char* parentDirectorName) = 0;
  59. /**
  60. * Activates/deactivates TrackView recording mode.
  61. */
  62. virtual void SetRecording(bool bRecording) = 0;
  63. /**
  64. * Deletes the specified sequence.
  65. */
  66. virtual void DeleteSequence(const char* name) = 0;
  67. /**
  68. * Sets the specified sequence as a current one in TrackView.
  69. */
  70. virtual void SetCurrentSequence(const char* name) = 0;
  71. /**
  72. * Gets the name of a sequence by its index.
  73. */
  74. virtual AZStd::string GetSequenceName(unsigned int index) = 0;
  75. /**
  76. * Gets the time range of a sequence as a pair.
  77. */
  78. virtual TRange<float> GetSequenceTimeRange(const char* name) = 0;
  79. /**
  80. * Adds a new node with the given type & name to the current sequence.
  81. */
  82. virtual void AddNode(const char* nodeTypeString, const char* nodeName) = 0;
  83. /**
  84. * Deletes the specified node from the current sequence.
  85. */
  86. virtual void DeleteNode(AZStd::string_view nodeName, AZStd::string_view parentDirectorName) = 0;
  87. /**
  88. * Gets the number of nodes.
  89. */
  90. virtual int GetNumNodes(AZStd::string_view parentDirectorName) = 0;
  91. /**
  92. * Gets the name of a sequence by its index.
  93. */
  94. virtual AZStd::string GetNodeName(int index, AZStd::string_view parentDirectorName) = 0;
  95. /**
  96. * Gets the value of the specified key.
  97. */
  98. virtual AZStd::any GetKeyValue(const char* paramName, int trackIndex, int keyIndex, const char* nodeName, const char* parentDirectorName) = 0;
  99. /**
  100. * Gets the interpolated value of a track at the specified time.
  101. */
  102. virtual AZStd::any GetInterpolatedValue(const char* paramName, int trackIndex, float time, const char* nodeName, const char* parentDirectorName) = 0;
  103. /**
  104. * Sets the time range of a sequence.
  105. */
  106. virtual void SetSequenceTimeRange(const char* name, float start, float end) = 0;
  107. };
  108. using EditorLayerTrackViewRequestBus = AZ::EBus<EditorLayerTrackViewRequests>;
  109. }