【问题标题】:change colors in vector shapes - photoshop更改矢量形状的颜色 - Photoshop
【发布时间】:2016-10-19 19:38:22
【问题描述】:

我的代码有问题,它会改变矢量形状的颜色。

它仅适用于一层,如果您选择更多层,它会弹出错误。有人知道怎么解决吗?

#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();

【问题讨论】:

    标签: javascript photoshop jsx


    【解决方案1】:

    您应该取消选择所有不是形状图层的图层。或者一层一层的换层。 (这就是为什么在更改颜色时 CC 库如此缓慢的原因)。如果我有多个形状图层,您的代码对我有用,但所有选定的图层都必须是形状,没有别的。无论如何,Photoshop中有一个错误,如果图层中的一个没有笔触,它可以从所有选定的图层中删除您的笔触选项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-14
      • 2017-04-08
      • 2019-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-30
      • 1970-01-01
      相关资源
      最近更新 更多