@jetdv Sir, please, if possible, how can I add 4 points to this velocity envelope. If I select a Video event, then I need the velocity envelope to be created and automatically adds 4 points in the middle of the event, I mean, any selected event with any duration. How can I do that?
using System; using ScriptPortal.Vegas; using System.Windows.Forms; namespace AddVelocityEnvelope { public class Class1 { public Vegas myVegas; public void Main(Vegas vegas) { myVegas = vegas; foreach (Track myTrack in myVegas.Project.Tracks) { if (myTrack.IsVideo()) { foreach (TrackEvent evnt in myTrack.Events) { if (evnt.Selected) { VideoEvent vevnt = (VideoEvent)evnt; Envelope vEnv = GetOrCreateVelocityEnvelope(vevnt); if (vEnv != null) { AddEnvelopePoint(vEnv, evnt.Start, 1.0); } } } } } } private Envelope GetOrCreateVelocityEnvelope(VideoEvent vevnt) { foreach (Envelope env in vevnt.Envelopes) { if (env.Type == EnvelopeType.Velocity) { return env; } } Envelope newEnv = new Envelope(EnvelopeType.Velocity); vevnt.Envelopes.Add(newEnv); return newEnv; } private void AddEnvelopePoint(Envelope MyEnv, Timecode PointLoc, double PointSpeed) { try { EnvelopePoint newPoint = new EnvelopePoint(PointLoc, PointSpeed); MyEnv.Points.Add(newPoint); } catch (Exception ex) { MessageBox.Show("Failed to add envelope point: " + ex.Message); } } } public class EntryPoint { public void FromVegas(Vegas vegas) { Class1 script = new Class1(); script.Main(vegas); } } }