【photoshop Action Manager】动作管理器- 设置属性(笔刷模式、不透明度、流量等)

 

// Version: 2016.9.15

// Set the options for the paint brush tool
// blend modes, opacity, flow and others

if (documents.length == 0) {
    var d = documents.add();
} else {
    var d = activeDocument;
}

// two layers so behind and clear are available
if (d.layers.length == 1) {
    d.artLayers.add(); 
}


// Select the paint brush tool
var d = new ActionDescriptor()
var r = new ActionReference();
r.putClass( stringIDToTypeID( "paintbrushTool" ) );
d.putReference( stringIDToTypeID( "null" ), r );
executeAction(  stringIDToTypeID( "select" ), d, DialogModes.NO );

// 29 blend modes for paint brush in CC 2015.5
var bmsS = ["normal", "dissolve", "behind", "clearEnum",
            "darken", "multiply", "colorBurn", "linearBurn", "darkerColor",
            "lighten", "screen", "colorDodge", "linearDodge", "lighterColor",
            "overlay", "softLight", "hardLight", "vividLight", "linearLight", "pinLight", "hardMix",
            "difference", "exclusion", "blendSubtraction", "blendDivide",
            "hue", "saturation", "color", "luminosity",  ]; 

var bi = 0; // blend mode index

var pfo = true;  // pressure overrides opacity
var eab = false; // enable air brush
var pfs = true;  // pressure overrides size

var refreshScreen = true;

for (var i = 1; i <= 100; i++) {
	 
	var d = new ActionDescriptor(); 
	var r = new ActionReference();
   
    r.putClass( stringIDToTypeID( "paintbrushTool" ) );
    d.putReference(  stringIDToTypeID( "null" ), r );
   
    var d1 = new ActionDescriptor();
    // opacity
    var id13 = stringIDToTypeID( "opacity" );
    var id14 = stringIDToTypeID( "percentUnit" );
     d1.putUnitDouble(  stringIDToTypeID( "opacity" ), stringIDToTypeID( "percentUnit" ), i );
    // blend mode
     
    bi++;
    if (bi >= bmsS.length)
        bi = 0;
     d1.putEnumerated(  stringIDToTypeID( "mode" ),stringIDToTypeID( "blendModel" ),  stringIDToTypeID( bmsS[bi] ));
    // flow
     d1.putUnitDouble(  stringIDToTypeID( "flow" ),  stringIDToTypeID( "percentUnit" ), 100 - i );
    // pressure for opacity
     d1.putBoolean( stringIDToTypeID( "usePressureOverridesOpacity" ), pfo );
    pfo = ! pfo;
    // pressure for size
     d1.putBoolean( stringIDToTypeID( "usePressureOverridesSize" ), pfs );
    pfs = ! pfs;
    // enable air brush
     d1.putBoolean( stringIDToTypeID( "repeat" ), eab );
    eab = ! eab;
   
    d.putObject( stringIDToTypeID( "to" ),  stringIDToTypeID( "null" ),  d1 );
	executeAction( stringIDToTypeID( "set" ), d, DialogModes.NO );
    if (refreshScreen)
        app.refresh(); // slow it down so you can see it, VERY SLOW!!
	}

'DONE';
 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值