MAGIX VEGAS: MAGIX Vegas Tutorials MAGIX Vegas Forum Articles Black Magic Design Forum AJA Xena Forum

Re: FourPoints Script not working for Vegas 13

COW Forums : VEGAS Pro

VIEW ALL   •   ADD A NEW POST   •   PRINT
Respond to this post   •   Return to posts index   •   Read entire thread


Cody Davis
Re: FourPoints Script not working for Vegas 13
on Sep 24, 2018 at 10:01:40 pm

It was giving an error with details:C:\Users\owner\Documents\Vegas scripts\vegas 4 point selection script.cs(3) : The type or namespace name 'Vegas' could not be found (are you missing a using directive or an assembly reference?)

I don't understand: the Vegas Pro 13 uses: using Sony.Vegas;

Vegas Pro 14+ uses: using ScriptPortal.Vegas;
____
This is the script I was using:

public class EntryPoint
{
Vegas myVegas;

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

//Change this line to change the distance between the points
Timecode FPDist = new Timecode("00:00:01:00");

foreach(Track track in myVegas.Project.Tracks)
{
//Now check for Volume Envelope
if (track.IsAudio() && track.Selected)
{
// Find the volume envelope on this track - add if needed
Envelope VolEnv = FindEnvelope(track, EnvelopeType.Volume);
if (null == VolEnv)
{
VolEnv = new Envelope(EnvelopeType.Volume);
track.Envelopes.Add(VolEnv);
}

double ClipVol = VolEnv.ValueAt(myVegas.SelectionStart);
//Now set the points
SetPoint(VolEnv, myVegas.Transport.LoopRegionStart, ClipVol);
SetPoint(VolEnv, myVegas.Transport.LoopRegionStart - FPDist, ClipVol);
SetPoint(VolEnv, myVegas.Transport.LoopRegionStart + myVegas.Transport.LoopRegionLength + FPDist, ClipVol);
SetPoint(VolEnv, myVegas.Transport.LoopRegionStart + myVegas.Transport.LoopRegionLength, ClipVol);
}
}
}

private Envelope FindEnvelope(Track track, EnvelopeType etype)
{
foreach(Envelope env in track.Envelopes)
{
if (env.Type == etype)
{
return env;
}
}
return null;
}

private void SetPoint(Envelope menv, Timecode PLoc, double PVal)
{
EnvelopePoint a = menv.Points.GetPointAtX(PLoc);

if (a == null)
{
a = new EnvelopePoint(PLoc, PVal);
menv.Points.Add(a);
}
else
{
a.Y = PVal;
}
}

}


Posts IndexRead Thread 


Current Message Thread:





© 2019 CreativeCOW.net All Rights Reserved
[TOP]