On 2016-12-06 09:17, Roman Haefeli wrote:
> I'm considering making a GUI plugin part of distributable Pd project.
> Now, I wonder if:
> 
>   * a GUI plugin from the project's path instead of a Pd's standard
>     search path.

although the verb is missing, i am pretty sure that the answer is "yes"
(not a problem).

> 
>   * there is way for the main patch to communicate with the GUI plugin.
>     I'd like to allow some configurations to be done in the patch, so
>     that it will affect the behavior of the GUI plugin. 

there's a mechanism that allows for easy sending from core to a plugin.

- in the plugin, call
> ::pd_connect::register_plugin_dispatch_receiver <myplugin> <callback>
(where "<myplugin>" is a unique ID for your plugin, and <callback> is
the name of the callback function in your gui-plugin.

- on the patch side, send a message [plugin-dispatch <myplugin> ...( to
the "pd" receiver.
this will call the <callback> function on the Pd-GUI with the "..." args.

see attachments for a trivial example.


iirc, this has been introduced with the GUI rewrite (so it has been here
for quite some time).
however, older versions (<0.47 ?) of Pd would complain bitterly, if you
sent something to an unregistered receiver (e.g. the GUI plugin did not
load)


fgmasdr
IOhannes
#N canvas 275 278 450 300 10;
#X obj 104 203 s pd;
#X obj 104 159 list prepend plugin-dispatch;
#X obj 104 181 list trim;
#X obj 104 137 list prepend Patch2GUI;
#X msg 68 72 bang;
#X msg 141 73 one zwei 3;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 3 0 1 0;
#X connect 4 0 3 0;
#X connect 5 0 3 0;
package require pd_connect 0.1

proc p2g_receiver {args} {
    pdtk_post "GUi received from patch: $args\n"
}
::pd_connect::register_plugin_dispatch_receiver Patch2GUI p2g_receiver

pdtk_post "to-gui plugin: demonstrate communication between patch and a gui-plugin"

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list

Reply via email to