コード例 #1
0
        private void pushLeftClick(object sender, System.EventArgs e)
        {
            List <TrackEvent> selectedMedias = VegasHelper.FindSelectedEvents(myVegas.Project);

            selectedMedias = selectedMedias.OrderBy((x) => x.Start).ToList();

            if (!validateSelectedTrackEvents(selectedMedias))
            {
                return;
            }

            PushBlur pushBlur = new PushBlur(selectedMedias, myVegas, TransitionMode.ToRight);

            pushBlur.applyEffects();
        }
コード例 #2
0
        private bool validateSelectedTrackEvents(List <TrackEvent> selectedMedias)
        {
            if (selectedMedias.Count != 2)
            {
                MessageBox.Show($"Need to select 2 elements. Selected " + selectedMedias.Count + " elements.");
                return(false);
            }

            if (VegasHelper.isPickedEventsInTheSameGroup(selectedMedias))
            {
                MessageBox.Show($"Need to select 2 elements from separate groups.");
                return(false);
            }

            return(true);
        }
コード例 #3
0
        public void ChangeTrackSecondGroup()
        {
            foreach (TrackEvent trackEvent in group2)
            {
                if (trackEvent.MediaType == MediaType.Audio)
                {
                    List <Track> audioTracks = VegasHelper.FindAudioTracks(myVegas);
                    bool         moved       = false;
                    foreach (Track track in audioTracks)
                    {
                        //if (trackEvent.Track == track) continue;
                        if (!isTrackUnique(trackEvent.Track, track, group1))
                        {
                            continue;
                        }
                        if (track.MediaType == MediaType.Audio)
                        {
                            using (UndoBlock undo = new UndoBlock("Change track of audio"))
                            {
                                trackEvent.Track = track;
                            }
                            moved = true;
                            break;
                        }
                    }

                    if (!moved)
                    {
                        AudioTrack newAudioTrack = null;
                        using (UndoBlock undo = new UndoBlock("Creating new AudioTrack"))
                        {
                            newAudioTrack = myVegas.Project.AddAudioTrack();
                        }
                        if (newAudioTrack != null)
                        {
                            using (UndoBlock undo = new UndoBlock("Changed audio track"))
                            {
                                trackEvent.Track = newAudioTrack;
                            }
                        }
                    }
                }
                else if (trackEvent.MediaType == MediaType.Video)
                {
                    List <Track> videoTracks = VegasHelper.FindVideoTracks(myVegas);
                    bool         moved       = false;
                    foreach (Track track in videoTracks)
                    {
                        if (!isTrackUnique(trackEvent.Track, track, group1))
                        {
                            continue;
                        }
                        if (track.MediaType == MediaType.Video)
                        {
                            using (UndoBlock undo = new UndoBlock("Change track of video"))
                            {
                                trackEvent.Track = track;
                            }
                            moved = true;
                            break;
                        }
                    }

                    if (!moved)
                    {
                        VideoTrack newVideoTrack = null;
                        using (UndoBlock undo = new UndoBlock("Creating new AudioTrack"))
                        {
                            newVideoTrack = myVegas.Project.AddVideoTrack();
                        }
                        if (newVideoTrack != null)
                        {
                            using (UndoBlock undo = new UndoBlock("Changed video track"))
                            {
                                trackEvent.Track = newVideoTrack;
                            }
                        }
                    }
                }
            }
        }