Best practice for intercommunication between C++ plugins and CEP extensions?
Hello.
After much searching around the web, C++ SDK files, and documentation, I can only conclude that there doesn't seem to be any officially endorsed methods by Adobe for supporting listener/event-based communication between C++ plugins and CEP extensions (or even between C++ and ExtendScript for that matter).
For CEP <-> ExtendScript, this is a solved problem using CSXS Events / PlugPlug.
However, for:
- C++ <-> CEP
- C++ <-> ExtendScript
There is no native listener/event intercommunication system; at least, nothing in the SDK or any developer forums online seems to suggest so. From what I can gather, there appear to be at least four possible, but not ideal, options on the table:
- Grafting the Adobe Illustrator SDK code for the PlugPlug library into After Effects (Ref 1, Ref 2). This seems inconclusive / vaguely plausible at best, and a wild goose chase at worst. This seems like it could work on paper, but it reads like a hacky solution to try and amalgamate code from another SDK. No one has concluded (at least in public forums) that this is viable.
- Using files - it is straightforward to have a CEP Extension / ExtendScript write to a file which we then instruct the C++ to look at (Ref 1). This is verified to be possible, but seems horrendously inefficient, given that we would need to introduce I/O operations and latency for something as fundamental as inter-code communication.
- Websockets - As CEP Extensions use Node.js, which is literally a server, we could, in theory, communicate bidirectionally by having a server running in the C++ plugin. This seems like a solid way to support listening/events between the two, but I would be concerned about the potential computational cost/implementation, given I have limited knowledge in this area. This is likely my first option to research without an official option.
- Using AEGP_ExecuteScript() - C++ can execute ExtendScript (as can CEP Extensions), so you could implement a sort-of polling method to pass information between the two using global objects, but this would incur a lot of computational cost having the C++ plugin use AEGP_ExecuteScript() repeatedly to check for changes or new information. You could set up some conditional rules, but again, this is not elegant.
Before I go ahead and try one of these methods out, I thought it was worth adding my own question to this pile of unresolved forum threads in hopes that someone figured out a standardised way to do this basic operation after a decade of CEP extensions being available.
Cheers!
