To match several different cameras during a multicam shoot, I'd like to be able to easily add Media FX filters to my files. It's a simple rewrite of the "Add Timecode to All Media" script, but try as I might I can't figure out why it stops at line 23. For anyone who has a moment, I'd appreciate a look:
/**
* This script will add a video effect to each selected item
* in the current project's media pool.
*
* Revision Date:
**/
using System;
using Sony.Vegas;
class EntryPoint
{
//name of desired FX plugin
string plugInName = "Sony Brightness and Contrast";
// presetName is the name of the preset you want to use. Set it to
// null if you want the default preset.
string presetName = "Brighter";
public void FromVegas(Vegas vegas)
{
PlugInNode fx = Vegas.VideoFX;
PlugInNode plugIn = fx.GetChildByName.plugInName.presetName;
if (null == plugIn)
{
throw new ArgumentException("could not find a plug-in", plugInName);
}
foreach (Media media in vegas.Project.MediaPool.GetSelectedMedia())
{
// only add the effect if the media object has video
if (!media.HasVideo())
continue;
// and if it does not already have the effect
if (MediaHasEffect(media, plugIn))
continue;
Effect effect = new Effect(plugIn);
media.Effects.Add(effect);
if (null != presetName)
effect.Preset = presetName;
}
}
public bool MediaHasEffect(Media media, PlugInNode plugIn)
{
foreach (Effect effect in media.Effects)
{
if (effect.PlugIn == plugIn)
return true;
}
return false;
}
}
Sorry I can't format this code properly, the Sony Forum Preview Tool site doesn't seem to exist anymore...
/**
* This script will add a video effect to each selected item
* in the current project's media pool.
*
* Revision Date:
**/
using System;
using Sony.Vegas;
class EntryPoint
{
//name of desired FX plugin
string plugInName = "Sony Brightness and Contrast";
// presetName is the name of the preset you want to use. Set it to
// null if you want the default preset.
string presetName = "Brighter";
public void FromVegas(Vegas vegas)
{
PlugInNode fx = Vegas.VideoFX;
PlugInNode plugIn = fx.GetChildByName.plugInName.presetName;
if (null == plugIn)
{
throw new ArgumentException("could not find a plug-in", plugInName);
}
foreach (Media media in vegas.Project.MediaPool.GetSelectedMedia())
{
// only add the effect if the media object has video
if (!media.HasVideo())
continue;
// and if it does not already have the effect
if (MediaHasEffect(media, plugIn))
continue;
Effect effect = new Effect(plugIn);
media.Effects.Add(effect);
if (null != presetName)
effect.Preset = presetName;
}
}
public bool MediaHasEffect(Media media, PlugInNode plugIn)
{
foreach (Effect effect in media.Effects)
{
if (effect.PlugIn == plugIn)
return true;
}
return false;
}
}
Sorry I can't format this code properly, the Sony Forum Preview Tool site doesn't seem to exist anymore...