0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ae レイヤーに特定のエフェクトが適用されているか調べる

Last updated at Posted at 2020-09-26

今リリックビデオ作成中でそこで使ったものをここに記す

レイヤーにエフェクトが適用されてるか調べて、適用されている場合は値の変更のみ。そうじゃない場合はエフェクトを適用


app.beginUndoGroup("3Dメガネ");
var myComp = app.project.activeItem;
var selLay = myComp.selectedLayers;
for (var i = 0 ;  i <selLay.length; i++ ){
    var myLay = selLay[i];
    var numProp = myLay.property("ADBE Effect Parade");
    var flag;
    var effectsIndex = 1;
    //$.writeln(numProp.numProperties)
    if (numProp.numProperties > 0){
        var n = 1;
        while ( n <= numProp.numProperties){
            var mn = numProp.property(n).matchName;//マッチネーム
            $.writeln(""+mn);
            if ( mn == "ADBE 3D Glasses2" ){
                flag = true;
                effectsIndex = n;
                break;
            }else{
                flag = false;
            }
            n++;
        }
    }
    if (flag == true){
        change3Dglass(numProp.property(effectsIndex),myLay.index);
    }else{
        add3Dglass(myLay,myLay.index)
    }
}

app.endUndoGroup();


function add3Dglass(layer,index){
       var myEffects = layer.Effects.addProperty("ADBE 3D Glasses2");
       myEffects.property("ADBE 3D Glasses2-0001").setValue(index);
       myEffects.property("ADBE 3D Glasses2-0002").setValue(index);
       myEffects.property("ADBE 3D Glasses2-0003").setValue(1);
       myEffects.property("ADBE 3D Glasses2-0007").setValue(2);
       myEffects.property("ADBE 3D Glasses2-0005").setValue(12);
}

function change3Dglass(prop,index){
       prop.property("ADBE 3D Glasses2-0001").setValue(index);
       prop.property("ADBE 3D Glasses2-0002").setValue(index);
       prop.property("ADBE 3D Glasses2-0003").setValue(1);
       prop.property("ADBE 3D Glasses2-0007").setValue(2);
       prop.property("ADBE 3D Glasses2-0005").setValue(12);
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?