// 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';