public static TimelineClip Duplicate(this TimelineClip clip, PlayableDirector director) { TrackAsset parentTrack = clip.parentTrack; TimelineAsset timelineAsset = parentTrack.timelineAsset; TimelineClip result; if (parentTrack == null || timelineAsset == null) { result = null; } else { double num = ClipExtensions.FindClipInsertionTime(clip, parentTrack.clips); if (double.IsInfinity(num)) { result = null; } else { TimelineUndo.PushUndo(parentTrack, "Clone Clip"); TimelineClip timelineClip = TimelineHelpers.Clone(clip, director); timelineClip.start = num; clip.parentTrack.AddClip(timelineClip); clip.parentTrack.SortClips(); TrackExtensions.ComputeBlendsFromOverlaps(clip.parentTrack.clips); result = timelineClip; } } return(result); }
public static double FindClipInsertionTime(TimelineClip clip, TrackAsset track) { return(ClipExtensions.FindClipInsertionTime(clip, track.clips)); }