RemoveClip() private method

private RemoveClip ( UnityEngine.Timeline.TimelineClip clip ) : void
clip UnityEngine.Timeline.TimelineClip
return void
Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the parent track without performing any validation. To ensure a valid change use TimelineClipExtensions.TrySetParentTrack(TrackAsset) instead.
        /// </summary>
        /// <param name="newParentTrack"></param>
        internal void SetParentTrack_Internal(TrackAsset newParentTrack)
        {
            if (m_ParentTrack == newParentTrack)
            {
                return;
            }

            if (m_ParentTrack != null)
            {
                m_ParentTrack.RemoveClip(this);
            }

            m_ParentTrack = newParentTrack;

            if (m_ParentTrack != null)
            {
                m_ParentTrack.AddClip(this);
            }
        }