低端网盘 低端网盘C
关注数: 25 粉丝数: 1,647 发帖数: 197,057 关注贴吧数: 69
Vegas Pro 14 timeline gap script /** * Program: * Description: Remove gaps between events. This removes gaps in SELECTED events only. The remove gap function only works on selected events. All events before and after the selected event are NOT processed. The GAP constant is used as the defined spacer between events as they are processed. If you want the space between events to be 0, then set GAP to 0. GAP unit is milliseconds. Default is 1000 (1sec). This script was created because the only other RemoveGaps script found on the interet had a bug where it truncated the end of each event on complex tracks. This script works on complex tracks with 1000's of events. Also the other script processed all events on a track, this script processes only selected tracks, so you can selectivly decide which evemts to process and which to not process. * Author: JRD * * Date: April 17, 2011 **/ import ScriptPortal.Vegas; import System.Windows.Forms; import Microsoft.Win32; import System.Diagnostics; try { Debug.WriteLine("RemoveGaps-> START"); var GAP = 1000; // step through all selected video events: var FirstTrack : Track = Vegas.Project.Tracks.Item(0); var idx = 0; var countSel = 0; // step through all selected video events: for (var track in Vegas.Project.Tracks) { if( !track.Selected || track.MediaType == MediaType.Audio) continue; var tracktime = new Timecode(0); var last = 0; var begin = 0; for (var evnt in track.Events) { if (evnt.Selected) { // start after first event if (idx > 0 && countSel > 0) { Debug.WriteLine("RemoveGaps-> idx -> " + idx); // get diff between previous this event and last var diff = (evnt.Start.ToMilliseconds() - last); Debug.WriteLine("RemoveGaps-> diff -> " + diff); // if diff is greater than GAP? then fill it if (diff > GAP) { var start = Timecode.FromMilliseconds(last + GAP); var end = Timecode.FromMilliseconds(start.ToMilliseconds() + evnt.Length.ToMilliseconds()); var len = Timecode.FromMilliseconds( evnt.End.ToMilliseconds() - evnt.Start.ToMilliseconds()); Debug.WriteLine("RemoveGaps-> diff > GAP " ); Debug.WriteLine("RemoveGaps-> diff > Set evnt.Start to-> " + start.ToMilliseconds().ToString()); Debug.WriteLine("RemoveGaps-> diff > Set evnt.End to-> " + end.ToMilliseconds().ToString()); Debug.WriteLine("RemoveGaps-> diff > Set evnt.Length to-> " +len.ToMilliseconds().ToString()); evnt.Start = start; // new start evnt.End = end; // new end evnt.Length = len; // calculate exact length countSel++; } } countSel++; } last = evnt.End.ToMilliseconds(); tracktime = tracktime + evnt.Length; idx++; } } Debug.WriteLine("RemoveGaps-> DONE"); } catch (errorMsg) { Debug.WriteLine("RemoveGaps-> ERROR-> " + errorMsg); MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
首页 4 5 6 7 8 9 下一页