scripts
This commit is contained in:
@@ -0,0 +1,493 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine.Animations;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
namespace UnityEngine.Timeline
|
||||
{
|
||||
// Token: 0x02000029 RID: 41
|
||||
[TrackClipType(typeof(AnimationPlayableAsset))]
|
||||
[TrackClipType(typeof(AnimationClip))]
|
||||
[TrackMediaType(TimelineAsset.MediaType.Animation)]
|
||||
[SupportsChildTracks(typeof(AnimationTrack), 1)]
|
||||
[Serializable]
|
||||
public class AnimationTrack : TrackAsset
|
||||
{
|
||||
// Token: 0x17000073 RID: 115
|
||||
// (get) Token: 0x0600016D RID: 365 RVA: 0x00007590 File Offset: 0x00005790
|
||||
// (set) Token: 0x0600016E RID: 366 RVA: 0x000075AB File Offset: 0x000057AB
|
||||
public Vector3 position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Position = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000074 RID: 116
|
||||
// (get) Token: 0x0600016F RID: 367 RVA: 0x000075B8 File Offset: 0x000057B8
|
||||
// (set) Token: 0x06000170 RID: 368 RVA: 0x000075D3 File Offset: 0x000057D3
|
||||
public Quaternion rotation
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Rotation;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Rotation = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000075 RID: 117
|
||||
// (get) Token: 0x06000171 RID: 369 RVA: 0x000075E0 File Offset: 0x000057E0
|
||||
// (set) Token: 0x06000172 RID: 370 RVA: 0x000075FB File Offset: 0x000057FB
|
||||
public bool applyOffsets
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_ApplyOffsets;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_ApplyOffsets = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000076 RID: 118
|
||||
// (get) Token: 0x06000173 RID: 371 RVA: 0x00007608 File Offset: 0x00005808
|
||||
// (set) Token: 0x06000174 RID: 372 RVA: 0x00007623 File Offset: 0x00005823
|
||||
public MatchTargetFields matchTargetFields
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_MatchTargetFields;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_MatchTargetFields = value & MatchTargetFieldConstants.All;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000077 RID: 119
|
||||
// (get) Token: 0x06000175 RID: 373 RVA: 0x00007634 File Offset: 0x00005834
|
||||
private bool compilableIsolated
|
||||
{
|
||||
get
|
||||
{
|
||||
return !base.muted && (this.m_Clips.Count > 0 || (base.animClip != null && !base.animClip.empty));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000078 RID: 120
|
||||
// (get) Token: 0x06000176 RID: 374 RVA: 0x00007690 File Offset: 0x00005890
|
||||
internal override bool compilable
|
||||
{
|
||||
get
|
||||
{
|
||||
bool flag;
|
||||
if (!this.compilableIsolated)
|
||||
{
|
||||
flag = base.subTracks.Any((TrackAsset x) => x.compilable);
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000079 RID: 121
|
||||
// (get) Token: 0x06000177 RID: 375 RVA: 0x000076DC File Offset: 0x000058DC
|
||||
public override IEnumerable<PlayableBinding> outputs
|
||||
{
|
||||
get
|
||||
{
|
||||
return new PlayableBinding[]
|
||||
{
|
||||
new PlayableBinding
|
||||
{
|
||||
sourceObject = this,
|
||||
streamName = base.name,
|
||||
streamType = DataStreamType.Animation
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007A RID: 122
|
||||
// (get) Token: 0x06000178 RID: 376 RVA: 0x0000772C File Offset: 0x0000592C
|
||||
public bool inClipMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.clips != null && base.clips.Length != 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007B RID: 123
|
||||
// (get) Token: 0x06000179 RID: 377 RVA: 0x00007760 File Offset: 0x00005960
|
||||
// (set) Token: 0x0600017A RID: 378 RVA: 0x0000777B File Offset: 0x0000597B
|
||||
public Vector3 openClipOffsetPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_OpenClipOffsetPosition;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_OpenClipOffsetPosition = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007C RID: 124
|
||||
// (get) Token: 0x0600017B RID: 379 RVA: 0x00007788 File Offset: 0x00005988
|
||||
// (set) Token: 0x0600017C RID: 380 RVA: 0x000077A3 File Offset: 0x000059A3
|
||||
public Quaternion openClipOffsetRotation
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_OpenClipOffsetRotation;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_OpenClipOffsetRotation = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007D RID: 125
|
||||
// (get) Token: 0x0600017D RID: 381 RVA: 0x000077B0 File Offset: 0x000059B0
|
||||
// (set) Token: 0x0600017E RID: 382 RVA: 0x000077CB File Offset: 0x000059CB
|
||||
internal double openClipTimeOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_OpenClipTimeOffset;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_OpenClipTimeOffset = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007E RID: 126
|
||||
// (get) Token: 0x0600017F RID: 383 RVA: 0x000077D8 File Offset: 0x000059D8
|
||||
// (set) Token: 0x06000180 RID: 384 RVA: 0x000077F3 File Offset: 0x000059F3
|
||||
public TimelineClip.ClipExtrapolation openClipPreExtrapolation
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_OpenClipPreExtrapolation;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_OpenClipPreExtrapolation = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007F RID: 127
|
||||
// (get) Token: 0x06000181 RID: 385 RVA: 0x00007800 File Offset: 0x00005A00
|
||||
// (set) Token: 0x06000182 RID: 386 RVA: 0x0000781B File Offset: 0x00005A1B
|
||||
public TimelineClip.ClipExtrapolation openClipPostExtrapolation
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_OpenClipPostExtrapolation;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_OpenClipPostExtrapolation = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000183 RID: 387 RVA: 0x00007825 File Offset: 0x00005A25
|
||||
[ContextMenu("Reset Offsets")]
|
||||
private void ResetOffsets()
|
||||
{
|
||||
this.m_Position = Vector3.zero;
|
||||
this.m_Rotation = Quaternion.identity;
|
||||
this.UpdateClipOffsets();
|
||||
}
|
||||
|
||||
// Token: 0x06000184 RID: 388 RVA: 0x00007844 File Offset: 0x00005A44
|
||||
public TimelineClip CreateClip(AnimationClip clip)
|
||||
{
|
||||
TimelineClip timelineClip;
|
||||
if (clip == null)
|
||||
{
|
||||
timelineClip = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
TimelineClip timelineClip2 = base.CreateDefaultClip();
|
||||
this.AssignAnimationClip(timelineClip2, clip);
|
||||
timelineClip = timelineClip2;
|
||||
}
|
||||
return timelineClip;
|
||||
}
|
||||
|
||||
// Token: 0x06000185 RID: 389 RVA: 0x0000787C File Offset: 0x00005A7C
|
||||
internal void UpdateClipOffsets()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000186 RID: 390 RVA: 0x00007880 File Offset: 0x00005A80
|
||||
internal override void OnCreateClipFromAsset(Object asset, TimelineClip clip)
|
||||
{
|
||||
AnimationClip animationClip = asset as AnimationClip;
|
||||
if (animationClip != null)
|
||||
{
|
||||
if (animationClip.legacy)
|
||||
{
|
||||
throw new InvalidOperationException("Legacy Animation Clips are not supported");
|
||||
}
|
||||
AnimationPlayableAsset animationPlayableAsset = ScriptableObject.CreateInstance<AnimationPlayableAsset>();
|
||||
TimelineCreateUtilities.SaveAssetIntoObject(animationPlayableAsset, this);
|
||||
animationPlayableAsset.clip = animationClip;
|
||||
clip.asset = animationPlayableAsset;
|
||||
this.AssignAnimationClip(clip, animationClip);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000187 RID: 391 RVA: 0x000078DC File Offset: 0x00005ADC
|
||||
internal Playable CompileTrackPlayable(PlayableGraph graph, TrackAsset track, GameObject go, IntervalTree tree)
|
||||
{
|
||||
AnimationMixerPlayable animationMixerPlayable = AnimationMixerPlayable.Create(graph, track.clips.Length, false);
|
||||
for (int i = 0; i < track.clips.Length; i++)
|
||||
{
|
||||
TimelineClip timelineClip = track.clips[i];
|
||||
PlayableAsset playableAsset = timelineClip.asset as PlayableAsset;
|
||||
if (!(playableAsset == null))
|
||||
{
|
||||
if (timelineClip.recordable)
|
||||
{
|
||||
AnimationPlayableAsset animationPlayableAsset = playableAsset as AnimationPlayableAsset;
|
||||
if (animationPlayableAsset != null)
|
||||
{
|
||||
animationPlayableAsset.removeStartOffset = !timelineClip.recordable;
|
||||
}
|
||||
}
|
||||
Playable playable = playableAsset.CreatePlayable(graph, go);
|
||||
RuntimeClip runtimeClip = new RuntimeClip(timelineClip, playable, animationMixerPlayable);
|
||||
tree.Add(runtimeClip);
|
||||
graph.Connect<Playable, AnimationMixerPlayable>(playable, 0, animationMixerPlayable, i);
|
||||
animationMixerPlayable.SetInputWeight(i, 0f);
|
||||
}
|
||||
}
|
||||
return this.ApplyTrackOffset(graph, animationMixerPlayable);
|
||||
}
|
||||
|
||||
// Token: 0x06000188 RID: 392 RVA: 0x000079C0 File Offset: 0x00005BC0
|
||||
internal override Playable OnCreatePlayableGraph(PlayableGraph graph, GameObject go, IntervalTree tree)
|
||||
{
|
||||
if (base.isSubTrack)
|
||||
{
|
||||
throw new InvalidOperationException("Nested animation tracks should never be asked to create a graph directly");
|
||||
}
|
||||
List<AnimationTrack> list = new List<AnimationTrack>();
|
||||
if (this.compilableIsolated)
|
||||
{
|
||||
list.Add(this);
|
||||
}
|
||||
for (int i = 0; i < base.subTracks.Count; i++)
|
||||
{
|
||||
AnimationTrack animationTrack = base.subTracks[i] as AnimationTrack;
|
||||
if (animationTrack != null && animationTrack.compilable)
|
||||
{
|
||||
list.Add(animationTrack);
|
||||
}
|
||||
}
|
||||
Playable playable = new Playable(graph.CreateAnimationMotionXToDeltaPlayable());
|
||||
Playable playable2 = this.CreateGroupMixer(graph, go, list.Count);
|
||||
graph.Connect<Playable, Playable>(playable2, 0, playable, 0);
|
||||
playable.SetInputWeight(0, 1f);
|
||||
for (int j = 0; j < list.Count; j++)
|
||||
{
|
||||
Playable playable3 = ((!list[j].inClipMode) ? list[j].CreateInfiniteTrackPlayable(graph, go, tree) : this.CompileTrackPlayable(graph, list[j], go, tree));
|
||||
tree.Add(list[j]);
|
||||
graph.Connect<Playable, Playable>(playable3, 0, playable2, j);
|
||||
playable2.SetInputWeight(j, (float)((!list[j].inClipMode) ? 1 : 0));
|
||||
}
|
||||
return playable;
|
||||
}
|
||||
|
||||
// Token: 0x06000189 RID: 393 RVA: 0x00007B24 File Offset: 0x00005D24
|
||||
private Playable CreateGroupMixer(PlayableGraph graph, GameObject go, int inputCount)
|
||||
{
|
||||
return AnimationLayerMixerPlayable.Create(graph, inputCount);
|
||||
}
|
||||
|
||||
// Token: 0x0600018A RID: 394 RVA: 0x00007B48 File Offset: 0x00005D48
|
||||
private Playable CreateInfiniteTrackPlayable(PlayableGraph graph, GameObject go, IntervalTree tree)
|
||||
{
|
||||
Playable playable;
|
||||
if (base.animClip == null)
|
||||
{
|
||||
playable = Playable.Null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.m_FakeAnimClip == null || this.m_AnimationPlayableAsset == null)
|
||||
{
|
||||
this.m_AnimationPlayableAsset = ScriptableObject.CreateInstance<AnimationPlayableAsset>();
|
||||
this.m_FakeAnimClip = new TimelineClip(null)
|
||||
{
|
||||
asset = this.m_AnimationPlayableAsset,
|
||||
displayName = "Animation Clip",
|
||||
timeScale = 1.0,
|
||||
start = 0.0,
|
||||
postExtrapolationMode = TimelineClip.ClipExtrapolation.Hold,
|
||||
preExtrapolationMode = TimelineClip.ClipExtrapolation.Hold
|
||||
};
|
||||
this.m_FakeAnimClip.SetPostExtrapolationTime(TimelineClip.kMaxTimeValue);
|
||||
}
|
||||
this.m_AnimationPlayableAsset.clip = base.animClip;
|
||||
this.m_AnimationPlayableAsset.position = this.m_OpenClipOffsetPosition;
|
||||
this.m_AnimationPlayableAsset.rotation = this.m_OpenClipOffsetRotation;
|
||||
this.m_AnimationPlayableAsset.removeStartOffset = false;
|
||||
this.m_FakeAnimClip.start = 0.0;
|
||||
this.m_FakeAnimClip.SetPreExtrapolationTime(0.0);
|
||||
this.m_FakeAnimClip.duration = (double)base.animClip.length;
|
||||
AnimationMixerPlayable animationMixerPlayable = AnimationMixerPlayable.Create(graph, 1, false);
|
||||
Playable playable2 = this.m_AnimationPlayableAsset.CreatePlayable(graph, go);
|
||||
tree.Add(new RuntimeClip(this.m_FakeAnimClip, playable2, animationMixerPlayable));
|
||||
graph.Connect<Playable, AnimationMixerPlayable>(playable2, 0, animationMixerPlayable, 0);
|
||||
animationMixerPlayable.SetInputWeight(0, 1f);
|
||||
playable = this.ApplyTrackOffset(graph, animationMixerPlayable);
|
||||
}
|
||||
return playable;
|
||||
}
|
||||
|
||||
// Token: 0x0600018B RID: 395 RVA: 0x00007CD8 File Offset: 0x00005ED8
|
||||
private Playable ApplyTrackOffset(PlayableGraph graph, Playable root)
|
||||
{
|
||||
Playable playable;
|
||||
if (!this.m_ApplyOffsets)
|
||||
{
|
||||
playable = root;
|
||||
}
|
||||
else
|
||||
{
|
||||
AnimationOffsetPlayable animationOffsetPlayable = AnimationOffsetPlayable.Create(graph, this.m_Position, this.m_Rotation, 1);
|
||||
graph.Connect<Playable, AnimationOffsetPlayable>(root, 0, animationOffsetPlayable, 0);
|
||||
animationOffsetPlayable.SetInputWeight(0, 1f);
|
||||
playable = animationOffsetPlayable;
|
||||
}
|
||||
return playable;
|
||||
}
|
||||
|
||||
// Token: 0x0600018C RID: 396 RVA: 0x00007D31 File Offset: 0x00005F31
|
||||
internal override void GetEvaluationTime(out double outStart, out double outDuration)
|
||||
{
|
||||
if (this.inClipMode)
|
||||
{
|
||||
base.GetEvaluationTime(out outStart, out outDuration);
|
||||
}
|
||||
else
|
||||
{
|
||||
outStart = 0.0;
|
||||
outDuration = TimelineClip.kMaxTimeValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600018D RID: 397 RVA: 0x00007D64 File Offset: 0x00005F64
|
||||
internal override void GetSequenceTime(out double outStart, out double outDuration)
|
||||
{
|
||||
if (this.inClipMode)
|
||||
{
|
||||
base.GetSequenceTime(out outStart, out outDuration);
|
||||
}
|
||||
else
|
||||
{
|
||||
outStart = 0.0;
|
||||
outDuration = 0.0;
|
||||
if (base.animClip != null)
|
||||
{
|
||||
outDuration = (double)base.animClip.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600018E RID: 398 RVA: 0x00007DC4 File Offset: 0x00005FC4
|
||||
private void AssignAnimationClip(TimelineClip clip, AnimationClip animClip)
|
||||
{
|
||||
if (clip != null && !(animClip == null))
|
||||
{
|
||||
if (animClip.legacy)
|
||||
{
|
||||
throw new InvalidOperationException("Legacy Animation Clips are not supported");
|
||||
}
|
||||
if (animClip.frameRate > 0f)
|
||||
{
|
||||
double num = (double)Mathf.Round(animClip.length * animClip.frameRate);
|
||||
clip.duration = num / (double)animClip.frameRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
clip.duration = (double)animClip.length;
|
||||
}
|
||||
TimelineClip.ClipExtrapolation clipExtrapolation = TimelineClip.ClipExtrapolation.None;
|
||||
if (!base.isSubTrack)
|
||||
{
|
||||
clipExtrapolation = TimelineClip.ClipExtrapolation.Hold;
|
||||
}
|
||||
AnimationPlayableAsset animationPlayableAsset = clip.asset as AnimationPlayableAsset;
|
||||
if (animationPlayableAsset != null)
|
||||
{
|
||||
animationPlayableAsset.clip = animClip;
|
||||
}
|
||||
clip.underlyingAsset = animClip;
|
||||
clip.preExtrapolationMode = clipExtrapolation;
|
||||
clip.postExtrapolationMode = clipExtrapolation;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000AF RID: 175
|
||||
protected AnimationPlayableAsset m_AnimationPlayableAsset;
|
||||
|
||||
// Token: 0x040000B0 RID: 176
|
||||
protected TimelineClip m_FakeAnimClip;
|
||||
|
||||
// Token: 0x040000B1 RID: 177
|
||||
[SerializeField]
|
||||
private TimelineClip.ClipExtrapolation m_OpenClipPreExtrapolation = TimelineClip.ClipExtrapolation.None;
|
||||
|
||||
// Token: 0x040000B2 RID: 178
|
||||
[SerializeField]
|
||||
private TimelineClip.ClipExtrapolation m_OpenClipPostExtrapolation = TimelineClip.ClipExtrapolation.None;
|
||||
|
||||
// Token: 0x040000B3 RID: 179
|
||||
[SerializeField]
|
||||
private Vector3 m_OpenClipOffsetPosition = Vector3.zero;
|
||||
|
||||
// Token: 0x040000B4 RID: 180
|
||||
[SerializeField]
|
||||
private Quaternion m_OpenClipOffsetRotation = Quaternion.identity;
|
||||
|
||||
// Token: 0x040000B5 RID: 181
|
||||
[SerializeField]
|
||||
private double m_OpenClipTimeOffset;
|
||||
|
||||
// Token: 0x040000B6 RID: 182
|
||||
[SerializeField]
|
||||
private MatchTargetFields m_MatchTargetFields = MatchTargetFieldConstants.All;
|
||||
|
||||
// Token: 0x040000B7 RID: 183
|
||||
[SerializeField]
|
||||
private Vector3 m_Position = Vector3.zero;
|
||||
|
||||
// Token: 0x040000B8 RID: 184
|
||||
[SerializeField]
|
||||
private Quaternion m_Rotation = Quaternion.identity;
|
||||
|
||||
// Token: 0x040000B9 RID: 185
|
||||
[SerializeField]
|
||||
private bool m_ApplyOffsets;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user