View previous topic :: View next topic |
Author |
Message |
fredfillis
Joined: 19 Aug 2007 Posts: 27 Location: Washington DC via Australia!
|
Posted: Tue Aug 21, 2007 12:41 am Post subject: Pre / Post Toggle? |
|
|
Hi all,
My first post here after some reading. Great information, most of it over my head
I'm very definitely a newb to scripting and vegas generally.
I've modified the Add B&W Effect to Selected Events to apply a Border preset and that works fine. What I really need though is to toggle the pre/post toggle when the effect is applied. Can anyone point me in the right direction? |
|
Back to top |
|
 |
Edward Troxel Site Admin
Joined: 14 Jul 2004 Posts: 5476
|
Posted: Tue Aug 21, 2007 2:22 am Post subject: |
|
|
Absolutely. You need to add the last line here. The rest is added for your reference so you can get the variable names correct:
Effect effect = new Effect(plugIn);
videoEvent.Effects.Add(effect);
effect.Preset = presetName;
effect.ApplyBeforePanCrop = true; |
|
Back to top |
|
 |
fredfillis
Joined: 19 Aug 2007 Posts: 27 Location: Washington DC via Australia!
|
Posted: Tue Aug 21, 2007 11:35 am Post subject: |
|
|
Edward,
Thanks very much for help and the quick response.
I noticed after the script successfully completed that Vegas was sluggish and when I selected View->Project Media that Vegas would appear to lock-up.
Do I need to release or clear some stuff out of memory after importing at the start of the script? |
|
Back to top |
|
 |
Edward Troxel Site Admin
Joined: 14 Jul 2004 Posts: 5476
|
Posted: Tue Aug 21, 2007 1:05 pm Post subject: |
|
|
Running that script should not affect Vegas in any adverse way. The script should not cause any "sluggishness". All it does is add the effect and set the pre/post flag just like you would manually do so. |
|
Back to top |
|
 |
fredfillis
Joined: 19 Aug 2007 Posts: 27 Location: Washington DC via Australia!
|
Posted: Wed Aug 22, 2007 12:42 am Post subject: |
|
|
Thanks Edward. Probably just windows.
I've used your B&W "free" script and modified according. I'm somewhat confused (situation normal) about the differences between that script and the code snippets you posted above.
The free script is full of stuff like
Code: | var z59eba499bf=Vegas.VideoFX;
var z952c58c88c=z59eba499bf.GetChildByName(z2c9d3d09d6); |
Not exactly english. Is this just your preferred way of coding or do those esoteric variable names actually relate to something?
I figured out what I needed to change, but found it a struggle keeping track of what variable was what. Maybe I'm missing the point? |
|
Back to top |
|
 |
Edward Troxel Site Admin
Joined: 14 Jul 2004 Posts: 5476
|
Posted: Wed Aug 22, 2007 1:03 pm Post subject: |
|
|
That particular script was "obfuscated" making it more difficult to read. As you can see, scripts are simply text files. And it's kind of hard to protect a text file. This was definitely more important with a product such as Excalibur. That particular script was written when I was testing ways to protect Excalibur. I just did some looking and found the "clear" version still on my hard drive:
Code: | /**
* This script will add the B&W effect to all selected events.
*
* Written By: Edward Troxel
* Copyright 2004 - JETDV Scripts
* Modified: 10-01-2004
**/
import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;
try {
//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) {
var ve : VideoEvent = VideoEvent(evnt);
var plugInName = "Sony Black and White";
var presetName = "100% Black and White";
var fx = Vegas.VideoFX;
var plugIn = fx.GetChildByName(plugInName);
var effect = new Effect(plugIn);
ve.Effects.Add(effect);
if (null != presetName) {
effect.Preset = presetName;
}
}
eventEnum.moveNext();
}
trackEnum.moveNext();
}
} catch (e) {
MessageBox.Show(e);
} |
This version should make MUCH more sense. |
|
Back to top |
|
 |
fredfillis
Joined: 19 Aug 2007 Posts: 27 Location: Washington DC via Australia!
|
Posted: Wed Aug 22, 2007 9:23 pm Post subject: |
|
|
Edward Troxel wrote: | That particular script was "obfuscated" making it more difficult to read.
This version should make MUCH more sense. |
Thanks again Edward. I suspected that was the case. And yes, MUCH easier  |
|
Back to top |
|
 |
|