This script will find every event on the selected track that completely overlaps another event. This is almost never what you want. You may have found, after lots of editing, that small event "slivers" are on one of your tracks, and they lie on top of another event. The smaller event takes complete precedence, which means that the video will suddenly switch to the smaller event and then back again to the longer event. If the event is really small, it is almost impossible to see by scanning the timeline with your eye, especially if you have lots of tracks.
This script will put a marker at every such event, so you can easily go to that location and move or delete the smaller event.
The one "pathological" case this doesn't check for is when one event is exactly identical in length to another event and sits directly on top of it.
[Edit] The script has been changed so it now will also find two events that are the exact same length that sit identically on top of each other -- November 13, 2006
Finally, this is a very simple script and not very elegant. It could easily be made much faster, as any programmer will instantly see, but for most people the difference in speed won't be noticeable, so I didn't bother to add the extra performance.
                        
                    
                    
                            This script will put a marker at every such event, so you can easily go to that location and move or delete the smaller event.
The one "pathological" case this doesn't check for is when one event is exactly identical in length to another event and sits directly on top of it.
[Edit] The script has been changed so it now will also find two events that are the exact same length that sit identically on top of each other -- November 13, 2006
Finally, this is a very simple script and not very elegant. It could easily be made much faster, as any programmer will instantly see, but for most people the difference in speed won't be noticeable, so I didn't bother to add the extra performance.
/**
* This script finds events that completely overlap another event on the first selected track.
*
* Written By: John H. Meyer
* Date: August 21, 2006
* Revised November 13, 2006
*
**/
import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;
var MyMarker : Marker; // Global function used in main program and in function
var evnt : TrackEvent;
var trackEnum : Enumerator;
var i;
try {
var dirty = 0;
var track = FindSelectedTrack(); //Use this function to find the first selected track.
//Go through the list of Events
var eventEnum = new Enumerator(track.Events);
var count = track.Events.Count;
while (!eventEnum.atEnd() ) {
evnt = TrackEvent( eventEnum.item() );
var evntstart=evnt.Start.ToMilliseconds();
var evntend=evnt.End.ToMilliseconds();
for (i = 0; i < count; i++) {
var test1 = track.Events[i].Start.ToMilliseconds();
var test2 = track.Events[i].End.ToMilliseconds();
var thisevent = TrackEvent ( track.Events[i] );
// if ( (test1>=evntstart) && (test2<=evntend) && !((test1==evntstart) && (test2==evntend)) ) {
if ( (test1>=evntstart) && (test2<=evntend) && !(thisevent==evnt) ) {
if (!MarkerExist(test1) ) {
MyMarker = new Marker(track.Events[i].Start);
Vegas.Project.Markers.Add(MyMarker);
MyMarker.Label = "****Overlapped event";
}
dirty = 1;
}
}
eventEnum.moveNext();
} // End While eventEnum
if (dirty == 1) {
Vegas.UpdateUI();
MessageBox.Show("Overlaped events were found!","Completed",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else {
MessageBox.Show("No overlaped events.","Completed",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
} catch (e) {
MessageBox.Show(e);
}
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;
}
function MarkerExist (dStart) : boolean {
var markerEnum = new Enumerator(Vegas.Project.Markers);
while (!markerEnum.atEnd()) {
MyMarker = markerEnum.item(); // MyMarker is a global function in this project
var MarkerStart = MyMarker.Position.ToMilliseconds();
if ( dStart == MarkerStart ) {
return 1;
}
markerEnum.moveNext();
} // End while markerEnum
return 0;
}