Brush Size

Photoshop Script Snippets - Note: Full Scripts go in the Photoshop Scripts Forum

Moderators: xbytor, DavideBarranca, Paul MR

ylafont

Brush Size

Postby ylafont » Mon Jul 29, 2013 3:35 am

hope some one can point me in the right direction. i have a working script that select to a pre-defined brush and changes the size of the brush to a certain pixel size. I needed to go one step further to change the opacity and flow of the brush however after searching through the forum i it was suggested to use a tool preset. now when i load the tool preset, my brush size does no adjust accordingly.

I am guessing that the tool preset is loading the the size of the brush as it is defined, which is fine. but i not clear on why i cannot resize the brush via the script after the tools preset has been loaded.

here is that i have... thanks for the assistance.,

function OpacityFlow(){
var desc = new ActionDescriptor();
var ref = new ActionReference();

ref.putName( stringIDToTypeID('toolPreset'), "Ec-Flow" );
desc.putReference( charIDToTypeID('null'), ref );
executeAction( charIDToTypeID('slct'), desc, DialogModes.NO );
}


function Brush () {


// =======================================================
var idslct = charIDToTypeID( "slct" );
var desc104 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref86 = new ActionReference();
var idPbTl = charIDToTypeID( "PbTl" );
ref86.putClass( idPbTl );
desc104.putReference( idnull, ref86 );
executeAction( idslct, desc104, DialogModes.NO );
// =======================================================
var idslct = charIDToTypeID( "slct" );
var desc123 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref105 = new ActionReference();
var idBrsh = charIDToTypeID( "Brsh" );
ref105.putName( idBrsh, "Eclipse Logo" );
desc123.putReference( idnull, ref105 );
executeAction( idslct, desc123, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc105 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref87 = new ActionReference();
var idBrsh = charIDToTypeID( "Brsh" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref87.putEnumerated( idBrsh, idOrdn, idTrgt );
desc105.putReference( idnull, ref87 );
var idT = charIDToTypeID( "T " );
var desc106 = new ActionDescriptor();
var idmasterDiameter = stringIDToTypeID( "masterDiameter" );
var idPxl = charIDToTypeID( "#Pxl" );
desc106.putUnitDouble( idmasterDiameter, idPxl, BrushSize);
var idBrsh = charIDToTypeID( "Brsh" );
desc105.putObject( idT, idBrsh, desc106 );
executeAction( idsetd, desc105, DialogModes.NO );
}

ylafont

Brush Size

Postby ylafont » Mon Jul 29, 2013 10:04 pm

just in case any one is interested.

When using the tools preset within scripts the ability the change the brush size withing the scripts is for some reason being broken. my work around for this was to create multiple tools preset with different brush sizes and call them within the script.

for now it works.


Return to “Photoshop Scripting: Code Snippets”

Who is online

Users browsing this forum: No registered users and 24 guests