private void PosAlignByMarkers() { var selectedByTrack = myVegas.Project.GetSelectedEvents().GroupBy(item => item.Track); if (selectedByTrack.Count() < 2) { return; } var guideEvents = selectedByTrack.First(); var punchpoints = (guideEvents.Select(Ev => new { Ev, mmk = Ev.FindCurrentMetaMarker() }).Select(T => T.Ev.Start + T.mmk.GlobalMarkerOffset)).ToList(); selectedByTrack = selectedByTrack.Skip(1); // don't adjust the guide track using (var undo = new UndoBlock("Align by markers")) { foreach (var group in selectedByTrack) { var events = new List <TrackEvent>(); events.AddRange(group); for (int i = 0; i <= events.Count - 1; i++) { if (i > punchpoints.Count - 1) { break; } TrackEvent ev = events[i]; MetaMarker mmk = ev.FindCurrentMetaMarker(); Timecode newMkPos = punchpoints[i]; ev.Start = newMkPos - mmk.GlobalMarkerOffset; } } } }
internal static Marker FindCurrentMarker(this TrackEvent Event) { MetaMarker mmk = Event.FindCurrentMetaMarker(); if (mmk != null) { return(mmk.Marker); } return(null); }
private void SetCurrentMarkerOffset(TrackEvent Event, Timecode Offset) { MetaMarker mmk = Event.FindCurrentMetaMarker(); if (mmk == null) { return; } Event.ActiveTake.Offset = mmk.LocalMarkerOffset - Offset; }
public void SetMetaTake(TrackEvent TrackEvent, Marker TargetMarker) { MetaMarker currentMmk = TrackEvent.FindCurrentMetaMarker(); if (currentMmk == null) { return; } var targetMmk = new MetaMarker(TargetMarker, TrackEvent); TrackEvent.ActiveTake.Offset = targetMmk.GlobalMarkerPosition - currentMmk.GlobalMarkerOffset; }
public void SetMetaTake(TrackEvent TrackEvent, Marker TargetMarker) { MetaMarker currentMmk = TrackEvent.FindCurrentMetaMarker(); if (currentMmk == null) return; var targetMmk = new MetaMarker(TargetMarker, TrackEvent); TrackEvent.ActiveTake.Offset = targetMmk.GlobalMarkerPosition - currentMmk.GlobalMarkerOffset; }
private void SetCurrentMarkerOffset(TrackEvent Event, Timecode Offset) { MetaMarker mmk = Event.FindCurrentMetaMarker(); if (mmk == null) return; Event.ActiveTake.Offset = mmk.LocalMarkerOffset - Offset; }