static int DeleteTrack(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Timeline.TimelineAsset obj = (UnityEngine.Timeline.TimelineAsset)ToLua.CheckObject <UnityEngine.Timeline.TimelineAsset>(L, 1); UnityEngine.Timeline.TrackAsset arg0 = (UnityEngine.Timeline.TrackAsset)ToLua.CheckObject <UnityEngine.Timeline.TrackAsset>(L, 2); bool o = obj.DeleteTrack(arg0); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetOutputTrack(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Timeline.TimelineAsset obj = (UnityEngine.Timeline.TimelineAsset)ToLua.CheckObject <UnityEngine.Timeline.TimelineAsset>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Timeline.TrackAsset o = obj.GetOutputTrack(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int CreateTrack(IntPtr L) { try { ToLua.CheckArgsCount(L, 4); UnityEngine.Timeline.TimelineAsset obj = (UnityEngine.Timeline.TimelineAsset)ToLua.CheckObject <UnityEngine.Timeline.TimelineAsset>(L, 1); System.Type arg0 = ToLua.CheckMonoType(L, 2); UnityEngine.Timeline.TrackAsset arg1 = (UnityEngine.Timeline.TrackAsset)ToLua.CheckObject <UnityEngine.Timeline.TrackAsset>(L, 3); string arg2 = ToLua.CheckString(L, 4); UnityEngine.Timeline.TrackAsset o = obj.CreateTrack(arg0, arg1, arg2); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private static Playable CreatePlayableGraph(PlayableGraph graph, TrackAsset asset, GameObject go, IntervalTree <RuntimeElement> tree, Playable timelinePlayable) { return(asset.CreatePlayableGraph(graph, go, tree, timelinePlayable)); }
internal TimelineClip(TrackAsset parent) { // parent clip into track parentTrack = parent; }
internal TimelineClip(TrackAsset parent) { this.parentTrack = parent; }
private void AddSubTrack(WindowState state, Type trackOfType, string trackName, TrackAsset track) { track.timelineAsset.CreateTrack(trackOfType, track, trackName); track.collapsed = false; state.Refresh(); }
private Playable CreateTrackPlayable(PlayableGraph graph, Playable timelinePlayable, TrackAsset track, GameObject go, bool createOutputs) { Playable result; TimelinePlayable.ConnectionCache connectionCache; if (!track.compilable) { result = timelinePlayable; } else if (this.m_PlayableCache.TryGetValue(track, out connectionCache)) { result = connectionCache.playable; } else if (track.get_name() == "root") { result = timelinePlayable; } else { TrackAsset trackAsset = track.parent as TrackAsset; Playable playable = (!(trackAsset != null)) ? timelinePlayable : this.CreateTrackPlayable(graph, timelinePlayable, trackAsset, go, createOutputs); Playable playable2 = TimelinePlayable.CreatePlayableGraph(graph, track, go, this.m_IntervalTree); bool flag = false; if (!PlayableExtensions.IsValid <Playable>(playable2)) { throw new InvalidOperationException(string.Concat(new object[] { track.get_name(), "(", track.GetType(), ") did not produce a valid playable. Use the compilable property to indicate whether the track is valid for processing" })); } if (PlayableExtensions.IsValid <Playable>(playable) && PlayableExtensions.IsValid <Playable>(playable2)) { int inputCount = PlayableExtensions.GetInputCount <Playable>(playable); PlayableExtensions.SetInputCount <Playable>(playable, inputCount + 1); flag = graph.Connect <Playable, Playable>(playable2, 0, playable, inputCount); PlayableExtensions.SetInputWeight <Playable>(playable, inputCount, 1f); } if (createOutputs && flag) { this.CreateTrackOutput(graph, track, playable, PlayableExtensions.GetInputCount <Playable>(playable) - 1); } this.CacheTrack(track, playable2, (!flag) ? -1 : (PlayableExtensions.GetInputCount <Playable>(playable) - 1), playable); result = playable2; } return(result); }
// Calculates the extrapolation times internal static void CalculateExtrapolationTimes(this TrackAsset asset) { TimelineClip[] clips = asset.clips; if (clips == null || clips.Length == 0) { return; } // extrapolation not supported if (!clips[0].SupportsExtrapolation()) { return; } var orderedClips = SortClipsByStartTime(clips); if (orderedClips.Length > 0) { // post extrapolation is the minimum time to the next clip for (int i = 0; i < orderedClips.Length; i++) { double minTime = double.PositiveInfinity; for (int j = 0; j < orderedClips.Length; j++) { if (i == j) { continue; } double deltaTime = orderedClips[j].start - orderedClips[i].end; if (deltaTime >= -TimeUtility.kTimeEpsilon && deltaTime < minTime) { minTime = Math.Min(minTime, deltaTime); } // check for overlapped clips if (orderedClips[j].start <= orderedClips[i].end && orderedClips[j].end > orderedClips[i].end) { minTime = 0; } } minTime = minTime <= kMinExtrapolationTime ? 0 : minTime; orderedClips[i].SetPostExtrapolationTime(minTime); } // the first clip gets pre-extrapolation, then it's only respected if there is no post extrapolation orderedClips[0].SetPreExtrapolationTime(Math.Max(0, orderedClips[0].start)); for (int i = 1; i < orderedClips.Length; i++) { double preTime = 0; int prevClip = -1; for (int j = 0; j < i; j++) { // overlap, no pre-time if (orderedClips[j].end > orderedClips[i].start) { prevClip = -1; preTime = 0; break; } double gap = orderedClips[i].start - orderedClips[j].end; if (prevClip == -1 || gap < preTime) { preTime = gap; prevClip = j; } } // check for a post extrapolation time if (prevClip >= 0) { if (orderedClips[prevClip].postExtrapolationMode != TimelineClip.ClipExtrapolation.None) { preTime = 0; } } preTime = preTime <= kMinExtrapolationTime ? 0 : preTime; orderedClips[i].SetPreExtrapolationTime(preTime); } } }
internal static void CalculateExtrapolationTimes(this TrackAsset asset) { TimelineClip[] clips = asset.clips; if (clips != null && clips.Length != 0) { if (clips[0].SupportsExtrapolation()) { TimelineClip[] array = Extrapolation.SortClipsByStartTime(clips); if (array.Length > 0) { for (int i = 0; i < array.Length; i++) { double num = double.PositiveInfinity; for (int j = 0; j < array.Length; j++) { if (i != j) { double num2 = array[j].start - array[i].end; if (num2 >= -TimeUtility.kTimeEpsilon && num2 < num) { num = Math.Min(num, num2); } if (array[j].start <= array[i].end && array[j].end > array[i].end) { num = 0.0; } } } num = ((num > Extrapolation.kMinExtrapolationTime) ? num : 0.0); array[i].SetPostExtrapolationTime(num); } array[0].SetPreExtrapolationTime(Math.Max(0.0, array[0].start)); for (int k = 1; k < array.Length; k++) { double num3 = 0.0; int num4 = -1; for (int l = 0; l < k; l++) { if (array[l].end > array[k].start) { num4 = -1; num3 = 0.0; break; } double num5 = array[k].start - array[l].end; if (num4 == -1 || num5 < num3) { num3 = num5; num4 = l; } } if (num4 >= 0) { if (array[num4].postExtrapolationMode != TimelineClip.ClipExtrapolation.None) { num3 = 0.0; } } num3 = ((num3 > Extrapolation.kMinExtrapolationTime) ? num3 : 0.0); array[k].SetPreExtrapolationTime(num3); } } } } }
void EvaluateAnimationPreviewUpdateCallback(TrackAsset track, AnimationPlayableOutput animOutput) { m_EvaluateCallbacks.Add(new AnimationPreviewUpdateCallback(animOutput)); }
/// <summary> /// Override this method to receive a callback when the marker is initialized. /// </summary> /// <paramref name="aPent">The track that contains the marker.</paramref> public virtual void OnInitialize(TrackAsset aPent) { }
internal void AddTrackInternal(TrackAsset track) { m_Tracks.Add(track); track.parent = this; Invalidate(); }
/// <summary> /// Creates a track and adds it to the Timeline Asset. /// </summary> /// <param name="parent">Track to parent to. This can be null.</param> /// <param name="trackName">The name of the track being created.</param> /// <typeparam name="T">The type of track being created. The track type must be derived from TrackAsset.</typeparam> /// <returns>Returns the created track.</returns> /// <remarks> /// This method will throw an InvalidOperationException if the parent is not valid. The parent can be any GroupTrack, or a supported parent type of track. For example, this can be used to create override tracks in AnimationTracks. /// </remarks> public T CreateTrack <T>(TrackAsset parent, string trackName) where T : TrackAsset, new() { return((T)CreateTrack(typeof(T), parent, trackName)); }
internal TimelineClip(TrackAsset parent) { // parent clip into track SetParentTrack_Internal(parent); }
private Playable CreateTrackPlayable(PlayableGraph graph, Playable timelinePlayable, TrackAsset track, GameObject go, bool createOutputs) { if (!track.IsCompilable()) // where parents are not compilable (group tracks) { return(timelinePlayable); } Playable playable; if (m_PlayableCache.TryGetValue(track, out playable)) { return(playable); } if (track.name == "root") { return(timelinePlayable); } TrackAsset parentActor = track.parent as TrackAsset; var parentPlayable = parentActor != null?CreateTrackPlayable(graph, timelinePlayable, parentActor, go, createOutputs) : timelinePlayable; var actorPlayable = CreatePlayableGraph(graph, track, go, m_IntervalTree, timelinePlayable); bool connected = false; if (!actorPlayable.IsValid()) { // if a track says it's compilable, but returns Playable.Null, that can screw up the whole graph. throw new InvalidOperationException(track.name + "(" + track.GetType() + ") did not produce a valid playable. Use the compilable property to indicate whether the track is valid for processing"); } // Special case for animation tracks if (parentPlayable.IsValid() && actorPlayable.IsValid()) { int port = parentPlayable.GetInputCount(); parentPlayable.SetInputCount(port + 1); connected = graph.Connect(actorPlayable, 0, parentPlayable, port); parentPlayable.SetInputWeight(port, 1.0f); } if (createOutputs && connected) { CreateTrackOutput(graph, track, go, parentPlayable, parentPlayable.GetInputCount() - 1); } CacheTrack(track, actorPlayable, connected ? (parentPlayable.GetInputCount() - 1) : -1, parentPlayable); return(actorPlayable); }
static void MoveToTrack_Impl(TimelineClip clip, TrackAsset destinationTrack, Object asset, TrackAsset parentTrack) { TimelineUndo.PushUndo(asset, k_UndoSetParentTrackText); if (parentTrack != null) { TimelineUndo.PushUndo(parentTrack, k_UndoSetParentTrackText); } TimelineUndo.PushUndo(destinationTrack, k_UndoSetParentTrackText); clip.SetParentTrack_Internal(destinationTrack); if (parentTrack == null) { TimelineCreateUtilities.SaveAssetIntoObject(asset, destinationTrack); } else if (parentTrack.timelineAsset != destinationTrack.timelineAsset) { TimelineCreateUtilities.RemoveAssetFromObject(asset, parentTrack); TimelineCreateUtilities.SaveAssetIntoObject(asset, destinationTrack); } }
void EvaluateWeightsForAnimationPlayableOutput(TrackAsset track, AnimationPlayableOutput animOutput) { m_EvaluateCallbacks.Add(new AnimationOutputWeightProcessor(animOutput)); }
protected TrackAsset() { this.m_MediaType = TrackAsset.GetMediaType(base.GetType()); }
private void CacheTrack(TrackAsset track, Playable playable, int port, Playable parent) { m_PlayableCache[track] = playable; }
public T CreateTrack <T>(TrackAsset parent, string name) where T : TrackAsset, new() { return((T)((object)this.CreateTrack(typeof(T), parent, name))); }