📝⚙️ (Script) Enable alpha channel. @jetdv HELP ME!

Comments

jetdv wrote on 11/6/2023, 6:33 PM

@Steve_Rhoden, @m3lquixd - rotating alpha channel

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 RulerFormat OrgRulerFormat;

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

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (TrackEvent evnt in myTrack.Events)
                    {
                        if (evnt.Selected)
                        {
                            VideoEvent vEvent = (VideoEvent)evnt;
                            VideoStream vs = (VideoStream)vEvent.ActiveTake.Media.Streams.GetItemByMediaType(MediaType.Video, vEvent.ActiveTake.StreamIndex);

                            VideoAlphaType alpha = vs.AlphaChannel;
                            if (alpha == VideoAlphaType.None)
                                vs.AlphaChannel = VideoAlphaType.Premultiplied;
                            else if (alpha == VideoAlphaType.Premultiplied)
                                vs.AlphaChannel = VideoAlphaType.PremultipliedDirty;
                            else if (alpha == VideoAlphaType.PremultipliedDirty)
                                vs.AlphaChannel = VideoAlphaType.Straight;
                            else if (alpha == VideoAlphaType.Straight)
                                vs.AlphaChannel = VideoAlphaType.None;
                        }
                    }
                }
            }
        }
    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

 

Steve_Rhoden wrote on 11/6/2023, 7:37 PM

Thanks again Edward for fine tuning this script. Exactly what i was hoping to acheive....

juan_rios wrote on 11/7/2023, 7:43 AM

Oh! Thanks jetdv for the fantastic script and Mr. Rhoden for the clever idea.

Last changed by juan_rios on 11/7/2023, 7:43 AM, changed a total of 1 times.

PC-ESTUDIO1:

- VEGAS Pro 19 B651.

- Windows 11 64 bits - Intel Core i7 10.700K CPU @ 3.80GHz

- Motherboard Rog Strix 8460-H Gaming - RAM 32GB.

- nVidia GeForce GTX 1650 Super.

- Intel UHD Graphics 630.

PC-ESTUDIO2:

-Shotcut.

-Kdenlive.

-Linux Mint 21.2 -Victoria - Intel Core i5 6.400 CPU @ 2.7GHz

-Motherboard Gigabyte H110M-S2PV DD3 - RAM 16GB

-Intel Graphics 530.

LAPTOP:

-HP Victus 16-e

-VEGAS Pro 19 B651

- Windows 11 64 bits - AMD Ryzen 7 5.800H with Radeon Graphics 3.20 GHz

-GeForce RTX 3050 Laptop GPU

-RAM 16 GB.

CAMERAS:

Panasonic FZ300; FZ1000; FZ2000 and HC X1500.

 

 

m3lquixd wrote on 11/7/2023, 9:23 AM

Very good!

About me:
Hi! Melqui Calheiros Here. I've been using Vegas as my only video editor for over 10 years. I edit professionally for various influencers, public bodies and small businesses. My goal is to squeeze Vegas to the fullest! And end the prejudice that software has here in Brazil.

⬇️ Some of my jobs. ⬇️
https://www.vegascreativesoftware.info/us/forum/post-your-vegas-creations--109464/?page=37#ca872169

PC Specs:
Operating System:
    Windows 11 Pro 64-bit
CPU:
    AMD Ryzen 3 3200G 3.60 GHz
RAM:
    16,0GB Dual-Channel DDR4 2666MHz
Motherboard:
    Gigabyte Technology Co. Ltd. A320M-S2H-CF (AM4)
Graphics:
    4095MB NVIDIA GeForce GTX 1650 (ZOTAC International)
Storage:
    465GB Seagate ST500DM002-1BD142 (SATA )
    238GB Lexar 256GB SSD (SATA (SSD))