Programmatically open Gradient Editor

It’s possible to open up the color-picker dialog via batchplay, but is there also a similar command to show the Gradient Editor? I haven’t found one yet.

Would be cool to let users pick a gradient via a plugin panel and I’m not really interested in rebuilding a gradient editor :smile:

Another note: One workaround could be to just read out the active gradient from the currentToolOptions, however the user would still have to open the Gradient Editor by himself.

That is an interesting feature request. When you change display dialog parameter for something with gradient then nothing happens? Not even for gradient map?

Interesting! Gradient Editor isn’t available from PS menu, and therefore couldn’t probably be trigged by a previously recorded .atn or a script for that matter.
However, accessing the gradient menu (where users pick gradients from their collection) is quite easy. I’ve tested and used that call, it’s working ok. There are at least 2 ways to open the gradient pickup menu.
Still haven’t found a way to programmatically open a PS-sub-menu item… Will be quite happy if that was possible indeed !

But which event class should I give the descriptor in the first place? I know I could set the gradient of a gradient (/gradientMap) adjustment layer, but wouldn’t I need to create one first of all?

Got it, but that’s just the gradient panel I assume. What I need is some call that returns a complete gradient descriptor, just like the color picker returns a color descriptor.

Which specific two do you mean? I know that you can trigger it in the UI from various places, such as the gradient tool bar, adjustment layer, layer effects etc.

Right now I see the following two possibilites:

  1. Allow the user to pick a few colors (2 or 3 maybe) and maybe a direction, to then create a gradient descriptor based on that on my own. Kind of like a very very basic gradient editor…

  2. Upon button click, show the user a message asking him to confirm or change the gradient from the tool bar. Then switch the active tool and listen for modalStateChanged including "exit" and "Gradient Editor". After the event fires you could read out the gradient from the currentToolOptions.

Yes it would make layer. But perhaps you could set visible to false and remove it once you are done

I guess that would work, I’ll give it a try at the weekend