From c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 19 Apr 2020 17:19:32 -0400 Subject: Inital commit --- .../Runtime/Events/Marker.cs | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Library/PackageCache/com.unity.timeline@1.2.13/Runtime/Events/Marker.cs (limited to 'Library/PackageCache/com.unity.timeline@1.2.13/Runtime/Events/Marker.cs') diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Runtime/Events/Marker.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Runtime/Events/Marker.cs new file mode 100644 index 0000000..2f12cd7 --- /dev/null +++ b/Library/PackageCache/com.unity.timeline@1.2.13/Runtime/Events/Marker.cs @@ -0,0 +1,53 @@ +using System; + +namespace UnityEngine.Timeline +{ + /// + /// Use Marker as a base class when creating a custom marker. + /// + /// + /// A marker is a point in time. + /// + public abstract class Marker : ScriptableObject, IMarker + { + [SerializeField, TimeField, Tooltip("Time for the marker")] double m_Time; + + /// + public TrackAsset parent { get; private set; } + + /// + /// + /// The marker time cannot be negative. + /// + public double time + { + get { return m_Time; } + set { m_Time = Math.Max(value, 0); } + } + + void IMarker.Initialize(TrackAsset parentTrack) + { + // We only really want to update the parent when the object is first deserialized + // If not a cloned track would "steal" the source's markers + if (parent == null) + { + parent = parentTrack; + try + { + OnInitialize(parentTrack); + } + catch (Exception e) + { + Debug.LogError(e.Message, this); + } + } + } + + /// + /// Override this method to receive a callback when the marker is initialized. + /// + public virtual void OnInitialize(TrackAsset aPent) + { + } + } +} -- cgit v1.2.3