Skip to main content
joshjvfx
Participant
March 23, 2024
Question

Scripting Question: Is it possible to Add an effect to a layer but Hide it's control properties?

  • March 23, 2024
  • 2 replies
  • 753 views

In this simple script, I'm adding a Gaussian blur to a layer with a value of 1. But my question is, can you add an effect to a layer but hide the effect controls via scripting? Eventually, I would map the controls to a custom slider or UI, but before I got that deep into things, I was curious if it's even possible to hide effect(s) in the Effects Control Panel. 

 

Here's the simple code that I have:

 

// Apply Gaussian Blur effect with a value of 1 to selected layers

// Get the active composition
var comp = app.project.activeItem;

// Check if the active item is a composition
if (comp instanceof CompItem) {
// Get the selected layers
var selectedLayers = comp.selectedLayers;

// Loop through the selected layers
for (var i = 0; i < selectedLayers.length; i++) {
var layer = selectedLayers[i];

// Create a new Gaussian Blur effect
var gaussianBlur = layer.Effects.addProperty("ADBE Gaussian Blur 2");

// Set the blurriness value to 1
gaussianBlur.property("Blurriness").setValue(1);
}
} else {
alert("Please select a composition.");
}

 

Thank you!

This topic has been closed for replies.

2 replies

ConstantinMaier
Inspiring
March 23, 2024

I guess what you could do is select nothing but the effect and simulate a left arrow keystroke. This will collapse the effect (but the action will be visible to the user as it's happening in realtime). Here's how you can simulate a keystroke: https://community.adobe.com/t5/after-effects-discussions/save-an-animation-preset-with-a-script-and-then-customize-the-file-explorer-it-opened/m-p/12589239#M188663

joshjvfx
joshjvfxAuthor
Participant
March 24, 2024

Thank you! I will check that out.

Dan Ebberts
Community Expert
Community Expert
March 23, 2024

I'm not aware of any way to do that.

joshjvfx
joshjvfxAuthor
Participant
March 23, 2024

Thanks for the reply, Dan. I am a big fan of your work! 

 

I guess mapping the controls to custom sliders via a script is the way to go. I'm working toward building a small suite of tools that I use all the time in comp. 

-Josh Johnson

Dan Ebberts
Community Expert
Community Expert
March 23, 2024

I don't know if it's of any use to you, but I believe that some of the pseudo effect controls have an "invisible" attribute that you can use to hide the controls.