FORUMS: list search recent posts

Request; Simple sony vegas ping pong script

COW Forums : VEGAS Pro

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Josiah Jackson
Request; Simple sony vegas ping pong script
on May 25, 2016 at 5:58:02 pm

I have spent some time searching for a similar script with no luck, so heres hoping some has the time to help (any is appreciated!).

DESCRIPTION
My only video clip is always on the first track and selected. I wish the script to make a ping-pong animation that lasts about one minute by pasting a copies together of this clip reversing the play direction of each one. The last clip should be reversed so the entire track (video) loops.

1.get the current selected clip.
2.copy the current selected clip and its events.
3.paste the clip to the end of the first clip on the same track.
4.If the clip is an even number paste, then set the pasted clips play direction to "reverse"
5.continue pasting to the end to fill ~ 1 minute track length making sure to end with an even number of clips( end with a reversed clip).

One big problem is there seems to be no way to reverse the direction via script.

Any help is greatly appreciated!


Return to posts index

Aleksey Tarasov
Re: Request; Simple sony vegas ping pong script
on May 25, 2016 at 6:37:26 pm

You don't need a script for that:

1. Place 2 clips on a track (normal and reversed)
2. Select both events and copy them to the clipboard (Ctrl+C)
3. Place cursor to the end and run Edit > Paste Repeat


Return to posts index

Josiah Jackson
Re: Request; Simple sony vegas ping pong script
on May 25, 2016 at 8:39:12 pm

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;
}
}



Return to posts index


Aleksey Tarasov
Re: Request; Simple sony vegas ping pong script
on May 25, 2016 at 9:10:36 pm

Okay, try this:

((VideoEvent) currentEvent).Envelopes.Add(VolEnv);


Return to posts index

Josiah Jackson
Re: Request; Simple sony vegas ping pong script
on May 25, 2016 at 9:53:09 pm

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!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]