894 lines
23 KiB
C#
894 lines
23 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine.Animations;
|
|
using UnityEngine.Playables;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace UnityEngine.Timeline
|
|
{
|
|
// Token: 0x0200001F RID: 31
|
|
[Serializable]
|
|
public abstract class TrackAsset : PlayableAsset, IInterval, ISerializationCallbackReceiver, IPropertyPreview
|
|
{
|
|
// Token: 0x060000F7 RID: 247 RVA: 0x00002713 File Offset: 0x00000913
|
|
protected TrackAsset()
|
|
{
|
|
this.m_MediaType = TrackAsset.GetMediaType(base.GetType());
|
|
}
|
|
|
|
// Token: 0x1700004E RID: 78
|
|
// (get) Token: 0x060000F8 RID: 248 RVA: 0x00002744 File Offset: 0x00000944
|
|
// (set) Token: 0x060000F9 RID: 249 RVA: 0x0000275E File Offset: 0x0000095E
|
|
public int intervalBit { get; set; }
|
|
|
|
// Token: 0x1700004F RID: 79
|
|
// (get) Token: 0x060000FA RID: 250 RVA: 0x00002768 File Offset: 0x00000968
|
|
public double start
|
|
{
|
|
get
|
|
{
|
|
this.UpdateDuration();
|
|
return (double)this.m_Start;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000050 RID: 80
|
|
// (get) Token: 0x060000FB RID: 251 RVA: 0x00002790 File Offset: 0x00000990
|
|
public double end
|
|
{
|
|
get
|
|
{
|
|
this.UpdateDuration();
|
|
return (double)this.m_End;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000051 RID: 81
|
|
// (get) Token: 0x060000FC RID: 252 RVA: 0x000027B8 File Offset: 0x000009B8
|
|
public long intervalStart
|
|
{
|
|
get
|
|
{
|
|
return this.m_Start.GetTick();
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000052 RID: 82
|
|
// (get) Token: 0x060000FD RID: 253 RVA: 0x000027D8 File Offset: 0x000009D8
|
|
public long intervalEnd
|
|
{
|
|
get
|
|
{
|
|
return this.m_End.GetTick();
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000053 RID: 83
|
|
// (get) Token: 0x060000FE RID: 254 RVA: 0x000027F8 File Offset: 0x000009F8
|
|
public sealed override double duration
|
|
{
|
|
get
|
|
{
|
|
this.UpdateDuration();
|
|
return (double)(this.m_End - this.m_Start);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000054 RID: 84
|
|
// (get) Token: 0x060000FF RID: 255 RVA: 0x0000282C File Offset: 0x00000A2C
|
|
// (set) Token: 0x06000100 RID: 256 RVA: 0x00002847 File Offset: 0x00000A47
|
|
public bool muted
|
|
{
|
|
get
|
|
{
|
|
return this.m_Muted;
|
|
}
|
|
set
|
|
{
|
|
this.m_Muted = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000055 RID: 85
|
|
// (get) Token: 0x06000101 RID: 257 RVA: 0x00002854 File Offset: 0x00000A54
|
|
public TimelineAsset timelineAsset
|
|
{
|
|
get
|
|
{
|
|
TrackAsset trackAsset = this;
|
|
while (trackAsset != null)
|
|
{
|
|
TimelineAsset timelineAsset;
|
|
if (trackAsset.parent == null)
|
|
{
|
|
timelineAsset = null;
|
|
}
|
|
else
|
|
{
|
|
TimelineAsset timelineAsset2 = trackAsset.parent as TimelineAsset;
|
|
if (!(timelineAsset2 != null))
|
|
{
|
|
trackAsset = trackAsset.parent as TrackAsset;
|
|
continue;
|
|
}
|
|
timelineAsset = timelineAsset2;
|
|
}
|
|
return timelineAsset;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000056 RID: 86
|
|
// (get) Token: 0x06000102 RID: 258 RVA: 0x000028C4 File Offset: 0x00000AC4
|
|
// (set) Token: 0x06000103 RID: 259 RVA: 0x000028DF File Offset: 0x00000ADF
|
|
public PlayableAsset parent
|
|
{
|
|
get
|
|
{
|
|
return this.m_Parent;
|
|
}
|
|
internal set
|
|
{
|
|
this.m_Parent = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000104 RID: 260 RVA: 0x000028EC File Offset: 0x00000AEC
|
|
public IEnumerable<TimelineClip> GetClips()
|
|
{
|
|
return this.clips;
|
|
}
|
|
|
|
// Token: 0x17000057 RID: 87
|
|
// (get) Token: 0x06000105 RID: 261 RVA: 0x00002908 File Offset: 0x00000B08
|
|
internal TimelineClip[] clips
|
|
{
|
|
get
|
|
{
|
|
if (this.m_Clips == null)
|
|
{
|
|
this.m_Clips = new List<TimelineClip>();
|
|
}
|
|
if (this.m_ClipsCache == null)
|
|
{
|
|
this.m_ClipsCache = this.m_Clips.ToArray();
|
|
}
|
|
return this.m_ClipsCache;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000058 RID: 88
|
|
// (get) Token: 0x06000106 RID: 262 RVA: 0x00002958 File Offset: 0x00000B58
|
|
public bool isEmpty
|
|
{
|
|
get
|
|
{
|
|
return this.m_Clips == null || this.m_Clips.Count == 0;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000059 RID: 89
|
|
// (get) Token: 0x06000107 RID: 263 RVA: 0x0000298C File Offset: 0x00000B8C
|
|
public bool isSubTrack
|
|
{
|
|
get
|
|
{
|
|
TrackAsset trackAsset = this.parent as TrackAsset;
|
|
return trackAsset != null && trackAsset.GetType() == base.GetType();
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700005A RID: 90
|
|
// (get) Token: 0x06000108 RID: 264 RVA: 0x000029CC File Offset: 0x00000BCC
|
|
public override IEnumerable<PlayableBinding> outputs
|
|
{
|
|
get
|
|
{
|
|
TrackBindingTypeAttribute attribute = Attribute.GetCustomAttribute(base.GetType(), typeof(TrackBindingTypeAttribute)) as TrackBindingTypeAttribute;
|
|
Type trackBindingType = ((attribute == null) ? null : attribute.type);
|
|
yield return new PlayableBinding
|
|
{
|
|
sourceObject = this,
|
|
streamName = base.name,
|
|
streamType = DataStreamType.None,
|
|
sourceBindingType = trackBindingType
|
|
};
|
|
yield break;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000109 RID: 265 RVA: 0x000029F8 File Offset: 0x00000BF8
|
|
public IEnumerable<TrackAsset> GetChildTracks()
|
|
{
|
|
return this.m_Children.ToArray();
|
|
}
|
|
|
|
// Token: 0x1700005B RID: 91
|
|
// (get) Token: 0x0600010A RID: 266 RVA: 0x00002A18 File Offset: 0x00000C18
|
|
// (set) Token: 0x0600010B RID: 267 RVA: 0x00002A33 File Offset: 0x00000C33
|
|
internal string customPlayableTypename
|
|
{
|
|
get
|
|
{
|
|
return this.m_CustomPlayableFullTypename;
|
|
}
|
|
set
|
|
{
|
|
this.m_CustomPlayableFullTypename = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700005C RID: 92
|
|
// (get) Token: 0x0600010C RID: 268 RVA: 0x00002A40 File Offset: 0x00000C40
|
|
// (set) Token: 0x0600010D RID: 269 RVA: 0x00002A5B File Offset: 0x00000C5B
|
|
internal AnimationClip animClip
|
|
{
|
|
get
|
|
{
|
|
return this.m_AnimClip;
|
|
}
|
|
set
|
|
{
|
|
this.m_AnimClip = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700005D RID: 93
|
|
// (get) Token: 0x0600010E RID: 270 RVA: 0x00002A68 File Offset: 0x00000C68
|
|
// (set) Token: 0x0600010F RID: 271 RVA: 0x00002A82 File Offset: 0x00000C82
|
|
internal bool displayCascadeClips { get; set; }
|
|
|
|
// Token: 0x1700005E RID: 94
|
|
// (get) Token: 0x06000110 RID: 272 RVA: 0x00002A8C File Offset: 0x00000C8C
|
|
// (set) Token: 0x06000111 RID: 273 RVA: 0x00002AA7 File Offset: 0x00000CA7
|
|
internal bool soloed
|
|
{
|
|
get
|
|
{
|
|
return this.m_Soloed;
|
|
}
|
|
set
|
|
{
|
|
this.m_Soloed = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700005F RID: 95
|
|
// (get) Token: 0x06000112 RID: 274 RVA: 0x00002AB4 File Offset: 0x00000CB4
|
|
// (set) Token: 0x06000113 RID: 275 RVA: 0x00002ACF File Offset: 0x00000CCF
|
|
internal float height
|
|
{
|
|
get
|
|
{
|
|
return this.m_Height;
|
|
}
|
|
set
|
|
{
|
|
this.m_Height = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000060 RID: 96
|
|
// (get) Token: 0x06000114 RID: 276 RVA: 0x00002ADC File Offset: 0x00000CDC
|
|
// (set) Token: 0x06000115 RID: 277 RVA: 0x00002AF7 File Offset: 0x00000CF7
|
|
internal List<TrackAsset> subTracks
|
|
{
|
|
get
|
|
{
|
|
return this.m_Children;
|
|
}
|
|
set
|
|
{
|
|
this.m_Children = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000061 RID: 97
|
|
// (get) Token: 0x06000116 RID: 278 RVA: 0x00002B04 File Offset: 0x00000D04
|
|
// (set) Token: 0x06000117 RID: 279 RVA: 0x00002B1F File Offset: 0x00000D1F
|
|
internal bool locked
|
|
{
|
|
get
|
|
{
|
|
return this.m_Locked;
|
|
}
|
|
set
|
|
{
|
|
this.m_Locked = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000062 RID: 98
|
|
// (get) Token: 0x06000118 RID: 280 RVA: 0x00002B2C File Offset: 0x00000D2C
|
|
internal TimelineAsset.MediaType mediaType
|
|
{
|
|
get
|
|
{
|
|
return this.m_MediaType;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000063 RID: 99
|
|
// (get) Token: 0x06000119 RID: 281 RVA: 0x00002B48 File Offset: 0x00000D48
|
|
internal virtual bool compilable
|
|
{
|
|
get
|
|
{
|
|
return !this.muted && !this.isEmpty;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600011A RID: 282 RVA: 0x00002B74 File Offset: 0x00000D74
|
|
public void OnBeforeSerialize()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600011B RID: 283 RVA: 0x00002B77 File Offset: 0x00000D77
|
|
public void OnAfterDeserialize()
|
|
{
|
|
this.m_ClipsCache = null;
|
|
this.InvalidateTimelineCaches();
|
|
}
|
|
|
|
// Token: 0x0600011C RID: 284 RVA: 0x00002B88 File Offset: 0x00000D88
|
|
public virtual void OnEnable()
|
|
{
|
|
if (this.m_Children == null)
|
|
{
|
|
this.m_Children = new List<TrackAsset>();
|
|
}
|
|
if (this.m_Clips == null)
|
|
{
|
|
this.m_Clips = new List<TimelineClip>();
|
|
}
|
|
if (this.m_Children.Count > 0)
|
|
{
|
|
List<TrackAsset> list = this.m_Children.Where((TrackAsset t) => t != null).ToList<TrackAsset>();
|
|
this.m_Children = list;
|
|
}
|
|
this.displayCascadeClips = false;
|
|
}
|
|
|
|
// Token: 0x0600011D RID: 285 RVA: 0x00002C14 File Offset: 0x00000E14
|
|
public virtual Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
|
|
{
|
|
return Playable.Create(graph, inputCount);
|
|
}
|
|
|
|
// Token: 0x0600011E RID: 286 RVA: 0x00002C30 File Offset: 0x00000E30
|
|
public sealed override Playable CreatePlayable(PlayableGraph graph, GameObject go)
|
|
{
|
|
return Playable.Null;
|
|
}
|
|
|
|
// Token: 0x0600011F RID: 287 RVA: 0x00002C4C File Offset: 0x00000E4C
|
|
public TimelineClip CreateDefaultClip()
|
|
{
|
|
TrackClipTypeAttribute trackClipTypeAttribute = base.GetType().GetCustomAttributes(typeof(TrackClipTypeAttribute), true).OfType<TrackClipTypeAttribute>()
|
|
.FirstOrDefault((TrackClipTypeAttribute t) => typeof(IPlayableAsset).IsAssignableFrom(t.inspectedType) && typeof(ScriptableObject).IsAssignableFrom(t.inspectedType));
|
|
TimelineClip timelineClip;
|
|
if (trackClipTypeAttribute == null)
|
|
{
|
|
Debug.LogWarning("Cannot create a default clip for type " + base.GetType());
|
|
timelineClip = null;
|
|
}
|
|
else
|
|
{
|
|
timelineClip = this.CreateClipOfType(trackClipTypeAttribute.inspectedType);
|
|
}
|
|
return timelineClip;
|
|
}
|
|
|
|
// Token: 0x06000120 RID: 288 RVA: 0x00002CD0 File Offset: 0x00000ED0
|
|
internal TimelineClip CreateClipOfType(Type type)
|
|
{
|
|
if (type == null || !typeof(IPlayableAsset).IsAssignableFrom(type) || !typeof(ScriptableObject).IsAssignableFrom(type))
|
|
{
|
|
throw new InvalidOperationException("Cannot create an clip for type " + type.Name);
|
|
}
|
|
ScriptableObject scriptableObject = ScriptableObject.CreateInstance(type);
|
|
if (scriptableObject == null)
|
|
{
|
|
throw new InvalidOperationException("Could not create an instance of the ScriptableObject type " + type.Name);
|
|
}
|
|
scriptableObject.name = type.Name;
|
|
TimelineCreateUtilities.SaveAssetIntoObject(scriptableObject, this);
|
|
TimelineClip timelineClip = this.CreateNewClipContainerInternal();
|
|
timelineClip.displayName = scriptableObject.name;
|
|
timelineClip.asset = scriptableObject;
|
|
try
|
|
{
|
|
this.OnCreateClipFromAsset(scriptableObject, timelineClip);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Debug.LogError(ex.Message, scriptableObject);
|
|
return null;
|
|
}
|
|
this.AddClip(timelineClip);
|
|
return timelineClip;
|
|
}
|
|
|
|
// Token: 0x06000121 RID: 289 RVA: 0x00002DC0 File Offset: 0x00000FC0
|
|
internal void AddClip(TimelineClip newClip)
|
|
{
|
|
if (!this.m_Clips.Contains(newClip))
|
|
{
|
|
this.m_Clips.Add(newClip);
|
|
this.m_ClipsCache = null;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000122 RID: 290 RVA: 0x00002DEC File Offset: 0x00000FEC
|
|
internal Playable CreatePlayableGraph(PlayableGraph graph, GameObject go, IntervalTree tree)
|
|
{
|
|
this.UpdateDuration();
|
|
return this.OnCreatePlayableGraph(graph, go, tree);
|
|
}
|
|
|
|
// Token: 0x06000123 RID: 291 RVA: 0x00002E10 File Offset: 0x00001010
|
|
internal virtual Playable OnCreatePlayableGraph(PlayableGraph graph, GameObject go, IntervalTree tree)
|
|
{
|
|
if (tree == null)
|
|
{
|
|
throw new ArgumentException("IntervalTree argument cannot be null", "tree");
|
|
}
|
|
if (go == null)
|
|
{
|
|
throw new ArgumentException("GameObject argument cannot be null", "go");
|
|
}
|
|
Playable playable = this.CreateTrackMixer(graph, go, this.clips.Length);
|
|
for (int i = 0; i < this.clips.Length; i++)
|
|
{
|
|
Playable playable2 = this.CreatePlayable(graph, go, this.clips[i]);
|
|
if (playable2.IsValid<Playable>())
|
|
{
|
|
playable2.SetDuration(this.clips[i].duration);
|
|
RuntimeClip runtimeClip = new RuntimeClip(this.clips[i], playable2, playable);
|
|
tree.Add(runtimeClip);
|
|
graph.Connect<Playable, Playable>(playable2, 0, playable, i);
|
|
playable.SetInputWeight(i, 0f);
|
|
}
|
|
}
|
|
return playable;
|
|
}
|
|
|
|
// Token: 0x06000124 RID: 292 RVA: 0x00002EE8 File Offset: 0x000010E8
|
|
internal bool IsCompatibleWithClip(TimelineClip clip)
|
|
{
|
|
return this.ValidateClipType(clip.underlyingAsset.GetType());
|
|
}
|
|
|
|
// Token: 0x06000125 RID: 293 RVA: 0x00002F0E File Offset: 0x0000110E
|
|
internal void SortClips()
|
|
{
|
|
this.m_Clips.Sort((TimelineClip clip1, TimelineClip clip2) => clip1.start.CompareTo(clip2.start));
|
|
this.m_ClipsCache = null;
|
|
}
|
|
|
|
// Token: 0x06000126 RID: 294 RVA: 0x00002F40 File Offset: 0x00001140
|
|
internal void SetClips(List<TimelineClip> clips)
|
|
{
|
|
this.m_Clips = clips;
|
|
this.m_ClipsCache = clips.ToArray();
|
|
}
|
|
|
|
// Token: 0x06000127 RID: 295 RVA: 0x00002F58 File Offset: 0x00001158
|
|
internal TimelineClip CreateClipFromAsset(Object asset)
|
|
{
|
|
TimelineClip timelineClip;
|
|
if (asset == null)
|
|
{
|
|
timelineClip = null;
|
|
}
|
|
else
|
|
{
|
|
TimelineAsset timelineAsset = asset as TimelineAsset;
|
|
if (timelineAsset == null && !this.ValidateClipType(asset.GetType()))
|
|
{
|
|
throw new InvalidOperationException(string.Format("Cannot create a clip for track {0} with clip type: {1}. Did you forget a ClipClass attribute?", base.GetType(), asset.GetType()));
|
|
}
|
|
TimelineClip timelineClip2 = this.CreateNewClipContainerInternal();
|
|
timelineClip2.underlyingAsset = asset;
|
|
timelineClip2.displayName = asset.name;
|
|
timelineClip2.asset = asset;
|
|
try
|
|
{
|
|
this.OnCreateClipFromAsset(asset, timelineClip2);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Debug.LogError(ex.Message, asset);
|
|
this.RemoveClip(timelineClip2);
|
|
return null;
|
|
}
|
|
timelineClip = timelineClip2;
|
|
}
|
|
return timelineClip;
|
|
}
|
|
|
|
// Token: 0x06000128 RID: 296 RVA: 0x00003020 File Offset: 0x00001220
|
|
internal virtual void OnCreateClipFromAsset(Object asset, TimelineClip clip)
|
|
{
|
|
clip.asset = asset;
|
|
clip.underlyingAsset = asset;
|
|
clip.displayName = asset.name;
|
|
IPlayableAsset playableAsset = asset as IPlayableAsset;
|
|
if (playableAsset != null)
|
|
{
|
|
double duration = playableAsset.duration;
|
|
if (duration > 0.0 && !double.IsInfinity(duration))
|
|
{
|
|
clip.duration = duration;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000129 RID: 297 RVA: 0x00003080 File Offset: 0x00001280
|
|
internal TimelineClip CreateNewClipContainerInternal()
|
|
{
|
|
TimelineClip timelineClip = new TimelineClip(this);
|
|
timelineClip.asset = null;
|
|
double num = 0.0;
|
|
for (int i = 0; i < this.m_Clips.Count - 1; i++)
|
|
{
|
|
double num2 = this.m_Clips[i].duration;
|
|
if (double.IsInfinity(num2))
|
|
{
|
|
num2 = (double)TimelineClip.kDefaultClipDurationInSeconds;
|
|
}
|
|
num = Math.Max(num, this.m_Clips[i].start + num2);
|
|
}
|
|
timelineClip.mixInCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
|
|
timelineClip.mixOutCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
|
|
timelineClip.start = num;
|
|
timelineClip.duration = (double)TimelineClip.kDefaultClipDurationInSeconds;
|
|
timelineClip.displayName = "untitled";
|
|
return timelineClip;
|
|
}
|
|
|
|
// Token: 0x0600012A RID: 298 RVA: 0x0000316A File Offset: 0x0000136A
|
|
internal void AddChild(TrackAsset child)
|
|
{
|
|
if (!(child == null))
|
|
{
|
|
this.m_Children.Add(child);
|
|
child.parent = this;
|
|
this.InvalidateTimelineCaches();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600012B RID: 299 RVA: 0x00003198 File Offset: 0x00001398
|
|
internal bool AddChildAfter(TrackAsset child, TrackAsset other)
|
|
{
|
|
bool flag;
|
|
if (child == null)
|
|
{
|
|
flag = false;
|
|
}
|
|
else
|
|
{
|
|
int num = this.m_Children.IndexOf(other);
|
|
if (num >= 0 && num != this.m_Children.Count - 1)
|
|
{
|
|
this.m_Children.Insert(num + 1, child);
|
|
}
|
|
else
|
|
{
|
|
this.m_Children.Add(child);
|
|
}
|
|
this.InvalidateTimelineCaches();
|
|
child.parent = this;
|
|
flag = true;
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x0600012C RID: 300 RVA: 0x00003218 File Offset: 0x00001418
|
|
internal bool RemoveSubTrack(TrackAsset child)
|
|
{
|
|
bool flag;
|
|
if (this.m_Children.Remove(child))
|
|
{
|
|
this.InvalidateTimelineCaches();
|
|
child.parent = null;
|
|
flag = true;
|
|
}
|
|
else
|
|
{
|
|
flag = false;
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x0600012D RID: 301 RVA: 0x00003254 File Offset: 0x00001454
|
|
internal void RemoveClip(TimelineClip clip)
|
|
{
|
|
this.m_Clips.Remove(clip);
|
|
this.m_ClipsCache = null;
|
|
}
|
|
|
|
// Token: 0x0600012E RID: 302 RVA: 0x0000326C File Offset: 0x0000146C
|
|
internal virtual void GetEvaluationTime(out double outStart, out double outDuration)
|
|
{
|
|
if (this.clips.Length == 0)
|
|
{
|
|
outStart = 0.0;
|
|
outDuration = 0.0;
|
|
}
|
|
else
|
|
{
|
|
outStart = double.MaxValue;
|
|
double num = 0.0;
|
|
for (int i = 0; i < this.clips.Length; i++)
|
|
{
|
|
outStart = Math.Min(this.clips[i].start, outStart);
|
|
num = Math.Max(this.clips[i].start + this.clips[i].duration, num);
|
|
}
|
|
outStart = Math.Max(outStart, 0.0);
|
|
outDuration = num - outStart;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600012F RID: 303 RVA: 0x00003323 File Offset: 0x00001523
|
|
internal virtual void GetSequenceTime(out double outStart, out double outDuration)
|
|
{
|
|
this.GetEvaluationTime(out outStart, out outDuration);
|
|
}
|
|
|
|
// Token: 0x06000130 RID: 304 RVA: 0x00003330 File Offset: 0x00001530
|
|
public virtual void GatherProperties(PlayableDirector director, IPropertyCollector driver)
|
|
{
|
|
GameObject gameObjectBinding = this.GetGameObjectBinding(director);
|
|
if (gameObjectBinding != null)
|
|
{
|
|
driver.PushActiveGameObject(gameObjectBinding);
|
|
}
|
|
if (this.animClip != null)
|
|
{
|
|
driver.AddFromClip(this.animClip);
|
|
}
|
|
foreach (TimelineClip timelineClip in this.clips)
|
|
{
|
|
if (timelineClip.curves != null && timelineClip.asset != null)
|
|
{
|
|
driver.AddObjectProperties(timelineClip.asset, timelineClip.curves);
|
|
}
|
|
IPropertyPreview propertyPreview = timelineClip.asset as IPropertyPreview;
|
|
if (propertyPreview != null)
|
|
{
|
|
propertyPreview.GatherProperties(director, driver);
|
|
}
|
|
}
|
|
foreach (TrackAsset trackAsset in this.subTracks)
|
|
{
|
|
if (trackAsset != null)
|
|
{
|
|
trackAsset.GatherProperties(director, driver);
|
|
}
|
|
}
|
|
if (gameObjectBinding != null)
|
|
{
|
|
driver.PopActiveGameObject();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000131 RID: 305 RVA: 0x00003460 File Offset: 0x00001660
|
|
internal GameObject GetGameObjectBinding(PlayableDirector director)
|
|
{
|
|
GameObject gameObject;
|
|
if (director == null)
|
|
{
|
|
gameObject = null;
|
|
}
|
|
else
|
|
{
|
|
GameObject gameObject2 = director.GetGenericBinding(this) as GameObject;
|
|
if (gameObject2 != null)
|
|
{
|
|
gameObject = gameObject2;
|
|
}
|
|
else
|
|
{
|
|
Component component = director.GetGenericBinding(this) as Component;
|
|
if (component != null)
|
|
{
|
|
gameObject = component.gameObject;
|
|
}
|
|
else
|
|
{
|
|
gameObject = null;
|
|
}
|
|
}
|
|
}
|
|
return gameObject;
|
|
}
|
|
|
|
// Token: 0x06000132 RID: 306 RVA: 0x000034D0 File Offset: 0x000016D0
|
|
private bool ValidateClipType(Type clipType)
|
|
{
|
|
foreach (object obj in base.GetType().GetCustomAttributes(typeof(TrackClipTypeAttribute), true))
|
|
{
|
|
TrackClipTypeAttribute trackClipTypeAttribute = obj as TrackClipTypeAttribute;
|
|
if (trackClipTypeAttribute.inspectedType.IsAssignableFrom(clipType))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x06000133 RID: 307 RVA: 0x0000353C File Offset: 0x0000173C
|
|
private TimelineClip NestPlayableAsset(PlayableAsset asset)
|
|
{
|
|
DataStreamType dataStreamType = DataStreamType.None;
|
|
switch (this.mediaType)
|
|
{
|
|
case TimelineAsset.MediaType.Animation:
|
|
dataStreamType = DataStreamType.Animation;
|
|
break;
|
|
case TimelineAsset.MediaType.Audio:
|
|
dataStreamType = DataStreamType.Audio;
|
|
break;
|
|
case TimelineAsset.MediaType.Video:
|
|
dataStreamType = DataStreamType.Video;
|
|
break;
|
|
case TimelineAsset.MediaType.Script:
|
|
dataStreamType = DataStreamType.None;
|
|
break;
|
|
}
|
|
int num = -1;
|
|
int num2 = 0;
|
|
foreach (PlayableBinding playableBinding in asset.outputs)
|
|
{
|
|
if (playableBinding.streamType == dataStreamType)
|
|
{
|
|
num = num2;
|
|
break;
|
|
}
|
|
num2++;
|
|
}
|
|
if (num < 0)
|
|
{
|
|
throw new InvalidOperationException("Cannot nest asset because it does not contain any compatible tracks");
|
|
}
|
|
TimelineClip timelineClip = this.CreateNewClipContainerInternal();
|
|
timelineClip.asset = asset;
|
|
timelineClip.displayName = asset.name;
|
|
timelineClip.duration = asset.duration;
|
|
return timelineClip;
|
|
}
|
|
|
|
// Token: 0x06000134 RID: 308 RVA: 0x0000363C File Offset: 0x0000183C
|
|
private void UpdateDuration()
|
|
{
|
|
if (this.clips.Length == 0)
|
|
{
|
|
this.m_ClipsHash = 0;
|
|
this.m_Start = 0;
|
|
this.m_End = (DiscreteTime)((!(this.m_AnimClip != null)) ? 0f : this.m_AnimClip.length);
|
|
}
|
|
else
|
|
{
|
|
int num = HashUtility.CombineHash(this.clips.Select((TimelineClip c) => c.Hash()).ToArray<int>());
|
|
if (num != this.m_ClipsHash)
|
|
{
|
|
this.m_ClipsHash = num;
|
|
double num2;
|
|
double num3;
|
|
this.GetSequenceTime(out num2, out num3);
|
|
this.m_Start = (DiscreteTime)num2;
|
|
this.m_End = (DiscreteTime)(num2 + num3);
|
|
this.CalculateExtrapolationTimes();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000135 RID: 309 RVA: 0x00003718 File Offset: 0x00001918
|
|
protected internal virtual Playable CreatePlayable(PlayableGraph graph, GameObject go, TimelineClip clip)
|
|
{
|
|
IPlayableAsset playableAsset = clip.asset as IPlayableAsset;
|
|
Playable playable2;
|
|
if (playableAsset != null)
|
|
{
|
|
Playable playable = playableAsset.CreatePlayable(graph, go);
|
|
if (playable.IsValid<Playable>())
|
|
{
|
|
playable.SetAnimatedProperties(clip.curves);
|
|
playable.SetSpeed(clip.timeScale);
|
|
}
|
|
playable2 = playable;
|
|
}
|
|
else
|
|
{
|
|
playable2 = Playable.Null;
|
|
}
|
|
return playable2;
|
|
}
|
|
|
|
// Token: 0x06000136 RID: 310 RVA: 0x0000377C File Offset: 0x0000197C
|
|
private void InvalidateTimelineCaches()
|
|
{
|
|
TimelineAsset timelineAsset = this.timelineAsset;
|
|
if (timelineAsset != null)
|
|
{
|
|
timelineAsset.Invalidate();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000137 RID: 311 RVA: 0x000037A8 File Offset: 0x000019A8
|
|
private static TimelineAsset.MediaType GetMediaType(Type t)
|
|
{
|
|
object[] customAttributes = t.GetCustomAttributes(typeof(TrackMediaType), true);
|
|
TimelineAsset.MediaType mediaType;
|
|
if (customAttributes.Length > 0 && customAttributes[0] is TrackMediaType)
|
|
{
|
|
mediaType = ((TrackMediaType)customAttributes[0]).m_MediaType;
|
|
}
|
|
else
|
|
{
|
|
mediaType = TimelineAsset.MediaType.Script;
|
|
}
|
|
return mediaType;
|
|
}
|
|
|
|
// Token: 0x04000078 RID: 120
|
|
[SerializeField]
|
|
private bool m_Locked;
|
|
|
|
// Token: 0x04000079 RID: 121
|
|
[SerializeField]
|
|
private bool m_Muted;
|
|
|
|
// Token: 0x0400007A RID: 122
|
|
[SerializeField]
|
|
private bool m_Soloed;
|
|
|
|
// Token: 0x0400007B RID: 123
|
|
[SerializeField]
|
|
private float m_Height;
|
|
|
|
// Token: 0x0400007C RID: 124
|
|
[SerializeField]
|
|
private string m_CustomPlayableFullTypename = string.Empty;
|
|
|
|
// Token: 0x0400007D RID: 125
|
|
[NonSerialized]
|
|
private DiscreteTime m_Start;
|
|
|
|
// Token: 0x0400007E RID: 126
|
|
[NonSerialized]
|
|
private DiscreteTime m_End;
|
|
|
|
// Token: 0x0400007F RID: 127
|
|
[SerializeField]
|
|
[FormerlySerializedAs("m_animClip")]
|
|
private AnimationClip m_AnimClip;
|
|
|
|
// Token: 0x04000080 RID: 128
|
|
[NonSerialized]
|
|
private TimelineClip[] m_ClipsCache;
|
|
|
|
// Token: 0x04000081 RID: 129
|
|
[NonSerialized]
|
|
private int m_ClipsHash;
|
|
|
|
// Token: 0x04000082 RID: 130
|
|
[SerializeField]
|
|
private PlayableAsset m_Parent;
|
|
|
|
// Token: 0x04000083 RID: 131
|
|
[SerializeField]
|
|
private List<TrackAsset> m_Children;
|
|
|
|
// Token: 0x04000084 RID: 132
|
|
private TimelineAsset.MediaType m_MediaType;
|
|
|
|
// Token: 0x04000085 RID: 133
|
|
[SerializeField]
|
|
protected internal List<TimelineClip> m_Clips = new List<TimelineClip>();
|
|
}
|
|
}
|