Exemplo n.º 1
0
        public static void Insert(TimelineAsset asset, double at, double amount, double tolerance)
        {
            var tracks = asset.flattenedTracks.Where(x => x.lockedInHierarchy == false).ToList();
            // gather all clips
            var clips   = tracks.SelectMany(x => x.clips).Where(x => (x.start - at) >= -tolerance).ToList();
            var markers = tracks.SelectMany(x => x.GetMarkers()).Where(x => (x.time - at) >= -tolerance).ToList();

            // push undo on the tracks for the clips that are being modified
            UndoExtensions.RegisterClips(clips, kInsertTime);

            // push the clips
            foreach (var clip in clips)
            {
                clip.start += amount;
            }

            // push undos and move the markers
            UndoExtensions.RegisterMarkers(markers, kInsertTime);
            foreach (var marker in markers)
            {
                marker.time += amount;
            }

            TimelineEditor.Refresh(RefreshReason.ContentsModified);
        }
Exemplo n.º 2
0
        public static bool MatchDuration(IEnumerable <TimelineClip> clips)
        {
            double referenceDuration = clips.First().duration;

            UndoExtensions.RegisterClips(clips, L10n.Tr("Match Clip Duration"));
            foreach (var clip in clips)
            {
                var newEnd = clip.start + referenceDuration;
                TrimClipWithEditMode(clip, TrimEdge.End, newEnd);
            }

            return(true);
        }