CustomTrackDrawerAttribute.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. namespace UnityEditor.Timeline
  3. {
  4. // Tells a custom [[TrackDrawer]] which [[TrackAsset]] it's a drawer for.
  5. sealed class CustomTrackDrawerAttribute : Attribute
  6. {
  7. public Type assetType;
  8. public CustomTrackDrawerAttribute(Type type)
  9. {
  10. assetType = type;
  11. }
  12. }
  13. /// <summary>
  14. /// Attribute that specifies a class as an editor for an extended Timeline type.
  15. /// </summary>
  16. /// <remarks>
  17. /// Use this attribute on a class that extends ClipEditor, TrackEditor, or MarkerEditor to specify either the PlayableAsset, Marker, or TrackAsset derived classes for associated customization.
  18. /// </remarks>
  19. /// <example>
  20. /// [CustomTimelineEditor(typeof(LightControlClip))]
  21. /// class LightControlClipEditor : ClipEditor
  22. /// {
  23. /// }
  24. /// </example>
  25. [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
  26. public sealed class CustomTimelineEditorAttribute : Attribute
  27. {
  28. /// <summary>
  29. /// The type that that this editor applies to.
  30. /// </summary>
  31. public Type classToEdit { get; private set; }
  32. /// <summary>
  33. /// Constructor.
  34. /// </summary>
  35. /// <param name="type"> The type that that this editor applies to.</param>
  36. /// <exception cref="ArgumentNullException">Thrown if type is null</exception>
  37. public CustomTimelineEditorAttribute(Type type)
  38. {
  39. if (type == null)
  40. throw new System.ArgumentNullException(nameof(type));
  41. classToEdit = type;
  42. }
  43. }
  44. }