Exemplo n.º 1
0
        public static void Execute(Vegas vegas)
        {
            var videoTracks = VegasHelper.GetTracks <VideoTrack>(vegas, 1);

            var selectedTrackEvents = VegasHelper.GetTrackEvents(videoTracks);

            var currentPosition = selectedTrackEvents[0].Start;

            //order the list
            ListHelpers.Shuffle(selectedTrackEvents, new Random());

            using (var undo = new UndoBlock("Randomize Events"))
            {
                //update order of the events
                foreach (var selectedTrackEvent in selectedTrackEvents)
                {
                    if (selectedTrackEvent.IsGrouped)
                    {
                        foreach (var groupedTrackEvents in selectedTrackEvent.Group)
                        {
                            groupedTrackEvents.Start = currentPosition;
                        }
                    }
                    else
                    {
                        selectedTrackEvent.Start = currentPosition;
                    }
                    currentPosition += selectedTrackEvent.Length;
                }
            }
        }
Exemplo n.º 2
0
        public static void Execute(Vegas vegas)
        {
            var videoTracks = VegasHelper.GetTracks <VideoTrack>(vegas, 1);

            var selectedTrackEvents = VegasHelper.GetTrackEvents(videoTracks);

            var currentPosition = selectedTrackEvents[0].Start;

            //order the list
            selectedTrackEvents.Sort(new TrackEventsNameTimeComparer());

            using (var undo = new UndoBlock("Order Events By Name And Time"))
            {
                //update order of the events
                foreach (var selectedTrackEvent in selectedTrackEvents)
                {
                    if (selectedTrackEvent.IsGrouped)
                    {
                        foreach (var groupedTrackEvents in selectedTrackEvent.Group)
                        {
                            groupedTrackEvents.Start = currentPosition;
                        }
                    }
                    else
                    {
                        selectedTrackEvent.Start = currentPosition;
                    }
                    currentPosition += selectedTrackEvent.Length;
                }
            }
        }
Exemplo n.º 3
0
        public static void Execute(Vegas vegas)
        {
            var configData = new WallBuilderConfiguration();

            if (!GetConfigurationFromUser(configData))
            {
                return;
            }

            var wallTracks = WallBuilder.BuildWall(vegas.Project.Video.Width, vegas.Project.Video.Height, configData);

            using (var undo = new UndoBlock("Insert Video Wall"))
            {
                var trackNumber = 0;

                var videoTracks = VegasHelper.GetTracks <VideoTrack>(vegas);

                foreach (var track in wallTracks)
                {
                    var videoTrack = SelectOrInsertVideoTrack(vegas, videoTracks, trackNumber);
                    trackNumber += 1;

                    SetTrackKeyFrames(videoTrack, track);
                }
            }
        }
        public static void Execute(Vegas vegas)
        {
            Marker fistMarker = null;

            var markersToRemove = new List <Marker>();

            var proj = vegas.Project;

            using (var undo = new UndoBlock("Convert Markers To Regions"))
            {
                foreach (var marker in VegasHelper.GetMarkersByTimecode(proj))
                {
                    if (fistMarker == null)
                    {
                        fistMarker = marker;
                    }
                    else
                    {
                        markersToRemove.Add(fistMarker);
                        markersToRemove.Add(marker);
                        Region currentRegion = new Region(fistMarker.Position, marker.Position - fistMarker.Position);
                        proj.Regions.Add(currentRegion);
                        fistMarker = null;
                    }
                }

                foreach (var marker in markersToRemove)
                {
                    proj.Markers.Remove(marker);
                }
            }
        }
