Hi, when I Close Gaps the envelope points get left behind, 'Lock envelopes to events' is on, Is there an option for this or it that just the way it is? Thanks.
I cannot tell from your image if your bottom toolbar has Rippling activated? I have mine rearranged differently so cannot tell which is which in your image.
Having now watched your video a few times, if you have rippling and Lock envelopes to Events both on then it's possibly a bug. Which VP22 Build are you on?
Rippling is on, with all three options & when rippling is off when I move the event the envelope points move with the event. 👍 But right click Close gaps leaves the envelope points behind with all rippling options whether it's on or off.
@Gid Confirmed, close gaps does not move the audio envelope. I tried 3th party scripts ( "closed gaps" 1-click commands event and track from the Vegasaur scripts) and it does the same, the envelopes do not move.
If the Vegas command is also script based behind the scenes, it is probably behaving similar and not taking in account envelopes. It is probably a bug as it cannot be the intention to leave the envelope alone if 'Lock envelopes to events' is on.
@bitman Thanks yep, I just tried a Composite envelope on the video track & that also doesn't move with Close Gaps.
-------------
I don't use this option very often but I just tried VP18 & 19, the envelope points don't move with Close Gaps there either, I skipped testing VP20 & 21 because if it doesn't work in VP18 & 19 it prob doesn't work in 20 & 21.
PS, just for anyone's interest, I normally use Ripple working my way along the timeline using A,D & S (trim end/start & split) but sometimes to go back on the timeline to trim events it's easier to spread the transition apart to make it easier to grab the ends, this obviously then leaves a gap that needs closing. Dragging them apart is no problem, the envelope stays attached to the event but when closing the gap ... 👍
Double click the gap to highlight it - Delete closes the gap if ripple is on, if ripple isn't on double click the gap - Delete then click F closes the gap, because -
That script seems temperamental, more likely I'm using it wrong, sometimes I can get it to work but quite often I get this msg, I've tried alsorts of scenarios, selecting, moving, cutting, trimming, adding/adjusting Envelope after moving or before.. but can't really figure out what is the correct way or what I'm doing wrong.. ?
@Gid Hello, when I wrote that script, the idea was to close the gaps by selecting the events, not by using the loop region selection. I think that error happens when you try to use the loop region selection. Anyway, I updated the script to work with both scenarios: manual selection and loop region selection. You can try out this new version and see if the issue persists or if it was solved.
using System;
using System.Collections.Generic;
using ScriptPortal.Vegas;
namespace Test_Script
{
public class Class1
{
public Vegas myVegas;
public void Main(Vegas vegas)
{
myVegas = vegas;
Timecode gapDuration = new Timecode("00:00:00:00");
List<List<TrackEvent>> eventGroups = new List<List<TrackEvent>>();
Timecode loopStart = myVegas.Transport.LoopRegionStart;
Timecode loopEnd = loopStart + myVegas.Transport.LoopRegionLength;
bool useLoopRegion = (loopEnd > loopStart);
foreach (Track track in myVegas.Project.Tracks)
{
foreach (TrackEvent trackEvent in track.Events)
{
if (trackEvent == null) continue;
bool shouldInclude = false;
if (useLoopRegion)
{
Timecode evStart = trackEvent.Start;
Timecode evEnd = evStart + trackEvent.Length;
// Check if event overlaps with loop region
if (evStart < loopEnd && evEnd > loopStart)
{
shouldInclude = true;
}
}
else
{
if (trackEvent.Selected)
{
shouldInclude = true;
}
}
if (!shouldInclude) continue;
if (trackEvent.Group != null)
{
bool groupExists = false;
foreach (var group in eventGroups)
{
if (group.Contains(trackEvent))
{
groupExists = true;
break;
}
}
if (!groupExists)
{
List<TrackEvent> eventGroup = new List<TrackEvent>();
foreach (TrackEvent groupedEvent in trackEvent.Group)
{
eventGroup.Add(groupedEvent);
}
eventGroups.Add(eventGroup);
}
}
else
{
eventGroups.Add(new List<TrackEvent> { trackEvent });
}
}
}
eventGroups.Sort((a, b) => a[0].Start.CompareTo(b[0].Start));
if (eventGroups.Count > 0)
{
Timecode currentStartTime = eventGroups[0][0].Start;
foreach (var group in eventGroups)
{
Timecode earliestStart = group[0].Start;
foreach (var trackEvent in group)
{
if (trackEvent.Start < earliestStart)
{
earliestStart = trackEvent.Start;
}
}
Timecode offset = currentStartTime - earliestStart;
foreach (var trackEvent in group)
{
Timecode originalStart = trackEvent.Start;
trackEvent.Start += offset;
Track track = trackEvent.Track;
if (track.IsAudio())
{
foreach (Envelope envelope in track.Envelopes)
{
if (envelope.Type == EnvelopeType.Volume)
{
MoveEnvelopePoints(envelope, originalStart, trackEvent.Length, trackEvent.Start);
}
}
}
}
Timecode latestEndTime = Timecode.FromFrames(0);
foreach (var trackEvent in group)
{
Timecode end = trackEvent.Start + trackEvent.Length;
if (end > latestEndTime)
{
latestEndTime = end;
}
}
currentStartTime = latestEndTime + gapDuration;
}
}
else
{
System.Windows.Forms.MessageBox.Show("No events found in loop region or selected.", "Info");
}
}
private void MoveEnvelopePoints(Envelope envelope, Timecode originalStart, Timecode eventLength, Timecode newStart)
{
Timecode originalEnd = originalStart + eventLength;
Timecode offset = newStart - originalStart;
List<EnvelopePoint> pointsToMove = new List<EnvelopePoint>();
List<Timecode> existingPositions = new List<Timecode>();
foreach (EnvelopePoint point in envelope.Points)
{
existingPositions.Add(point.X);
}
foreach (EnvelopePoint point in envelope.Points)
{
if (point.X >= originalStart && point.X <= originalEnd)
{
Timecode newX = point.X + offset;
bool alreadyExists = false;
foreach (Timecode pos in existingPositions)
{
if (pos == newX)
{
alreadyExists = true;
break;
}
}
if (!alreadyExists)
{
pointsToMove.Add(point);
existingPositions.Add(newX);
}
}
}
foreach (EnvelopePoint point in pointsToMove)
{
point.X += offset;
}
}
}
}
public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
Test_Script.Class1 test = new Test_Script.Class1();
test.Main(vegas);
}
}