Increment Opacity and Flow
I'm trying to make a script to increment Opacity and Flow. I jumbled together the script fromRe: Is it possible to script brush opacity? and Re: brush opacity for scripting
Opacity Increment:
Flow Increment:
- function SetPaintBrush(flow) {
- var idset = stringIDToTypeID( "set" );
- var desc226 = new ActionDescriptor();
- var idnull = stringIDToTypeID( "null" );
- var ref170 = new ActionReference();
- var idPbTl = stringIDToTypeID( "paintbrushTool" );
- ref170.putClass( idPbTl );
- desc226.putReference( idnull, ref170 );
- var id12 = stringIDToTypeID( "to" );
- var desc5 = new ActionDescriptor();
- // flow
- var id14 = stringIDToTypeID( "percentUnit" );
- var id19 = stringIDToTypeID( "flow" );
- desc5.putUnitDouble( id19, id14, flow );
- var id18 = stringIDToTypeID( "null" );
- desc226.putObject( id12, id18, desc5 );
- executeAction( idset, desc226, DialogModes.NO );
- }
- function BrushOpacityGet()
- {
- var ref = new ActionReference();
- ref.putEnumerated(charIDToTypeID("capp"),
- charIDToTypeID("Ordn"),
- charIDToTypeID("Trgt")
- );
- var AD = executeActionGet(ref);
- AD = AD.getObjectValue(stringIDToTypeID("currentToolOptions"));
- return(AD.getInteger(stringIDToTypeID("flow")));
- }
- flow = BrushOpacityGet();
- var flo = flow+5;
- SetPaintBrush(flo);
It almost works, but there's two major issues on the script
1. It turns on Shape Dynamics and Scattering and turns off any other parameters (Transfer, Dual Brush, etc.)
2. The script is pretty slow the first time it runs
Anyone know what is causing this, and how to fix it?
Any help will be appreciated!
