summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Utilities/CustomTrackDrawerAttribute.cs
blob: 021a635ad9be9d530b7a0921421aad439b695a46 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;

namespace UnityEditor.Timeline
{
    // Tells a custom [[TrackDrawer]] which [[TrackAsset]] it's a drawer for.
    sealed class CustomTrackDrawerAttribute : Attribute
    {
        public Type assetType;
        public CustomTrackDrawerAttribute(Type type)
        {
            assetType = type;
        }
    }

    /// <summary>
    /// Attribute that specifies a class as an editor for an extended Timeline type.
    /// </summary>
    /// <remarks>
    /// 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.
    /// </remarks>
    /// <example>
    /// [CustomTimelineEditor(typeof(LightControlClip))]
    /// class LightControlClipEditor : ClipEditor
    /// {
    /// }
    /// </example>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
    public sealed class CustomTimelineEditorAttribute : Attribute
    {
        /// <summary>
        /// The type that that this editor applies to.
        /// </summary>
        public Type classToEdit { get; private set; }

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="type"> The type that that this editor applies to.</param>
        /// <exception cref="ArgumentNullException">Thrown if type is null</exception>
        public CustomTimelineEditorAttribute(Type type)
        {
            if (type == null)
                throw new System.ArgumentNullException(nameof(type));
            classToEdit = type;
        }
    }
}