I took a slightly different approach. This script goes through all of your media and creates subclips from regions found in the media that exists in your media pool. The subclips are grouped into media bins by media file name.
The main caveat to my script is that if you run it more than once, you'll duplicate your subclips. I'm working on that but I find this script to be an incredible time saver since I preselect my regions before assembling my project. I'll post updates as I improve this script...
using System;
using System.IO;
using System.Text;
using System.Collections;
using Sony.Vegas;
public class EntryPoint {
public void FromVegas(Vegas vegas) {
MediaBin bin;
Subclip subclip;
StringBuilder clipname = new StringBuilder();
int rcount;
foreach (Media m in vegas.Project.MediaPool) {
if (m.IsSubclip() || (m.Regions.Count < 1))
continue;
bin = new MediaBin("Subclips of " + Path.GetFileName(m.FilePath));
vegas.Project.MediaPool.RootMediaBin.Add(bin);
rcount = 0;
foreach(Region r in m.Regions) {
clipname.Length = 0;
clipname.Append(String.Format("Clip {0:000}", ++rcount));
if (r.Label.Trim().Length > 0) {
clipname.Append(" - ");
clipname.Append(r.Label);
}
subclip = new Subclip(m.FilePath, r.Position, r.Length, false, clipname.ToString());
bin.Add(subclip);
}
}
}
}
The main caveat to my script is that if you run it more than once, you'll duplicate your subclips. I'm working on that but I find this script to be an incredible time saver since I preselect my regions before assembling my project. I'll post updates as I improve this script...
using System;
using System.IO;
using System.Text;
using System.Collections;
using Sony.Vegas;
public class EntryPoint {
public void FromVegas(Vegas vegas) {
MediaBin bin;
Subclip subclip;
StringBuilder clipname = new StringBuilder();
int rcount;
foreach (Media m in vegas.Project.MediaPool) {
if (m.IsSubclip() || (m.Regions.Count < 1))
continue;
bin = new MediaBin("Subclips of " + Path.GetFileName(m.FilePath));
vegas.Project.MediaPool.RootMediaBin.Add(bin);
rcount = 0;
foreach(Region r in m.Regions) {
clipname.Length = 0;
clipname.Append(String.Format("Clip {0:000}", ++rcount));
if (r.Label.Trim().Length > 0) {
clipname.Append(" - ");
clipname.Append(r.Label);
}
subclip = new Subclip(m.FilePath, r.Position, r.Length, false, clipname.ToString());
bin.Add(subclip);
}
}
}
}