[AE]　3Dメガネを適用する時にいちいちプロパティの変更するの面倒いから

#エフェクトの3Dメガネの追加

簡単な色収差感を出す時によく使うんだけど、毎回レフトビュー・ライトビュー・3Dビューとバランスのパラメーターをいじるの面倒なのでここに置いておく。


```jsx

/*
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");
    //$.writeln(numProp.numProperties)
    if (numProp.numProperties > 0){
        for (var j= 1 ;  j <numProp.numProperties+1; j++ ){
        var mn = numProp.property(j).matchName;//マッチネーム
            if (　mn　== "ADBE 3D Glasses2" ){
                var  myProp = numProp.property(j);
                change3Dglass(myProp,myLay.index)
            }else{
                add3Dglass(myLay,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);
}
*/

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);
}
```