Help needed in perfecting this Transition Properties script?

Steve_Rhoden wrote on 6/27/2024, 4:31 PM

Wanting to create a script, that after selecting/highlighting a crossfade, i then select the script that opens up the transition properties..... Tried creating this one myself but it's throwing errors, Would appreciate any assistance in getting it working properly:

 

using ScriptPortal.Vegas;

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        // Loop through all video events on the timeline
        foreach (Track track in vegas.Project.Tracks)
        {
            if (track.IsVideo())
            {
                foreach (TrackEvent trackEvent in track.Events)
                {
                    VideoEvent videoEvent = (VideoEvent)trackEvent;
                    
                    // Check if the event is a transition
                    if (videoEvent.IsTransition)
                    {
                        Transition transition = videoEvent.Transition;
                        
                        // Modify transition properties example:
                        transition.FadeOutLength = Timecode.FromMilliseconds(500); // Set fade out length
                        transition.FadeInLength = Timecode.FromMilliseconds(500);  // Set fade in length
                        transition.Alignment = 0.5; // Set alignment
                        
                        // You can set other properties like easing, opacity, etc.
                    }
                }
            }
        }
    }
}
 

 

Comments

jetdv wrote on 6/27/2024, 5:27 PM

I can see several issues here...

  1. Is the transition on the left event fade out?
  2. Or is the transition on the right event fade in?
  3. Or could there be a different transition on each?
  4. Then you can't access a transition like an event. You have to find the event under the cursor, then look at the proper fadein or fadeout and get the transition from there. If it's an overlap, you'll want the "fadein" on the "right" event.

I don't think what you're looking to do is nearly as easy (or practical) as you think it will be. On a quick test right now, I just overlapped two events. So now the left event has a fadeout and the right event has a fadein - both of which are the same length! Now drag a transition over the overlap and it gets applied. Move one of the events to a different track and the fadein/out goes away. Make a fadeout and fadein again on those two events and you will see that the left event "fadeout" is simply a "fadeout". The right event "fadein" actually shows the transition.

Technically, you can have TWO transitions on a single crossfade...

But if you move them both back to the same track, the "right" one wins!