Added "only loop region" mode to Vegas plugin

This commit is contained in:
Daniel Wolf 2016-12-23 16:51:43 +01:00
parent a4231b9783
commit 27965ce208
1 changed files with 17 additions and 1 deletions

View File

@ -49,7 +49,15 @@ public class EntryPoint {
List<TimedEvent> filteredEvents = FilterEvents(timedEvents[eventType], visualization.Regex); List<TimedEvent> filteredEvents = FilterEvents(timedEvents[eventType], visualization.Regex);
foreach (TimedEvent timedEvent in filteredEvents) { foreach (TimedEvent timedEvent in filteredEvents) {
Timecode start = Timecode.FromSeconds(timedEvent.Start); Timecode start = Timecode.FromSeconds(timedEvent.Start);
Timecode length = Timecode.FromSeconds(timedEvent.End) - start; Timecode end = Timecode.FromSeconds(timedEvent.End);
Timecode length = end - start;
if (config.LoopRegionOnly) {
Timecode loopRegionStart = vegas.Transport.LoopRegionStart;
Timecode loopRegionEnd = loopRegionStart + vegas.Transport.LoopRegionLength;
if (start < loopRegionStart || start > loopRegionEnd || end < loopRegionStart || end > loopRegionEnd) {
continue;
}
}
switch (visualization.VisualizationType) { switch (visualization.VisualizationType) {
case VisualizationType.Marker: case VisualizationType.Marker:
project.Markers.Add(new Marker(start, timedEvent.Value)); project.Markers.Add(new Marker(start, timedEvent.Value));
@ -149,6 +157,7 @@ public class Config {
private string logFile; private string logFile;
private bool clearMarkers; private bool clearMarkers;
private bool clearRegions; private bool clearRegions;
private bool loopRegionOnly;
private List<Visualization> visualizations = new List<Visualization>(); private List<Visualization> visualizations = new List<Visualization>();
[DisplayName("Log File")] [DisplayName("Log File")]
@ -173,6 +182,13 @@ public class Config {
set { clearRegions = value; } set { clearRegions = value; }
} }
[DisplayName("Loop region only")]
[Description("Adds regions or markers to the loop region only.")]
public bool LoopRegionOnly {
get { return loopRegionOnly; }
set { loopRegionOnly = value; }
}
[DisplayName("Visualization rules")] [DisplayName("Visualization rules")]
[Description("Specify how to visualize various log events.")] [Description("Specify how to visualize various log events.")]
[Editor(typeof(CollectionEditor), typeof(UITypeEditor))] [Editor(typeof(CollectionEditor), typeof(UITypeEditor))]