暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TrackAction.cs 1.6KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections.Generic;
  2. using UnityEngine.Timeline;
  3. namespace UnityEditor.Timeline.Actions
  4. {
  5. /// <summary>
  6. /// Base class for a track action.
  7. /// Inherit from this class to make an action that would react on selected tracks after a menu click and/or a key shortcut.
  8. /// </summary>
  9. /// <example>
  10. /// Simple track Action example (with context menu and shortcut support).
  11. /// <code source="../../DocCodeExamples/ActionExamples.cs" region="declare-sampleTrackAction" title="SampleTrackAction"/>
  12. /// </example>
  13. /// <remarks>
  14. /// To add an action as a menu item in the Timeline context menu, add <see cref="MenuEntryAttribute"/> on the action class.
  15. /// To make an action to react to a shortcut, use the Shortcut Manager API with <see cref="TimelineShortcutAttribute"/>.
  16. /// <seealso cref="UnityEditor.ShortcutManagement.ShortcutAttribute"/>
  17. /// </remarks>
  18. [ActiveInMode(TimelineModes.Default)]
  19. public abstract class TrackAction : IAction
  20. {
  21. /// <summary>
  22. /// Execute the action.
  23. /// </summary>
  24. /// <param name="tracks">Tracks that will be used for the action. </param>
  25. /// <returns>true if the action has been executed. false otherwise</returns>
  26. public abstract bool Execute(IEnumerable<TrackAsset> tracks);
  27. /// <summary>
  28. /// Defines the validity of an Action for a given set of tracks.
  29. /// </summary>
  30. /// <param name="tracks">tracks that the action would act on.</param>
  31. /// <returns>The validity of the set of tracks.</returns>
  32. public abstract ActionValidity Validate(IEnumerable<TrackAsset> tracks);
  33. }
  34. }