Copy link to clipboard
Copied
Hi,
I am now working on a PF plugin. There is a button which trigers a script window run by ExecuteScript. And there is also a button in my script window. What I want is that when I click the "Apply" button in script window, my plugin should recieve a command that can send my data from script window back to my arbitrary data in my PF plugin. (Like what adobe have done with Color Parameter, when you change color in Color Picker window, the color param can get the color data real time)
Copy link to clipboard
Copied
There is no easy way I know of.
ExecuteScript was originally intended to be run modally, i.e. run a script synchronously once in the foreground and get an optional result/return code back while all other processes are blocked. So you can return values directly to your effect plugin onyl after your script has run, and also only once, not continually. Maybe C++ script extension plugins or whatever they are called could be a step in that direction, but you'll probably still end up with lots of weird issues.
We once did a more complex configuration that as far as I remember went like this: one effect plugin that starts a script with non-modal dialogs. Another AEGP plugin that registers command hooks with AE. The script dialog sends data to the command, which in turn gets assed to the AEGP plugin. The AEGP plugin processes this data and shares it internally with the regular effect plugin. This approach can be really convoluted and you really have to know what you are doing and it also might break easily, so not really recommended.
I remember some other wild approaches by other people, like trying sending data from the script using local sockets back to the plugin, but I think that failed.
If anyone knows of an easy and currently working solution, let us know. ![]()
Copy link to clipboard
Copied
you can write an extention DLL, which allows to define javascript functions
that re executed on the DLL. meaning, on the javascript side you can call a
function that triggers a DLL's C function that can pick up the execution
from there.
on the Extendscript Tools installation folder there's an "SDK" folder with
some samples.
you'll still need to figure out how to connect between that DLL and AE's
API...
On Sat, Mar 23, 2019 at 9:46 AM Toby (reduxFX) <forums_noreply@adobe.com>
Copy link to clipboard
Copied
it's maybe not themore appropriate way, but in a similar case I used a json solution.
On the plugin side I include a json parser lib (evyrthing is in a header (like https://github.com/nlohmann/json or some smaller lib).
On script I use jsonjs GitHub - douglascrockford/JSON-js: JSON in JavaScript (thanks shachar in a previous thread).
The script is called with userChangedParam. the data comes from the arb to json.
the script part send data to json and the plugin parse the result in order to send it back to arb
.
my code is here if you want to have a look. (in the dialog.cpp file).
Copy link to clipboard
Copied
But in your solution it is still only a one time return call, right?
I understood the original poster in a way that the dialog window should stay constantly open and each change of a value in the dialog is transferred to the plugin, so not the simple ExecuteScript() / evaluate return value approach.
Copy link to clipboard
Copied
Ha you maybe right.. Does the "Apply" button close the script Window ? I understood that the script was called from plugin, then does some stuff and send data to plugin when it's closed...
If not sorry, I'm wrong.
Copy link to clipboard
Copied
Thanks for sharing your approach!
Sorry for confusing, the "Apply" button only send data and does not close the script window, which means the script window should run asynchronously.
Thanks again for all of you guys approachs. Base on the discussion above. I will try to add an event loop to scan script data periodically.![]()
Copy link to clipboard
Copied
But how are you gonna do this? How are you gonna "scan script data"?
Copy link to clipboard
Copied
Ae will not delete data you saved to global script variables (I learned this features in ExtendScript). Means, it maybe as same as ExecuteScript because inside the API there must be a same approach when ExtendScript links to Ae.![]()
Copy link to clipboard
Copied
Yes, I as more thinking of the c++ side.
So you want to regularly call ExecuteScript() from inside your plugin to get the current data from the scripting engine, right?
Not sure how well that goes performance wise, but please try and report back ![]()
Find more inspiration, events, and resources on the new Adobe Community
Explore Now