Matt Carlson
Forum Replies Created
-
and….. disregard all the other posts. Programming for .Net 2.0 (although not entirely necessary with Vegas anymore) turns my mind in to a pretzel. This is a script that will run smoothly…
using System;
using System.Collections.Generic;
using Sony.Vegas;public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
List OrderedEvents = new List();
bool all = true;foreach (Track track in vegas.Project.Tracks)
{
if (track.IsAudio()) continue;
foreach (TrackEvent ev in track.Events)
{
if (all || ev.Selected)
{
OrderedEvents.Add(ev);}
}
}
int count = 1;OrderedEvents.Sort(delegate (TrackEvent e1, TrackEvent e2)
{
return e1.Start.CompareTo(e2.Start);
});string basename = OrderedEvents[0].ActiveTake.Name;
foreach (TrackEvent ev in OrderedEvents)
{
ev.ActiveTake.Name = basename + count;
count++;
}
}
} -
…. and finally this script will number by order of event start times over multiple tracks.
It also works on a project with a single video track but in either case only video events are numbered which I believe will be fine for what you need.
using System;
using System.Collections.Generic;
using Sony.Vegas;public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
List OrderedEvents = new List();
bool all = true;foreach (Track track in vegas.Project.Tracks)
{
if (track.IsAudio()) continue;
foreach (TrackEvent ev in track.Events)
{
if (all || ev.Selected)
{
OrderedEvents.Add(ev);
OrderedEvents.Sort(delegate (TrackEvent e1, TrackEvent e2)
{
return e1.Start.CompareTo(e2.Start);
});
}
}
}
int count = 1;
string basename = OrderedEvents[0].ActiveTake.Name;foreach (TrackEvent ev in OrderedEvents)
{
ev.ActiveTake.Name = basename + count;
count++;
}
}
}
-
Ah the perils of scripting late at night….
The last script will error if any tracks are empty of events.This one should be fine but you mentioned your actual project has multiple tracks. Numbering events in order over multiple tracks is a more complicated script. Do you need that?
using System;
using Sony.Vegas;using System;
using Sony.Vegas;public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
const bool all = true;foreach (Track track in vegas.Project.Tracks)
{
string basename = "";
if (track.Events.Count > 0)
basename = track.Events[0].ActiveTake.Name;
int count = 1;
foreach(TrackEvent ev in track.Events)
{
if (all || ev.Selected)
{
ev.ActiveTake.Name = basename + count;
count++;
}
}
}
}
} -
I will look in to the errors… not sure why Reflection is having such a fit on a simple script.
As for naming if you want the first event to be “1” just have the first event name be blank.
The naming goes like this: first Event Name + number.
So if your first event is named Final the names will be: Final1, Final2, etc.
By naming the first event “1” you get names: 11, 12, 13… 110,111 etc because it is “1” + count;
Do you need the audio events named as well? I could just make the script skip audio tracks.
-
Here is a script but there are a few considerations…
Are all the events on the same track?
If not do you want the order to be track specific anyway?This script’s logic will order on per track basis and use the first events active name as the base + the count.
using System;
using Sony.Vegas;public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
const bool all = true;foreach (Track track in vegas.Project.Tracks)
{
string basename = track.Events[0].ActiveTake.Name;
int count = 1;
foreach(TrackEvent ev in track.Events)
{
if (all || ev.Selected)
{
ev.ActiveTake.Name = basename + count;
count++;
}
}
}
}
}If events are on multiple tracks it will get a bit trickier.
I put “const bool all = true;” in there so if you only wanted to do selected events you can change it to false.
-
Vegas is a bit weird that way… they did not put in simple features but they did put in a fully realized extension interface that we can all use to make those simple features ourselves.
The Set Playback Rate button will calculate the size of each selected event in relation to the new playback rate. If you want to play around with Black Tools let me know.
-
This can be done with scripting but not natively in Vegas. How long before you start doing this by hand? I was planning to do this anyway and could have it finished later on today (maybe in about 4 hours.)
-
using System;
using Sony.Vegas;public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
foreach (Track track in vegas.Project.Tracks)
{
foreach (TrackEvent ev in track.Events)
{
if (ev.Selected)
{
//All selected event modifications followev.Loop = false;
if (ev.IsVideo())
{
VideoEvent ve = (VideoEvent)ev;
ve.ResampleMode = VideoResampleMode.Disable;
}
}
}
}
}
}
You can modify the code after “if (ev.Selected)” to work on a single parameter by deleting parts and saving it as a separate script if you need to do so.
-
For rendering markers you need to have a final marker labeled “end” (without quotes) otherwise the last marker will render to the end of the project.
-
I never noticed that this forum does not have personal messages until now. Anyone who wants to give this a spin feel free. Any feedback can go to blackstingproductions@gmail.com
https://www.dropbox.com/s/uq67llrf0o4fzbf/VegasBlackTools.dll
I am assuming since you have used other extensions you know how they work and where to find them in Vegas. Just place this in My Documents/Vegas Application Extensions and start “Black Tools”.
