Hi,
I’m currently trying to make a small extension for photoshop which is basically a really barebones brush palette / favourites panel.
I’m using UXP and the idea behind it is as follows:
- Get the current active brush preset’s descriptors / identifiers and add that to storage
- Add a new panel button for that brush preset
- Set the active brush preset to whichever stored brush preset I click on
Right now I’ve got nearly all of that working, but I have one issue:
{
_obj: "get",
_target: [
{ _property: "currentToolOptions" },
{ _ref: "application", _enum: "ordinal", _value: "targetEnum" }
],
_options: { dialogOptions: "dontDisplay" }
}
This snippet works, so I can get the currently active brush preset info but the name it supplies is a different name to what I need when I come to reselect it with the brush.
The brush names supplied by currentToolOptions are often duplicates and not at all accurate, I don’t even know where they’re coming from to be honest.
To select a brush through UXP I think you need the name of said brush as it is in the “presetManager”, but as far as I know there’s no way of getting the active brush preset name with “presetManager” as the object target. (Getting presetManager.brush returns a list of every brush I own).
Some extra information about other things I’ve been looking at / thinking about exploring:
This is the output when I use alchemist to listen to when I simply select different brushes the normal way on default photoshop, the _name here is the actual name of the brush as it is in preset manager, this is exactly the data I need - but just don’t know how to get / use it.
{
_obj: "select",
_target: [
{
_ref: "brush",
_name: "Clean Sketch"
}
],
_isCommand: false,
_options: {
dialogOptions: "dontDisplay"
}
}
Here is a console.log of the outputted brush name that I’m getting from the exact same brush using the ‘get’ code I supplied at the top and pressing select on the created brush button:
So Photoshop is giving me the accurate name “Sketch Square”, and the ‘get’ is giving me: “Sketch Round” which is obviously unusable when it comes to using that as a descriptor and the only way I can get the reselecting function to work is by manually writing out the “presetManager” name into the (set “_name”: “Sketch Square”).
I was just wondering if there’s something I’m missing or a workaround that anyone uses, any advice / help would be great, thanks.
(p.s I apologise in advance if the answer to this is super simple. This is my first time using js or even making an extension at all) ![]()
