public static List <List <TrackEvent> > GetEventGroups(this ScriptPortal.Vegas.Project Project) { List <TrackEvent> events = Project.GetSelectedEvents(true); if (events.Count == 0) { events = Project.GetAllEvents(); } var groups = new List <List <TrackEvent> >(); for (int i = 0; i < events.Count(); i++) { var ev = events[i]; bool foundgrp = false; foreach (var grp in groups) { if (grp.Any(grpEv => grpEv.Start < ev.End && grpEv.End > ev.Start)) { grp.Add(ev); foundgrp = true; } } if (!foundgrp) { groups.Add(new List <TrackEvent> { ev }); } } return(groups); }
/// /// Rendering /// public static RenderParamSet GetParamsAt(this ScriptPortal.Vegas.Project Project, Timecode Time) { var renderParams = new RenderParamSet(); var cmarkers = Project.CommandMarkers.Where(mk => mk.Position <= Time); foreach (var mk in cmarkers) { renderParams.ParseCommandMarker(mk); } return(renderParams); }
public static List <TrackEvent> GetSelectedEvents(this ScriptPortal.Vegas.Project Project, bool SortByTime = false) { var selectedEvents = new List <TrackEvent>(); foreach (Track trk in Project.Tracks) { selectedEvents.AddRange(trk.Events.Where(ev => ev.Selected)); } if (SortByTime) { selectedEvents = selectedEvents.SortByTime(); } return(selectedEvents); }
public static Region FindRegion(this ScriptPortal.Vegas.Project Project, string RegionName, Timecode After) { var matchingRegions = new List <Region>(); foreach (Region r in Project.Regions) { if (r.Label.ToLower().Contains(RegionName.ToLower())) { matchingRegions.Add(r); if (r.Position > After) { return(r); // assumes sorted list of regions. } } } if (matchingRegions.Any()) { return(matchingRegions[0]); } return(null); }
public static List <TrackEvent> GetAllEvents(this ScriptPortal.Vegas.Project Project) { return(Project.Tracks.SelectMany(CTrack => CTrack.Events).ToList()); }
public static Region FindRegion(this ScriptPortal.Vegas.Project Project, string RegionName) { return(FindRegion(Project, RegionName, Timecode.FromSeconds(0))); }