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); }
void DeleteRecordedAnimation(TimelineClip clip) { if (clip == null) { return; } if (clip.curves != null) { TimelineUndo.PushDestroyUndo(this, clip.parentTrack, clip.curves); } if (!clip.recordable) { return; } AnimationPlayableAsset asset = clip.asset as AnimationPlayableAsset; if (asset == null || asset.clip == null) { return; } TimelineUndo.PushDestroyUndo(this, asset, asset.clip); }
public bool DeleteClip(TimelineClip clip) { bool result; if (clip == null || clip.parentTrack == null) { result = false; } else if (this != clip.parentTrack.timelineAsset) { Debug.LogError("Cannot delete a clip from this timeline"); result = false; } else { if (clip.curves != null) { TimelineUndo.PushDestroyUndo(this, clip.parentTrack, clip.curves, "Delete Curves"); } if (clip.asset != null) { this.DeleteRecordedAnimation(clip); TimelineUndo.PushDestroyUndo(this, clip.parentTrack, clip.asset, "Delete Clip Asset"); } TrackAsset parentTrack = clip.parentTrack; parentTrack.RemoveClip(clip); parentTrack.CalculateExtrapolationTimes(); result = true; } return(result); }
private void DeleteRecordingClip(TrackAsset track) { AnimationTrack animationTrack = track as AnimationTrack; if (!(animationTrack == null) && !(animationTrack.animClip == null)) { TimelineUndo.PushDestroyUndo(this, track, animationTrack.animClip, "Delete Track"); } }
public bool Remove(ScriptableObject item, TimelineAsset timelineAsset, PlayableAsset thingToDirty) { if (!m_Objects.Contains(item)) return false; TimelineUndo.PushUndo(thingToDirty, "Delete Marker"); m_Objects.Remove(item); m_CacheDirty = true; TimelineUndo.PushDestroyUndo(timelineAsset, thingToDirty, item, "Delete Marker"); return true; }
void DeleteRecordedAnimation(TrackAsset track) { var animTrack = track as AnimationTrack; if (animTrack != null && animTrack.infiniteClip != null) { TimelineUndo.PushDestroyUndo(this, track, animTrack.infiniteClip); } if (track.curves != null) { TimelineUndo.PushDestroyUndo(this, track, track.curves); } }
private void DeleteRecordedAnimation(TimelineClip clip) { if (clip != null) { if (clip.curves != null) { TimelineUndo.PushDestroyUndo(this, clip.parentTrack, clip.curves, "Delete Parameters"); } if (clip.recordable) { AnimationPlayableAsset animationPlayableAsset = clip.asset as AnimationPlayableAsset; if (!(animationPlayableAsset == null) && !(animationPlayableAsset.clip == null)) { TimelineUndo.PushDestroyUndo(this, animationPlayableAsset, animationPlayableAsset.clip, "Delete Recording"); } } } }
/// <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); }
/// <summary> /// Delete a clip from this timeline. /// </summary> /// <param name="clip">The clip to delete.</param> /// <returns>Returns true if the removal was successful</returns> /// <remarks> /// This method will delete a clip and any assets owned by the clip. /// </remarks> public bool DeleteClip(TimelineClip clip) { if (clip == null || clip.parentTrack == null) { return(false); } if (this != clip.parentTrack.timelineAsset) { Debug.LogError("Cannot delete a clip from this timeline"); return(false); } TimelineUndo.PushUndo(clip.parentTrack, "Delete Clip"); if (clip.curves != null) { TimelineUndo.PushDestroyUndo(this, clip.parentTrack, clip.curves); } // handle wrapped assets if (clip.asset != null) { DeleteRecordedAnimation(clip); // TODO -- we should flag assets and owned, instead of this check... #if UNITY_EDITOR string path = UnityEditor.AssetDatabase.GetAssetPath(clip.asset); if (path == UnityEditor.AssetDatabase.GetAssetPath(this)) #endif { TimelineUndo.PushDestroyUndo(this, clip.parentTrack, clip.asset); } } var clipParentTrack = clip.parentTrack; clipParentTrack.RemoveClip(clip); clipParentTrack.CalculateExtrapolationTimes(); return(true); }