using System; using UnityEngine; namespace UnityEngine.Timeline { /// /// Specifies the type of PlayableAsset that a TrackAsset derived class can create clips of. /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public class TrackClipTypeAttribute : Attribute { /// /// The type of the clip class associate with this track /// public readonly Type inspectedType; /// /// Whether to allow automatic creation of these types. /// public readonly bool allowAutoCreate; // true will make it show up in menus /// /// /// The type of the clip class to associate with this track. Must derive from PlayableAsset. public TrackClipTypeAttribute(Type clipClass) { inspectedType = clipClass; allowAutoCreate = true; } /// /// /// The type of the clip class to associate with this track. Must derive from PlayableAsset. /// Whether to allow automatic creation of these types. Default value is true. /// Setting allowAutoCreate to false will cause Timeline to not show menu items for creating clips of this type. public TrackClipTypeAttribute(Type clipClass, bool allowAutoCreate) { inspectedType = clipClass; allowAutoCreate = false; } } /// /// Apply this to a PlayableBehaviour class or field to indicate that it is not animatable. /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Class)] public class NotKeyableAttribute : Attribute { } /// /// Options for track binding /// [Flags] public enum TrackBindingFlags { /// /// No options specified /// None = 0, /// /// Allow automatic creating of component during gameObject drag and drop /// AllowCreateComponent = 1, /// /// All options specified /// All = AllowCreateComponent } /// /// Specifies the type of object that should be bound to a TrackAsset. /// /// /// /// /// /// Use this attribute when creating Custom Tracks to specify the type of object the track requires a binding to. /// [AttributeUsage(AttributeTargets.Class)] public class TrackBindingTypeAttribute : Attribute { /// /// The type of binding for the associate track. /// public readonly Type type; /// /// Options for the the track binding /// public readonly TrackBindingFlags flags; /// /// Creates a new TrackBindingTypeAttribute. /// /// public TrackBindingTypeAttribute(Type type) { this.type = type; this.flags = TrackBindingFlags.All; } /// /// Creates a new TrackBindingTypeAttribute. /// /// /// public TrackBindingTypeAttribute(Type type, TrackBindingFlags flags) { this.type = type; this.flags = flags; } } // indicates that child tracks are permitted on a track // internal because not fully supported on custom classes yet [AttributeUsage(AttributeTargets.Class, Inherited = false)] class SupportsChildTracksAttribute : Attribute { public readonly Type childType; public readonly int levels; public SupportsChildTracksAttribute(Type childType = null, int levels = Int32.MaxValue) { this.childType = childType; this.levels = levels; } } // indicates that the type should not be put on a PlayableTrack [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] class IgnoreOnPlayableTrackAttribute : System.Attribute { } // used to flag properties as using a time field (second/frames) display class TimeFieldAttribute : PropertyAttribute { public enum UseEditMode { None, ApplyEditMode } public UseEditMode useEditMode { get; } public TimeFieldAttribute(UseEditMode useEditMode = UseEditMode.ApplyEditMode) { this.useEditMode = useEditMode; } } class FrameRateFieldAttribute : PropertyAttribute { } /// /// Use this attribute to hide a class from Timeline menus. /// [AttributeUsage(AttributeTargets.Class, Inherited = false)] public class HideInMenuAttribute : Attribute { } /// /// Use this attribute to customize the appearance of a Marker. /// /// Specify the style to use to draw a Marker. /// /// /// /// How to create a custom style rule: /// 1) Create a 'common.uss' USS file in an Editor folder in a StyleSheets/Extensions folder hierarchy. /// Example of valid folder paths: /// - Assets/Editor/StyleSheets/Extensions /// - Assets/Editor/Markers/StyleSheets/Extensions /// - Assets/Timeline/Editor/MyMarkers/StyleSheets/Extensions /// Rules in 'dark.uss' are used if you use the Pro Skin and rules in 'light.uss' are used otherwise. /// /// 2)In the USS file, create a styling rule to customize the appearance of the marker. /// /// /// MyStyle /// { /// /* Specify the appearance of the marker in the collapsed state here. */ /// } /// /// MyStyle:checked /// { /// /* Specify the appearance of the marker in the expanded state here. */ /// } /// /// MyStyle:focused:checked /// { /// /* Specify the appearance of the marker in the selected state here. */ /// } /// /// /// [AttributeUsage(AttributeTargets.Class)] public class CustomStyleAttribute : Attribute { /// /// The name of the USS style. /// public readonly string ussStyle; /// /// Creates a new CustomStyleAttribute. /// /// public CustomStyleAttribute(string ussStyle) { this.ussStyle = ussStyle; } } /// /// Use this attribute to assign a clip, marker or track to a category in a submenu /// [AttributeUsage(AttributeTargets.Class)] internal class MenuCategoryAttribute : Attribute { /// /// The menu name of the category /// public readonly string category; public MenuCategoryAttribute(string category) { this.category = category ?? string.Empty; } } }