2016-06-17 7 views
1

ベクトルシェイプの色を変更するコードに問題があります。ベクトル形状の色を変更する - フォトショップ

これは1つのレイヤーでのみ機能し、さらにレイヤーを選択するとエラーが発生します。誰もそれを修正する方法を知っていますか?

#target photoshop 
cTID = function(s) { return app.charIDToTypeID(s); }; 
sTID = function(s) { return app.stringIDToTypeID(s); }; 

function Action3() { 

    function step1(enabled, withDialog) { 
    if (enabled != undefined && !enabled) 
     return; 
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO); 
    var desc1 = new ActionDescriptor(); 
    var ref1 = new ActionReference(); 
    ref1.putEnumerated(sTID("contentLayer"), cTID('Ordn'), cTID('Trgt')); 
    desc1.putReference(cTID('null'), ref1); 
    var desc2 = new ActionDescriptor(); 
    var desc3 = new ActionDescriptor(); 
    var desc4 = new ActionDescriptor(); 
    desc4.putDouble(cTID('Rd '), 243); 
    desc4.putDouble(cTID('Grn '), 110); 
    desc4.putDouble(cTID('Bl '), 93); 
    desc3.putObject(cTID('Clr '), sTID("RGBColor"), desc4); 
    desc2.putObject(cTID('FlCn'), sTID("solidColorLayer"), desc3); 
    var desc5 = new ActionDescriptor(); 
    desc5.putInteger(sTID("strokeStyleVersion"), 2); 
    desc5.putBoolean(sTID("fillEnabled"), true); 
    desc2.putObject(sTID("strokeStyle"), sTID("strokeStyle"), desc5); 
    desc1.putObject(cTID('T '), sTID("shapeStyle"), desc2); 
    executeAction(cTID('setd'), desc1, dialogMode); 

    }; 

    step1();  // Set 
}; 

Action3.main = function() { Action3();};Action3.main(); 

答えて

0

あなたは層を形成していないすべてのレイヤーの選択を解除する必要があります。または、レイヤーを1つずつ変更します。 (これは、CCライブラリが色を変えるときに非常に遅い理由です)。複数のシェイプレイヤーを持っていれば、あなたのコードは私のために機能しますが、選択したレイヤーはすべてシェイプでなければなりません。とにかくPhotoshopにバグがあり、レイヤーからストロークがない場合は、選択したすべてのレイヤーからストロークオプションを削除できます。

関連する問題