I have a plugin in C++ that starts an external process.
This process has UI and his event loop.
That event loop runs in external code so that I cant use the regular dialogproc to capture WM_KEYDOWN events.
After start we have mainly one direction comunication. plugin UI -> Photoshop
the plugin implements functions that the external process can use to talk to photoshop as well.
The photoshop UI works fine, anything happening there will not affect the plugin UI.
I thought that was the difficult part of the implementation but... I found no way to disable hotkeys in photoshop.
I know when to disable them because I am getting events in my plugin UI for it... but no idea which command should I use to prevent photoshop from getting the plugin Ui events as hotkeys.
Is something I can do in "AutoPluginMain" ?
I hope I could explain myself properly.
I found different approaches but nothing worked completely so far: I tried using windows api calls, postmessage calls to deactivate the window, replacing eventloops, PICA...
I found nothing in the documentation which is mostly outdated... I am starting to think the photoshop sdk is not supported.
Seriously no one knows how to disable hotkeys in photoshop?
If your plugin is running as a separate process it should not be getting any events meant for Photoshop if your plugin process is active.
If you're spinning an event loop in your Photoshop side of things, only process UI update events - ignore any other events such as input events.
Thanks a lot for the answer Shmoopie99,
"If your plugin is running as a separate process it should not be getting any events meant for Photoshop if your plugin process is active."
Yes that is almost correct. I dont want to get into useless details but I have no problems there and events meant for Photoshop dont disturb me.
"If you're spinning an event loop in your Photoshop side of things, only process UI update events - ignore any other events such as input events."
I cant ignore input events because I need them. The problem is not my tool getting input events from Photoshop, is Photoshop the one geting events comming to me.
The only connection to Photoshop I keep in my process is that is parented to photoshop using the HWND handler.
I must insist in the question then... How to make Photoshop wait while my window is in focus? How to disable accelerators?
I also use an external process for my Photoshop plugins but I don't keep any kind of connection with Photoshop. When I launch my process I save the full Photoshop image to a RAW temp file and send other attributes on the command-line. In my external process I overwrite the image and when it exits, back in Photoshop, the PS-side of things reads the image back in from the RAW file and sends them as tiles back to PS.
This simplifies everything immensely, and there are no collisions at all with PS - it essentially "goes to sleep" while my UI is up.
What you call "goes to sleep" can be achieved as well with modal dialogs, progress bars or anything else...
For the case you explain, you may not need anything else than a callback to know when you have the result ready.
My case is different, as I explained, my system works but the only problem is that I cant type any text because it comes intro Photoshop as hotkeys as well.
The way I see it, I only need to disable accelerators in photoshop while I type in my tool, that simple.The windows API, wxwidgets, qt... have those commands but , as said,... I cant make it work inside Photoshop.
If I need to try hacks I could probably start a second event loop, replace the photoshop event loop or whatever... but that is the dark side of force somehow...
Anyways any idea that helps will make me very thankful !
Run a persistent automation plugin
Install a winows hook on keyboard events on startup (and don't forget to uninstall on shutdown...)
On any even check whether the window in focus is the one that belongs to your plugin
If it is, eat the event; otherwise pass it forward to PS.
This is the dark side of the force however apparently you are trying to have a semi-modal GUI in PS which is explicitly unsupported (outside of the Flex panel framework), so don't expect out-of-the-box Jedi solutions here
Basically there is no way to disable accelerators then.... this is lame.
"semi-modal window" because I want to be able to type in text in a non-modal window... this is lame.
I found too many of those problems on my way. But I see that I will need to continue with this "lamish" way of doing things in Photoshop. I understand why almost everyone over here dont wanted to work with it... live and learn.
From now on I will not advice this software any more.
Thanks a lot to you anyways.
I will try that tomorrow morning.
Well, you can simply have a Flex panel floating around (check the Extension bullder SDK), with text input, buttons, lists and whatever else Flex lets you do, talking to your extental app to your heart's content. No problems with Photoshop shortcuts, no "dark force" and what not.
The thing with PS API is that its indeed dated and quite limitied in terms of what you can and cannot do, however if you do know its capabilities there is a lot you can achieve. There is a need for hackery if you want to overcome these limitations, however from the description of the problem, you may be able to get away without resorting to it by using the right approach.
Sure there are different posibilities.
You just need to squeeze between them, taking from here and hack there to make it work...
Well sorry If looks like I am just complaining now.. sure Photoshop has top performance and some of the best algorithms for images out there but I thought version CS6 was a big update. Adobe changed the UI and improved GPU, multithreading and what not... I was not expecting what I found.
My colleagues suggest another software and since I will continue developing tools here I may give it a try at some point.
As said, thanks a lot.