Forum Replies Created

  • Josiah Jackson

    May 25, 2016 at 9:53 pm in reply to: Request; Simple sony vegas ping pong script

    Wow! Works perfectly.

    Is that a cast as a videoevent?
    Thank you so much! I had been getting a headache!

    All that is left for me is to figure out setting the envelope point(?) to -100.

    Huge Thanks again Aleksey, I am just a novice and I really appreciate the help!

  • Josiah Jackson

    May 25, 2016 at 8:39 pm in reply to: Request; Simple sony vegas ping pong script

    Thank you for your time, I really would like a script as I have a large volume to create.

    I could not find a way to “reverse” a clip using script so currently I am trying to put a velocity envelope on every other clip and set it to -100.

    This is what I have so far. It does get the selected clip and then paste it end to end x times, but I get the error;

    “TrackEvent’ does not contain a definition for ‘Envelopes'”

    when trying to add the velocity envelopes. Isnt each clip in a track a “trackevent”?


    using System;
    using System.Windows.Forms;
    using Sony.Vegas;

    public class EntryPoint
    {
    Vegas myVegas; //The vegas instance
    TrackEvent initialEvent;
    TrackEvent currentEvent;
    Timecode endTime;
    int totalClips = 4;

    public void FromVegas(Vegas vegas)
    {
    myVegas = vegas;

    initialEvent = FindSelectedEvent(vegas);
    if (initialEvent != null)
    {
    endTime = initialEvent.Length;

    for (int i = 1; i < totalClips; i++)
    {
    currentEvent = initialEvent.Copy(initialEvent.Track, endTime); // create a copy on the same track at endTime
    endTime += initialEvent.Length; // add length offset

    if(currentEvent.Index % 2 !=0) // if it is odd, it needs to play in reverse
    {
    // Add velocity envelope and set at -100
    Envelope VolEnv = new Envelope(EnvelopeType.Velocity);
    currentEvent.Envelopes.Add(VolEnv);
    }
    }
    }

    // FUNCTIONS

    public TrackEvent FindSelectedEvent(Vegas vegas)
    {
    foreach (Track track in vegas.Project.Tracks)
    {
    foreach (TrackEvent trackEvent in track.Events)
    {
    if (trackEvent.Selected && trackEvent.Index == 0) // clip must be selected and the first one on the track
    {
    return trackEvent;
    }
    }
    }
    return null;
    }
    }

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy