-
script for insert transition
Posted by Leaning Less on May 4, 2015 at 8:00 pmPlease help me to find a script (separate, not extension) for inserting transition after selected video event with the definite length and type (preset).
Steve Rhoden replied 11 years ago 3 Members · 5 Replies -
5 Replies
-
Steve Rhoden
May 4, 2015 at 8:26 pmYou can also do some searching over at the Sony Creative forum in
the Vegas Pro-Scripting header.Steve Rhoden (Cow Leader)
Film Maker & VFX Artist.
Owner of Filmex Creative Media.
Samples of my Work and Company can be seen here:
https://www.facebook.com/FilmexCreativeMedia -
Steve Rhoden
May 11, 2015 at 12:21 pmAny success in finding such a script or one close?
Steve Rhoden (Cow Leader)
Film Maker & VFX Artist.
Owner of Filmex Creative Media.
Samples of my Work and Company can be seen here:
https://www.facebook.com/FilmexCreativeMedia -
Edward Troxel
May 12, 2015 at 12:20 amHere’s one I “murkWare” wrote and I modified for Vegas Pro 5:
/**
* Save this text as ApplyTransitions.js
*
* Apply Transition to Adjacent Video events and optionally move
* events to overlap events.
*
* For use with Sonic Foundry Vegas Video 5.0
*
* Copyright 2002 murkWare (mj@sightworks.com)
* Modified 7/16/2003 https://www.jetdv.com/tts
**/
import System.Windows.Forms;
import Sony.Vegas;
var overlapTime = 1000;var dialog = new TransitionDialog(overlapTime);
var bFade = false; //Only true if the second list item is chosen
var bRandom = false; //Only true if the first list item is chosendialog.m_transList.Items.Add(“Random For each event”)
dialog.m_transList.Items.Add(“Standard Cross Fade”)var count = 0;
var totalTrans = Vegas.Transitions.Count;
var num;
var transEnum = new Enumerator(Vegas.Transitions);
while (!transEnum.atEnd()) {
var trans = transEnum.item();
if (count > 0)
dialog.m_transList.Items.Add(trans.Name);count++;
transEnum.moveNext();
}try {
dialog.m_transList.SelectedIndex = 0
var dialogResult = dialog.ShowDialog();
var iTrans = int(dialog.m_transList.SelectedIndex);if(System.Windows.Forms.DialogResult.OK == dialogResult) {
if (iTrans == 0) {
bRandom = true;
} else if(iTrans == 1) {
bFade = true
}var plugIn;
if(iTrans > 1) {
plugIn = Vegas.Transitions.GetChild(int(iTrans -1));
}overlapTime = new Timecode(int(dialog.overlapTimeBox.Text));
var startoffset = new Timecode(int(dialog.overlapTimeBox.Text));
var trackEnum = new Enumerator(Vegas.Project.Tracks);
var fx;while (!trackEnum.atEnd()) {
var tr = trackEnum.item();
var eventEnum = new Enumerator(tr.Events);while (!eventEnum.atEnd()) {
var ev = eventEnum.item();ev.FadeIn.Curve = CurveType.Slow
if (bRandom) {
num = int(Math.random() * totalTrans + 1);
if (num > 23) {
num = totalTrans – 1;
}
plugIn = Vegas.Transitions.GetChild(int(num));
}var startTime = ev.Start.ToMilliseconds();
var length = ev.Length.ToMilliseconds();startTime = ev.Start – startoffset;
if (startTime.ToMilliseconds() < 0) {
startTime = new Timecode(“00:00:00:00”);
startoffset = startoffset – overlapTime;
}var currTake = ev.ActiveTake;
var currOffset = currTake.Offset;
ev.Start = startTime;
currTake.Offset = currOffset;Vegas.UpdateUI();
if(ev.MediaType == MediaType.Video && !bFade) {
fx = new Effect(plugIn);
ev.FadeIn.Transition = fx;
}eventEnum.moveNext();
startoffset = startoffset + overlapTime;
}startoffset = overlapTime;
trackEnum.moveNext();
}
}
} catch (e) {
MessageBox.Show(e + “\n\nReport this error to mj@sightwork.com\n\n” + num);
}// Form subclass that is the dialog box for this script
class TransitionDialog extends Form {var overlapTimeBox;
var m_transList;function TransitionDialog(overlapTime) {
this.Text = “Add Transitions to adjacent events”;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.StartPosition = FormStartPosition.CenterScreen;
this.Width = 480;
this.Height = 120;var buttonWidth = 80;
var buttonHeight = 24;
var buttonTop = 60;overlapTimeBox = addTextControl(“Overlap Time (ms)”, 320, 140, 20, overlapTime.ToString());
m_transList = addComboBox(20,80,20);var okButton = new Button();
okButton.Text = “OK”;
okButton.Left = this.Width – ((buttonWidth+10));
okButton.Top = buttonTop;
okButton.Width = buttonWidth;
okButton.Height = buttonHeight;
okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
AcceptButton = okButton;
Controls.Add(okButton);var label = new Label();
label.AutoSize = true;
label.Text = “Copyright 2003 murkWare”
label.Left = 20;
label.Top = 80;
Controls.Add(label);
}function addTextControl(labelName, left, width, top, defaultValue) {
var label = new Label();
label.AutoSize = true;
label.Text = labelName + “:”;
label.Left = left;
label.Top = top + 4;
Controls.Add(label);var textbox = new TextBox();
textbox.Multiline = false;
textbox.Left = label.Right;
textbox.Top = top;
textbox.Width = width – (label.Width);
textbox.Text = defaultValue;
Controls.Add(textbox);return textbox;
}function addComboBox(left,width,top)
{var transList = new ComboBox();
// transList.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
// Or System.Windows.Forms.AnchorStyles.Right)
transList.DropDownWidth = width;
// transList.Items.AddRange(tem 5″});
transList.Location = new System.Drawing.Point(left, top);
transList.Size = new System.Drawing.Size(280, 21);
transList.TabIndex = 7;
Controls.Add(transList);return transList;
}}
-
Leaning Less
May 12, 2015 at 12:27 amThank you! But it’s not really something. what you need. Requires a single transition in one step.
-
Steve Rhoden
May 12, 2015 at 9:02 amAhh, there you go, Edward to the rescue.
I can never get my head fully wrapped around the Vegas script writing language.
Great Job in this area of expertise over the years Edward!Steve Rhoden (Cow Leader)
Film Maker & VFX Artist.
Owner of Filmex Creative Media.
Samples of my Work and Company can be seen here:
https://www.facebook.com/FilmexCreativeMedia
Reply to this Discussion! Login or Sign Up
