private static void AddSubTracksRecursive(TrackAsset track, ref List <TrackAsset> allTracks) { if (!(track == null)) { allTracks.AddRange(track.GetChildTracks()); foreach (TrackAsset track2 in track.GetChildTracks()) { TimelineAsset.AddSubTracksRecursive(track2, ref allTracks); } } }
static void AddSubTracksRecursive(TrackAsset track, ref List <TrackAsset> allTracks) { if (track == null) { return; } allTracks.AddRange(track.GetChildTracks()); foreach (TrackAsset subTrack in track.GetChildTracks()) { AddSubTracksRecursive(subTrack, ref allTracks); } }
public override void OnBuildTrackContextMenu(GenericMenu menu, TrackAsset track, UnityEditor.Timeline.WindowState state) { base.OnBuildTrackContextMenu(menu, track, state); menu.AddItem(EditorGUIUtility.TrTextContent("Add Nested Audio Track"), false, (parentTrack) => { AddSubTrack(state, typeof(AudioTrack), "nested track " + track.GetChildTracks().Count().ToString(), track); }, track); menu.AddItem(EditorGUIUtility.TrTextContent("Add Effects Track"), false, (parentTrack) => { AddSubTrack(state, typeof(AudioDeckTrack), "Effects" + track.GetChildTracks().Count().ToString(), track); }, track); }
public bool DeleteTrack(TrackAsset track) { bool result; if (track.timelineAsset != this) { result = false; } else { TrackAsset x = track.parent as TrackAsset; if (x != null) { } IEnumerable <TrackAsset> childTracks = track.GetChildTracks(); foreach (TrackAsset track2 in childTracks) { this.DeleteTrack(track2); } this.DeleteRecordingClip(track); List <TimelineClip> list = new List <TimelineClip>(track.clips); foreach (TimelineClip clip in list) { this.DeleteClip(clip); } this.RemoveTrack(track); TimelineUndo.PushDestroyUndo(this, this, track, "Delete Track"); result = true; } return(result); }
/// <summary> /// Deletes a track from a timeline, including all clips and subtracks. /// </summary> /// <param name="track">The track to delete. It must be owned by this Timeline.</param> /// <returns>True if the track was deleted successfully.</returns> public bool DeleteTrack(TrackAsset track) { if (track.timelineAsset != this) { return(false); } // push before we modify properties TimelineUndo.PushUndo(track, "Delete Track"); TimelineUndo.PushUndo(this, "Delete Track"); TrackAsset parent = track.parent as TrackAsset; if (parent != null) { TimelineUndo.PushUndo(parent, "Delete Track"); } var children = track.GetChildTracks(); foreach (var child in children) { DeleteTrack(child); } DeleteRecordedAnimation(track); var clipsToDelete = new List <TimelineClip>(track.clips); foreach (var clip in clipsToDelete) { DeleteClip(clip); } RemoveTrack(track); TimelineUndo.PushDestroyUndo(this, this, track); return(true); }