Determine whether a particular plugin is present in the chain

Jack S wrote on 2/18/2023, 8:24 AM

@jetdv Hi Edward. Your thoughts on this please.

I'm trying to determine whether a particular plugin is present in an event's plugin chain.
According to the API, the function VideoEvent.Effects.Contains(PlugInNode) should return a boolean indicating
whether PlugInNode is present in the chain. I can't get this to work. The bit of code I'm using is this:-

bool AlreadyApplied = True;
Effect effect = new Effect(plugin); //plugin is class PlugInNode obtained earlier in the script
AlreadyApplied = VideoEvent.Effects.Contains(effect);

This doesn't seem to return the result I expect. Am I missing something?

Thanks in advance.

My system
Dell XPS 8700 (I know, it's a little outdated, but it handles VP20 quite well)
Windows 10 Home (x64)
3.1 GHz Intel Core i5-4440
16GB RAM
NVIDIA GeForce GTX 1050 Ti display adapter
System drive Samsung SSD 850 EVO 250GB

Camcorder
SONY Handycam HDR-XR550VE

Comments

jetdv wrote on 2/18/2023, 8:37 AM

I would probably just go through the events and see if the one I'm looking for is there:
 

            string effID = "{Svfx:com.vegascreativesoftware:hsladjust}";
//in your case:
effID = plugin.UniqueID;

            VideoEvent vEvnt = (VideoEvent)myVegas.Project.Tracks[0].Events[0];

            bool found = false;
            foreach(Effect effect in vEvnt.Effects)
            {
                if (effect.PlugIn.UniqueID == effID)
                {
                    found = true;
                    break;
                }
            }

            if (found)
            {
                MessageBox.Show("Effect was found");
            }

I agree it appears what you're doing should work unless it has to be an "exact" match - i.e. do all effect settings have to match? I'm sure this routine would work, though.

Jack S wrote on 2/18/2023, 8:48 AM

I've integrated a batch video stabilisation script into my custom command. I've managed to determine where in the plugin chain it is so that I can apply the analysis and complete the process. That works fine. The problem is, I want to test for the stabilisation plugin being already present in the chain. If it is, I will assume that this has already been applied and will bypass this event.
Your code should do the trick. I'll incorporate it into my code block and let you know.
Thanks.

My system
Dell XPS 8700 (I know, it's a little outdated, but it handles VP20 quite well)
Windows 10 Home (x64)
3.1 GHz Intel Core i5-4440
16GB RAM
NVIDIA GeForce GTX 1050 Ti display adapter
System drive Samsung SSD 850 EVO 250GB

Camcorder
SONY Handycam HDR-XR550VE

Jack S wrote on 2/18/2023, 9:57 AM

With a bit of modification to suit my code block, this has done the trick. I'm going to test it thoroughly using different combinations, but it's looking good at the moment. Thanks Edward.

My system
Dell XPS 8700 (I know, it's a little outdated, but it handles VP20 quite well)
Windows 10 Home (x64)
3.1 GHz Intel Core i5-4440
16GB RAM
NVIDIA GeForce GTX 1050 Ti display adapter
System drive Samsung SSD 850 EVO 250GB

Camcorder
SONY Handycam HDR-XR550VE

jetdv wrote on 2/18/2023, 12:38 PM

😁