www.jetdv.com Forum Index Edward Troxel
Vegas Scripting and Newsletters
Home of Excalibur and Montage Magic
 
 FAQ   Search   Memberlist   Usergroups   Register   Profile 
 Log in to check your private messagesLog in to check your private messages   Log inLog in 

Fade to black and back

 
Post new topic   Reply to topic    www.jetdv.com Forum Index -> Free Scripts
View previous topic :: View next topic  
Author Message
ztalk112



Joined: 12 Aug 2004
Posts: 14

PostPosted: Wed May 25, 2005 12:01 am    Post subject: Fade to black and back Reply with quote

Hi Edward,

Your assistance please . . .

I'd like to automate the process of splitting an event, inserting a gap (of say, 15 frames) and placing a fade-out at the event split and a fade-in at the begining of the new event.

ie . . . the effect is fade to black and back again (and the fade in/out should be customizable as to length/type).

Is there a script available that does this?

Thanks in anticipation.
Back to top
View user's profile Send private message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Wed May 25, 2005 2:43 am    Post subject: Reply with quote

I don't know if there's one that specifically does that but one could definitely be written to do so. As for splitting, it's just a matter of doing:

rightEvent = Event.Split;

To do the fades, you would do a:

rightEvent.FadeIn = new Timecode("00:00:00:15");
Event.FadeOut = new Timecode("00:00:00:15");

Moving the event is a little trickier but can also be done.


If you want to send me an e-mail with the full specifics, I'll see about whipping up something tomorrow.
Back to top
View user's profile Send private message Send e-mail
ztalk112



Joined: 12 Aug 2004
Posts: 14

PostPosted: Wed May 25, 2005 3:18 am    Post subject: Reply with quote

Thanks for your reply Edward.

I'll draft an email with a link to a sample clip and get it away this afternoon.

Gary
Back to top
View user's profile Send private message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Wed May 25, 2005 1:34 pm    Post subject: Reply with quote

Here's a script that will do most of what you want. Here's how it
works:

1) Place the cursor where you wish the fade out/in to occur
2) Select the events to be affected
3) Run the script which will split the selected events under the
cursor, fade out the left side, fade in the right side, deselect all
events left of the cursor, select all events right of the cursor, and
create a selection area of the specified size.
4) Make sure "Ignore event grouping" is turned ON and then you can
move the selected events to the end of the selection area.
5) Make sure you turn "Ignore event grouping" back OFF.

Ripple editing is not a built-in function available to scripting. It
can be done but requires much more code than a simple "quick and
dirty" script will allow as EVERY event must be manually moved by the
script. Creating the selection area should give you an easy
work-around to the problem.


Code:

/**
 * This script will split selected events at the cursor location,
 * fade out the left clip, and fade in the right clip.
 * It will then select all events to the right of the cursor allowing
 * them all to be easily shifted right.
 *
 * A small selection area will be made to make the exact distance of
 * the move right easy to locate.
 *
 * Written By: Edward Troxel
 * Copyright 2005 - JETDV Scripts
 * Modified: 05-25-2005
 **/

import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;

var fadeOut : Timecode = new Timecode("00:00:00:15");
var fadeIn : Timecode = new Timecode("00:00:00:15");
var ShiftDist : Timecode = new Timecode("00:00:00:15");

try {
  //Split all selected events & add the fades
  //Go through the list of Tracks
  var trackEnum = new Enumerator(Vegas.Project.Tracks);
  while (!trackEnum.atEnd()) {
    var track : Track = Track(trackEnum.item());

    //Go through the list of Events
    var eventEnum = new Enumerator(track.Events);
    while (!eventEnum.atEnd()) {
      var evnt : TrackEvent = TrackEvent(eventEnum.item());

      if (evnt.Selected) {
         if ((evnt.Start < Vegas.Cursor) && ((evnt.Start + evnt.Length) > Vegas.Cursor)) {
           var revnt : TrackEvent = evnt.Split(Vegas.Cursor - evnt.Start);
           evnt.FadeOut.Length = fadeOut;
           revnt.FadeIn.Length = fadeIn;
         }
      }
      eventEnum.moveNext();
    }
    trackEnum.moveNext();
  }

  //Now select only those events to the right of the cursor
  //Go through the list of Tracks
  trackEnum = new Enumerator(Vegas.Project.Tracks);
  while (!trackEnum.atEnd()) {
    track = Track(trackEnum.item());

    //Go through the list of Events
    eventEnum = new Enumerator(track.Events);
    while (!eventEnum.atEnd()) {
      evnt = TrackEvent(eventEnum.item());

      if (evnt.Start >= Vegas.Cursor) {
         evnt.Selected = true;
      } else {
         evnt.Selected = false;
      }
      eventEnum.moveNext();
    }
    trackEnum.moveNext();
  }

  //Create a selection area to aid in moving the selected events
  Vegas.SelectionStart = Vegas.Cursor;
  Vegas.SelectionLength = ShiftDist;

} catch (e) {
    MessageBox.Show(e);
}
Back to top
View user's profile Send private message Send e-mail
ztalk112



Joined: 12 Aug 2004
Posts: 14

PostPosted: Wed May 25, 2005 5:10 pm    Post subject: Reply with quote

Wow . . . thanks for that Edward.

As I said via email, I didn't expect you to donate scripting time for nothing. Very generous of you.

For the benefit of other readers . . . you can view two examples of the finished effect I'm after by viewing the "Lighting Green Screen" QT clip linkled in the box at top right titled "Short Video Excerpts" on this page at DVCreators.net: http://dvcreators.net/products/dv_enlightenment.html

Find those examples at 1 min 25 sec and 1 min 33 into the clip.

Thanks again.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.jetdv.com Forum Index -> Free Scripts All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.11 © 2001, 2002 phpBB Group