applyPreset() multiple times on the same layer?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
nirina.chris
Posts: 1
Joined: May 18th, 2022, 2:33 pm

Hello everyone!

I've been stucked for 2 days on script I'm writting :mrgreen:

My objective is to apply a preset multiple times on properties of a layer (because there will be expressions with it in a separated function.)
When I select 2+ properties in Transform (Position, Rotation...) the preset is loaded 2+ number of times. Perfect.
But when I select 2+ properties, let's say inside an Effect on the same layer (Inside Color, Outside Color...) the preset is loaded only one time.
I would like it to load as many times as selected properties regardless if it's in Transform or Effect.

I tried many solutions with arrays, for loop but can't find a solution... what do I miss?
Many thanks in advance!!

Code: Select all

function applyPreset(){
        var comp = app.project.activeItem; 
        var layers = comp.selectedLayers;
        var presetPath = cheminDuDossierAssets+"myPreset.ffx";
        var myPreset = File(presetPath);
        layers[0].applyPreset(myPreset);
        }
Post Reply