Auto-select left clip after video splitting?

Skrzypiec wrote on 10/21/2014, 6:28 AM
Hello,

Can I somehow force V13 to automatically select the clip that is to the left of the split point on the timeline? This way it would be much faster to cut/delete unwanted fragments of the video than with the selection of the right clip occuring by default.

Thank You in advance for help,
Maciej :)

Comments

Dexcon wrote on 10/21/2014, 6:42 AM
I've not seen any option to make a L/R selection on a split - but it's a great idea. Perhaps you could suggest it to SCS via Product Suggestions.

Maybe it could have a basic intelligent selection. If the split is less than 50% into the clip, the highlight is to the left; if the split is 50% or more into the clip, then the highlight is to the right.

Cameras: Sony FDR-AX100E; GoPro Hero 11 Black Creator Edition

Installed: Vegas Pro 15, 16, 17, 18, 19, 20, 21 & 22, HitFilm Pro 2021.3, DaVinci Resolve Studio 19.0.3, BCC 2025, Mocha Pro 2025.0, NBFX TotalFX 7, Neat NR, DVD Architect 6.0, MAGIX Travel Maps, Sound Forge Pro 16, SpectraLayers Pro 11, iZotope RX11 Advanced and many other iZ plugins, Vegasaur 4.0

Windows 11

Dell Alienware Aurora 11:

10th Gen Intel i9 10900KF - 10 cores (20 threads) - 3.7 to 5.3 GHz

NVIDIA GeForce RTX 2080 SUPER 8GB GDDR6 - liquid cooled

64GB RAM - Dual Channel HyperX FURY DDR4 XMP at 3200MHz

C drive: 2TB Samsung 990 PCIe 4.0 NVMe M.2 PCIe SSD

D: drive: 4TB Samsung 870 SATA SSD (used for media for editing current projects)

E: drive: 2TB Samsung 870 SATA SSD

F: drive: 6TB WD 7200 rpm Black HDD 3.5"

Dell Ultrasharp 32" 4K Color Calibrated Monitor

 

LAPTOP:

Dell Inspiron 5310 EVO 13.3"

i5-11320H CPU

C Drive: 1TB Corsair Gen4 NVMe M.2 2230 SSD (upgraded from the original 500 GB SSD)

Monitor is 2560 x 1600 @ 60 Hz

Richard Jones wrote on 10/21/2014, 7:58 AM
Does Alt+[ or Alt+] help?

Richard
Grazie wrote on 10/21/2014, 9:09 AM
..... and this is why I assemble from the Trimmer.

Grazie

johnmeyer wrote on 10/21/2014, 9:12 AM
I wrote a series of "cuts-only" scripts that were designed to let you dramatically increase your editing speed by making all cuts based on the location of the cursor, without having to worry about which events were selected. One of those script was designed to select the video event on the first selected video track under the cursor and, if there was an audio event on the track immediately below, that was selected as well.

The original script was designed so that if you had just split an event, and the cursor was exactly at the split point, it would select the event to the right. I altered that so that in the script below, it will select the event to the left of the cursor. So, if the cursor is anywhere over an event, including at the split point, it will select the prior event.

You have to make sure that the video track is selected before running the script. This will usually be the case if you've been editing anything, and will certainly be the case immediately after a split.

Copy the script below (but only the portion after the words "Code Block:"), paste it in Notepad, and save it with the extension ".js".

/** 
* PURPOSE OF THIS SCRIPT:
*
* Select event PRIOR to the cursor, and de-select all other events.
*
* A video track must be selected. If an audio track is selected, nothing happens.
* If the track beneath the video track contains audio, the audio event in that track
* that lies beneath the cursor will also be selected.
*
* Copyright © John Meyer 2004
* Written: September 23, 2004
* Updated October 21, 2014
*
**/

import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;


try {

//Global declarations
var dStart : Double;
var dLength : Double;
var dCursor : Double;
var trackEnum : Enumerator;
var evnt : TrackEvent;
var CurrentEvnt : TrackEvent;

var track = FindSelectedTrack(); // Use this function to find the first selected track.
var eventEnum = new Enumerator(track.Events);

if (track.IsVideo()) { // Proceed only if selected track is video track.

if ( SelectEventAtCursor() ) { // Function that selects events under cursor.

// Get set to look at track directly below the video track.
trackEnum.moveNext(); // Go to next track.

if (!trackEnum.atEnd()) { // Only proceed if there is a track below the video track.
track = Track(trackEnum.item()); // When doing the first track (above), these two lines were executed
eventEnum = new Enumerator(track.Events); // in the FindSelectedTrack() function.
if (track.IsAudio()) { // Only trim the event if this is an audio track.
SelectEventAtCursor();
}
}
}
}
// Vegas.Cursor = CurrentEvnt.Start; // Enable this line to move cursor to start of selected event.
Vegas.UpdateUI();

} catch (e) {
MessageBox.Show(e);
}

// End of main program



// Beginning of functions

function FindSelectedTrack() : Track {
trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());

if (track.Selected) {
return track;
}
trackEnum.moveNext();
}
return null;
}


/**
*
* The following function finds the event on the selected track
* that lies under the cursor. It also deselects all other events.
*
**/

function SelectEventAtCursor() {

var EventFound : boolean = false; // Function returns false if no video media under cursor.

dCursor = Vegas.Cursor.ToMilliseconds(); // Remember the cursor position.

//Go through each event on the track.
CurrentEvnt=TrackEvent(eventEnum.item());

while (!eventEnum.atEnd()) {
evnt = TrackEvent(eventEnum.item());
evnt.Selected = false; // De-select the event

// Get the event's start and length timecode, in milliseconds.
dStart = evnt.Start.ToMilliseconds();
dLength = evnt.Length.ToMilliseconds();


/**
* If the cursor timecode is between the beginning and end of the
* event timecodes, then select the event.
**/

if ( (dCursor >= dStart) && ( dCursor < (dLength + dStart) ) ) {
CurrentEvnt.Selected = true; // Select this event.
EventFound = true;
}
CurrentEvnt = evnt;
eventEnum.moveNext(); // Go to next event on this timeline.

}
return EventFound;
}
TeetimeNC wrote on 10/21/2014, 1:45 PM
>Does Alt+[ or Alt+] help?

How have I missed that all these years? Thanks Richard.

/jerry
Richard Jones wrote on 10/21/2014, 2:24 PM
Pleasure ;)

Richard
NickHope wrote on 10/7/2016, 5:26 AM

Here's a version of John's script that will select the event immediately to the left of the cursor. Unlike John's script, it selects the event even if there is a gap after it (or it's the last event on the track), and only if it reaches to the cursor (i.e. following a split or an ALT+] or if the cursor has been snapped to the event's end).

/** 
* PURPOSE OF THIS SCRIPT:
*
* Select event PRIOR to the cursor, and de-select all other events.
*
* A video track must be selected. If an audio track is selected, nothing happens.
* If the track beneath the video track contains audio, the audio event in that track 
* prior to the cursor the cursor will also be selected.
*
* Copyright © John Meyer 2004
* Written: September 23, 2004
* Updated October 21, 2014
* Modified by Nick Hope, October 07, 2016, to select the event immediately prior to the cursor,
* even if there is a gap after it, as long as it reaches the cursor.
*
* https://www.vegascreativesoftware.info/us/forum/auto-select-left-clip-after-video-splitting--98852/
*
**/ 

import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas; // For VP13 build 453 and earlier
//import ScriptPortal.Vegas; // For VP13 build 543 and later

try { 
	//Global declarations
	var dStart : Double;
	var dLength : Double;
	var dCursor : Double;
	var trackEnum : Enumerator;
	var evnt : TrackEvent;
	var CurrentEvnt : TrackEvent;

	var track = FindSelectedTrack(); // Use this function to find the first selected track.  
	var eventEnum = new Enumerator(track.Events);

	if (track.IsVideo()) { // Proceed only if selected track is video track.
		if ( SelectEventAtCursor() ) { // Function that selects events under cursor.

		// Get set to look at track directly below the video track.
		trackEnum.moveNext(); // Go to next track.

			if (!trackEnum.atEnd()) { // Only proceed if there is a track below the video track.
				track = Track(trackEnum.item());// When doing the first track (above), these two lines were executed
				eventEnum = new Enumerator(track.Events); // in the FindSelectedTrack() function.
				if (track.IsAudio()) {// Only trim the event if this is an audio track.
					SelectEventAtCursor();
				}    
			}
		}
	}
	//  Vegas.Cursor = CurrentEvnt.Start;  // Enable this line to move cursor to start of selected event.
	Vegas.UpdateUI(); 

} catch (e) { 
	MessageBox.Show(e); 
} 

// End of main program


// Beginning of functions

function FindSelectedTrack() : Track {
	trackEnum = new Enumerator(Vegas.Project.Tracks);
	while (!trackEnum.atEnd()) {
		var track : Track = Track(trackEnum.item());

		if (track.Selected) {
			return track;
		}
		trackEnum.moveNext();
	}
	return null;
}

/** 
*
* The following function finds the event on the selected track 
* that lies under the cursor. It also deselects all other events. 
*
**/

function SelectEventAtCursor() {
	dCursor = Vegas.Cursor.ToMilliseconds(); // Remember the cursor position.

	//Go through each event on the track.
	CurrentEvnt=TrackEvent(eventEnum.item());

	while (!eventEnum.atEnd()) {
		evnt = TrackEvent(eventEnum.item());
		evnt.Selected = false; // De-select the event

		// Get the event's start and length timecode, in milliseconds.
		dStart = evnt.Start.ToMilliseconds();
		dLength = evnt.Length.ToMilliseconds();

/**
*     If the cursor timecode is between the beginning and end of the 
*     event timecodes, then select the event.
**/ 

		if ( dCursor == (dStart + dLength) ) {
			evnt.Selected = true; // Select this event.
		}
		CurrentEvnt = evnt;
		eventEnum.moveNext(); // Go to next event on this timeline.
	} 
}

The right black button on my Contour Shuttle Pro 2 now does this 3-stage macro:

  • Runs a script that deselects all events then does ALT+]
  • Then a 100ms pause (so that the next bit works. Might need to be longer in some cases)
  • Then runs the above script so I get immediate feedback on the trimmed event length in the Show Event Length extension.

I also have an equivalent ALT+[ macro on the Shuttle's left button, but the pause isn't required, and it uses the first script in this comment instead of the one above.

Slick workflow for fast cutting.