Brush Rename Event
Hi everyone,
One of the parts of my plugin has to do with responding to brush rename events. I can subscribe to the event and get a callback when the event happens, but I'm at a loss of how to figure out *which* brush was renamed. I am working with Photoshop CC 2014.
Using the script listener when I renamed a brush I get
var idRnm = charIDToTypeID( "Rnm " );
var desc3 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idBrsh = charIDToTypeID( "Brsh" );
ref1.putIndex( idBrsh, 2 );
desc3.putReference( idnull, ref1 );
var idT = charIDToTypeID( "T " );
desc3.putString( idT, """hhjk""" );
executeAction( idRnm, desc3, DialogModes.NO );
I can subscribe to the event by running the following code
var eventFile = new File(app.path + '/Presets/Scripts/Event Scripts Only/BrushRenameEventHandler.jsx');
app.notifiers.add('Rnm ', eventFile, 'Brsh');
And I can handle the event with
try {
var renameClassID = charIDToTypeID('Rnm ');
var brushClassID = charIDToTypeID('Brsh');
var actionDescriptor = arguments[0];
var eventClass = arguments[1];
if( eventClass == renameClassID ) {
var list = actionDescriptor.getList( charIDToTypeID('null') );
if( list.count == 1 ) {
var ref = list.getReference(0);
if( ref.getDesiredClass() == brushClassID ) {
alert( 'Brush renamed' );
// How do we know which brush was renamed?!
}
}
}
} catch( e ) {
alert(e);
}
However, I don't know how to grab which brush was renamed. Looking at the script listener code I should be able to get the index of the brush (2) that was renamed along with the new name (hhjk). Is it possible to get this information from the ActionReference and/or ActionDescriptor
