select all events that have custom Pan/Crop setting

RedRob-CandlelightProdctns wrote on 8/30/2022, 4:21 PM

You know how an event's Pan/Crop hash turns color when there's any custom pan/crop applied to it?

Is there a script floating around that will select all events that have a custom pan/crop?

Vegas 21.300

My PC (for finishing):

Cyperpower PC Intel Core i7-7700K CPU @ 4.2GHz, 64GB mem @ 2133MHz RAM, AMD Radeon RX470 (4GB dedicated) with driver recommended by Vegas Updater (reports as 30.0.15021.11005 dated 4/28/22), and Intel HD Graphics 630 driver version 31.0.101.2112 dated 7/21/22 w/16GB shared memory. Windows 10 Pro 64bit version 10.0.19045 Build 19045.

My main editing laptop:

Dell G15 Special Edition 5521, Bios 1.12 9/13/22, Windows 11 22H2 (10.0.22621)

12th Gen Intel Core i7-12700H (14 cores, 20 logical processors), 32 GB DDR5 4800MHz RAM, Intel Iris Xe Graphics, NVIDIA GeForce RTX 3070 Ti Laptop GPU w/8GB GDDR6 RAM, Realtek Audio

 

 

Comments

jetdv wrote on 8/30/2022, 4:39 PM

I don't know of one. And there's not a "pan/crop" flag that says it's been changed. I suppose you could take two points and see if the width and height match the video event media width and height and verify the rotation is zero.

jetdv wrote on 8/31/2022, 9:05 AM

@RedRob-CandlelightProdctns, I'll write up a tutorial on this to explain everything but this seems to work. I'll show all the test cases in the tutorial.
 

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (TrackEvent evnt in myTrack.Events)
                    {

                        VideoEvent vevnt = (VideoEvent)evnt;
                        VideoStream vs = (VideoStream)vevnt.ActiveTake.Media.Streams.GetItemByMediaType(MediaType.Video, vevnt.ActiveTake.StreamIndex);
                        int mHeight = vs.Height;
                        int mWidth = vs.Width;

                        VideoMotionKeyframes vKeyframes = vevnt.VideoMotion.Keyframes;
                        int vKFCount = vKeyframes.Count;
                        bool pcChanged = false;
                        foreach (VideoMotionKeyframe vKF in vKeyframes)
                        {
                            float pcwidth = vKF.BottomRight.X - vKF.BottomLeft.X;
                            float pcheight = vKF.BottomRight.Y - vKF.TopRight.Y;

                            if ((pcwidth != mWidth) || (pcheight != mHeight) || (vKF.Rotation != 0.0))
                            {
                                pcChanged = true;
                            }
                        }
                        evnt.Selected = pcChanged;
                    }
                }
            }
        }
    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    //public void FromVegas(Vegas vegas, String scriptFile, XmlDocument scriptSettings, ScriptArgs args)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

 

RedRob-CandlelightProdctns wrote on 8/31/2022, 12:09 PM

Ed -- as always, you're an amazing human being.

Thank You

Possibly could have simplified to see if any events have more than one keyframe on them, but yours is much more precise in what it's looking for, and actually checking to see if those changes occurred.. love it!

Vegas 21.300

My PC (for finishing):

Cyperpower PC Intel Core i7-7700K CPU @ 4.2GHz, 64GB mem @ 2133MHz RAM, AMD Radeon RX470 (4GB dedicated) with driver recommended by Vegas Updater (reports as 30.0.15021.11005 dated 4/28/22), and Intel HD Graphics 630 driver version 31.0.101.2112 dated 7/21/22 w/16GB shared memory. Windows 10 Pro 64bit version 10.0.19045 Build 19045.

My main editing laptop:

Dell G15 Special Edition 5521, Bios 1.12 9/13/22, Windows 11 22H2 (10.0.22621)

12th Gen Intel Core i7-12700H (14 cores, 20 logical processors), 32 GB DDR5 4800MHz RAM, Intel Iris Xe Graphics, NVIDIA GeForce RTX 3070 Ti Laptop GPU w/8GB GDDR6 RAM, Realtek Audio

 

 

jetdv wrote on 8/31/2022, 12:17 PM

@RedRob-CandlelightProdctns I did notice that if it has more than one keyframe and none of the keyframes have been changed, the icon on the event will be lit up but the script will not select it. So change:

if ((pcwidth != mWidth) || (pcheight != mHeight) || (vKF.Rotation != 0.0))

to

if ((pcwidth != mWidth) || (pcheight != mHeight) || (vKF.Rotation != 0.0) || (vKFCount > 1))

 

RedRob-CandlelightProdctns wrote on 8/31/2022, 4:33 PM

Spectacular! No need for a more robust write-up (for me), but if you're so inclined and think it will help others, go for it! :-) :-)

With your script in my back pocket I quickly solved a subsequent problem; I needed to rotate all my media from a camera by -.6 degrees.

Vegasaur has nifty tool to change the rotation on all selected clips, but it only permits whole numbers, not very helpful here. So I used Vegasaur to change the rotation on all my events for this one media to 1 degree, then used the framework of your script (above) to say "for all events with a keyframe of 1 degree rotation, set the rotation to -.6. In the process I realize I had to convert degrees to radians (the API does mention radians) and it worked like a charm!

Last changed by RedRob-CandlelightProdctns on 8/31/2022, 4:35 PM, changed a total of 1 times.

Vegas 21.300

My PC (for finishing):

Cyperpower PC Intel Core i7-7700K CPU @ 4.2GHz, 64GB mem @ 2133MHz RAM, AMD Radeon RX470 (4GB dedicated) with driver recommended by Vegas Updater (reports as 30.0.15021.11005 dated 4/28/22), and Intel HD Graphics 630 driver version 31.0.101.2112 dated 7/21/22 w/16GB shared memory. Windows 10 Pro 64bit version 10.0.19045 Build 19045.

My main editing laptop:

Dell G15 Special Edition 5521, Bios 1.12 9/13/22, Windows 11 22H2 (10.0.22621)

12th Gen Intel Core i7-12700H (14 cores, 20 logical processors), 32 GB DDR5 4800MHz RAM, Intel Iris Xe Graphics, NVIDIA GeForce RTX 3070 Ti Laptop GPU w/8GB GDDR6 RAM, Realtek Audio

 

 

jetdv wrote on 9/1/2022, 8:49 AM

That's great! Another area is changing the audio volume. You have to convert to/from DB.

jetdv wrote on 9/19/2022, 8:45 AM

@RedRob-CandlelightProdctns, this tutorial just went live this morning!