Set Brush Options problem

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: xbytor, DavideBarranca, Paul MR
Posts: 2
Joined: Sun Jan 08, 2017 6:29 pm

Set Brush Options problem

Postby » Mon Jan 09, 2017 6:33 pm

I have some code from Tom Ruark that sets brush options like Opacity, Flow etc. The code works well ... EXCEPT that it always sets Shape Dynamics, Scattering and Smoothing to On. I've checked out the code as well as I can and I can see no problems with it. I have absolutely NO idea how to correct this issue as I can't find any documentation that is of use (description of the ActionDescriptor and ActionReference objects in particular).

This is the code:

function setBrushOptions(tool,mode,opacity,flow,pfo,eab,pfs){
var idset = stringIDToTypeID( "set" );
var desc226 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref170 = new ActionReference();
var idPbTl = stringIDToTypeID(tool);
ref170.putClass( idPbTl );
desc226.putReference( idnull, ref170 );
var id12 = stringIDToTypeID( "to" );
var desc5 = new ActionDescriptor();
// opacity
var id13 = stringIDToTypeID( "opacity" );
var id14 = stringIDToTypeID( "percentUnit" );
desc5.putUnitDouble( id13, id14, opacity);
// blend mode
var id15 = stringIDToTypeID( "mode" );
var id16 = stringIDToTypeID( "blendModel" );
var id17 = stringIDToTypeID( mode);
desc5.putEnumerated( id15, id16, id17 );
// flow
var id19 = stringIDToTypeID( "flow" );
desc5.putUnitDouble( id19, id14, flow );
// pressure for opacity
desc5.putBoolean( stringIDToTypeID( "usePressureOverridesOpacity" ), pfo );
// pressure for size
desc5.putBoolean( stringIDToTypeID( "usePressureOverridesSize" ), pfs );
// enable air brush
desc5.putBoolean( stringIDToTypeID( "repeat" ), eab );
var id18 = stringIDToTypeID( "null" );
desc226.putObject( id12, id18, desc5 );
executeAction( idset, desc226, DialogModes.NO );


I would really appreciate some help as being able to change the brush options (without affecting the Shape Dynamics, Scattering etc) is really critical to my project.



Return to “Help Me”

Who is online

Users browsing this forum: No registered users and 1 guest