Exemplo n.º 5
0
        public static void Execute(Vegas vegas)
        {
            var selectedTracks = VegasHelper.GetTracks <VideoTrack>(vegas, 1, onlySelected: true);
            var framerate      = (int)Math.Round(vegas.Project.Video.FrameRate, 0, MidpointRounding.AwayFromZero);

            var config = GetConfig(selectedTracks, framerate);

            var points = BezierMotion.GetPoints(config);

            var startingFrame = vegas.Transport.CursorPosition.FrameCount;

            var width  = vegas.Project.Video.Width;
            var height = vegas.Project.Video.Height;

            var framesPerStep = (framerate / config.StepsPerSecond);

            using (var undo = new UndoBlock("Track Along Bezier"))
            {
                for (var trackIndex = 0; trackIndex < config.NumberOfTracks; trackIndex++)
                {
                    var currentFrame = startingFrame + (long)(trackIndex * config.SecondsBetweenTracks * 24);

                    var selectedTrack = selectedTracks[config.NumberOfTracks - trackIndex - 1];
                    selectedTrack.TrackMotion.MotionKeyframes.Clear();

                    foreach (var point in points)
                    {
                        SetTrackMotionKeyFrame(currentFrame, selectedTrack, width, point, height);

                        currentFrame += framesPerStep;
                    }
                }
            }
        }
Exemplo n.º 6
0
        public static void Execute(Vegas vegas)
        {
            var proj = vegas.Project;

            var processSeperately = KeyboardState.IsKeyDown(Keys.Control) ||
                                    KeyboardState.IsKeyDown(Keys.ControlKey) ||
                                    KeyboardState.IsKeyDown(Keys.LControlKey) ||
                                    KeyboardState.IsKeyDown(Keys.RControlKey);

            using (var undo = new UndoBlock("Reorder Marker and Regions"))
            {
                var existingMarkers = VegasHelper.GetMarkersByTimecode(proj);
                var existingRegions = VegasHelper.GetRegionsByTimecode(proj);

                var markPositions   = RemoveMarkers(proj, existingMarkers);
                var regionPositions = RemoveRegions(proj, existingRegions);

                if (processSeperately)
                {
                    foreach (var mi in markPositions)
                    {
                        AddRegionOrMarker(mi, proj.Regions, proj.Markers);
                    }

                    foreach (var ri in regionPositions)
                    {
                        AddRegionOrMarker(ri, proj.Regions, proj.Markers);
                    }
                }
                else
                {
                    var combinedPositions = new List <MarkerInfo>(markPositions);
                    foreach (var regionPosition in regionPositions)
                    {
                        combinedPositions.Add(regionPosition);
                    }
                    combinedPositions.Sort(new MarkerInfoComparer());

                    foreach (var cp in combinedPositions)
                    {
                        AddRegionOrMarker(cp, proj.Regions, proj.Markers);
                    }
                }
            }
        }
        public static void Execute(Vegas vegas)
        {
            var videoTracks = VegasHelper.GetTracks <VideoTrack>(vegas, 1, 1, true);

            var selectedTrackEvents = VegasHelper.GetTrackEvents(videoTracks);

            var startingPosition = selectedTrackEvents[0].Start;

            var trackEventInfos = new List <TrackEventInfo>();

            foreach (var selectedTrackEvent in selectedTrackEvents)
            {
                trackEventInfos.Add(new TrackEventInfo(selectedTrackEvent));
            }

            //order the list
            trackEventInfos.Sort((info1, info2) => info1.FileTimestamp.CompareTo(info2.FileTimestamp));

            var baseTimeStamp = trackEventInfos[0].FileTimestamp;

            using (var undo = new UndoBlock("Order Events By Name And Time"))
            {
                //update order of the events
                foreach (var selectedTrackEvent in trackEventInfos)
                {
                    var currentPosition = startingPosition +
                                          Timecode.FromMilliseconds(
                        (selectedTrackEvent.FileTimestamp - baseTimeStamp).TotalMilliseconds);

                    if (selectedTrackEvent.TrackEvent.IsGrouped)
                    {
                        foreach (var groupedTrackEvents in selectedTrackEvent.TrackEvent.Group)
                        {
                            groupedTrackEvents.Start = currentPosition;
                        }
                    }
                    else
                    {
                        selectedTrackEvent.TrackEvent.Start = currentPosition;
                    }
                }
            }
        }