Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can we apply pseudo effect directly from a script

Explorer ,
Jul 14, 2023 Jul 14, 2023

I have a pseudo-effect XML

<Effect matchname="Pseudo/test6565" name="$$$/AE/Preset/test6565=test">
<Slider name="$$$/AE/Preset/Width2=Width" default="100" valid_min="0" valid_max="1000000" slider_min="0" slider_max="200" precision="1" DISPLAY_PERCENT="true" />
<Slider name="$$$/AE/Preset/Height2=Height" default="100" valid_min="0" valid_max="1000000" slider_min="0" slider_max="200" precision="1" DISPLAY_PERCENT="true" />
<Slider name="$$$/AE/Preset/OffsetX2=Offset X" default="0" valid_min="-1000000" valid_max="1000000" slider_min="-200" slider_max="200" precision="2" />
<Slider name="$$$/AE/Preset/OffsetY2=Offset Y" default="0" valid_min="-1000000" valid_max="1000000" slider_min="-200" slider_max="200" precision="2" />
</Effect>

Is there a way I can apply a pseudo effect using a script rather than editing the XML file

TOPICS
Expressions , How to , Scripting
640
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 14, 2023 Jul 14, 2023

The way I do it is to edit the XML file, restart AE, create a comp and a layer, apply the pseudo effect by script, and then save the effect off as a preset. Now you can apply the preset with a script, without need the for the modified XML file to be present on that system.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 15, 2023 Jul 15, 2023

I tried it but whenever I apply the saved preset the pseudo effect doesn't have a name in this example the effect name "test" is not shown. There's just a nameless effect applied with all the sliders working fine. This disables the expressions.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 15, 2023 Jul 15, 2023

I just tried it with the xml code from your first post. Once I added it to PresetEffects.xml and restarted AE, I used this to apply it to Layer 1 in a new comp:

var myLayer = app.project.activeItem.layer(1);
myLayer.property("Effects").addProperty("Pseudo/test6565");

Then, selecting just the effect in the timeline, I save it as a preset named "test.ffx" in the "test" folder on my C drive. Then, starting again with a new comp with a single layer, I ran this:

var myComp = app.project.activeItem;
for (var i = 1; i <= myComp.numLayer; i++){
	myComp.layer(i).selected = false;
}
var myLayer = app.project.activeItem.layer(1);
myLayer.selected = true;
var myPreset = File("c:/test/test.ffx");
myLayer.applyPreset(myPreset);

which applied your effect, named "test" to the layer. Seems to work fine.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 15, 2023 Jul 15, 2023
LATEST

It worked the reason why the name issue was the because I forgot to add "Pseudo/" in the matchname. Thank you for the help

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines