Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change property of the effect Set Matte2 by scripting

  • Change property of the effect Set Matte2 by scripting

    Posted by Baptiste Rieu on March 7, 2017 at 7:00 pm

    Hi everyone, I just need a little help.

    On my script, I create a text then i want to hide it.

    So i put the Set Matte Effect, but i don’t know how to change the properties.

    Her is my code :

    cache =MyComp.property(“Effects”).addProperty(“ADBE Set Matte2”);
    MyComp.property(“Effects”).property(“ADBE Set Matte2”)(“Invert Matte”).setValue(1);

    Thanks a lot, and sorry for my english !

    cache =MyComp.property("Effects").addProperty("ADBE Set Matte2");
    MyComp.property("Effects").property("ADBE Set Matte2")("Invert Matte").setValue(1);

    Baptiste Rieu replied 9 years, 3 months ago 2 Members · 4 Replies
  • 4 Replies
  • Xavier Gomez

    March 9, 2017 at 9:47 am

    What you have tried works for me, and so do any of these:

    var cache = myLayer.effect.addProperty(“ADBE Set Matte2”);

    cache.property(“Invert Matte”).setValue(1);
    cache.property(3).setValue(1);
    cache.property(“ADBE Set Matte2-0003”).setValue(1);

    you can access the matchName of a property like this:
    cache.property(1).matchName; // gives “ADBE Set Matte2-0001”

    Xavier

  • Baptiste Rieu

    March 9, 2017 at 1:14 pm

    Thank you very much, i didn’t knew this method.

    A second question if it’ not too much ????

    If I want to change the layer used for the matte (2nd property). I tried with giving the layer index put it didn’t work. Should it have ?

  • Xavier Gomez

    March 9, 2017 at 1:59 pm

    Normally it should work. Maybe check your syntax.
    I just tried and it worked for me:

    var comp = app.project.activeItem;
    var mattefx = comp.layer(1).effect(1);
    var matteLayer = comp.layer(“Matte”);
    fx(1).setValue(matteLayer.index);

    (setting a value of 0 will set the matte to “None”).

    Xavier

  • Baptiste Rieu

    March 9, 2017 at 2:03 pm

    Perfect ! Thank you again !

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy