ITransitionGUI.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Animancer // https://kybernetik.com.au/animancer // Copyright 2022 Kybernetik //
  2. #if UNITY_EDITOR
  3. using UnityEditor;
  4. using UnityEngine;
  5. namespace Animancer.Editor
  6. {
  7. /// <summary>[Editor-Only] An object that can draw custom GUI elements relating to transitions.</summary>
  8. /// https://kybernetik.com.au/animancer/api/Animancer.Editor/ITransitionGUI
  9. ///
  10. public interface ITransitionGUI
  11. {
  12. /************************************************************************************************************************/
  13. /// <summary>Called while drawing the GUI for the <see cref="TransitionPreviewWindow"/> scene.</summary>
  14. void OnPreviewSceneGUI(TransitionPreviewDetails details);
  15. /// <summary>
  16. /// Called while drawing the background GUI for the <see cref="TimelineGUI"/> for the
  17. /// <see cref="IHasEvents.Events"/>.
  18. /// </summary>
  19. void OnTimelineBackgroundGUI();
  20. /// <summary>
  21. /// Called while drawing the foreground GUI for the <see cref="TimelineGUI"/> for the
  22. /// <see cref="IHasEvents.Events"/>.
  23. /// </summary>
  24. void OnTimelineForegroundGUI();
  25. /************************************************************************************************************************/
  26. }
  27. }
  28. namespace Animancer.Editor
  29. {
  30. /// <summary>[Editor-Only] Details about the current preview used by <see cref="ITransitionGUI.OnPreviewSceneGUI"/>.</summary>
  31. /// https://kybernetik.com.au/animancer/api/Animancer.Editor/TransitionPreviewDetails
  32. ///
  33. public readonly struct TransitionPreviewDetails
  34. {
  35. /************************************************************************************************************************/
  36. /// <summary>The <see cref="AnimancerPlayable"/> used to play the preview.</summary>
  37. public readonly AnimancerPlayable Animancer;
  38. /// <summary>The <see cref="UnityEngine.Transform"/> of the <see cref="Animator"/> used to play the preview.</summary>
  39. public Transform Transform => Animancer.Component.Animator.transform;
  40. /************************************************************************************************************************/
  41. /// <summary>The <see cref="SerializedProperty"/> representing the target transition.</summary>
  42. public static SerializedProperty Property => TransitionDrawer.Context.Property;
  43. /// <summary>The current <see cref="ITransitionDetailed"/>.</summary>
  44. public static ITransitionDetailed Transition => TransitionDrawer.Context.Transition;
  45. /************************************************************************************************************************/
  46. /// <summary>Creates a new <see cref="TransitionPreviewDetails"/>.</summary>
  47. public TransitionPreviewDetails(AnimancerPlayable animancer)
  48. {
  49. Animancer = animancer;
  50. }
  51. /************************************************************************************************************************/
  52. }
  53. }
  54. #endif