[PD-dev] how to tell when a patch is finished loading

Hans-Christoph Steiner hans at at.or.at
Fri Sep 11 06:44:39 CEST 2009


On Sep 2, 2009, at 11:22 AM, Mathieu Bouchard wrote:

> On Tue, 1 Sep 2009, Hans-Christoph Steiner wrote:
>
>>> just ping the client... depends a bit on the branch...
>>> miller: sys_gui("pd %s done \\;\n",rcv->s_name);
>>> hans:   sys_gui("pdsend \"%s done\"\n",rcv->s_name);
>>> matju:  sys_gui("netsend \"%s done\"\n",rcv->name);
>>> provided that you have done pd_bind((t_pd *)self,rcv); and a  
>>> class_addmethod for the name "done" (the callback).
>> Are there any existing methods?
>
> I stated it, therefore it exists.
>
> I suppose it depends on your school of ontology.
>
>> I am actually thinking Tcl/GUI side.
>
> You can't get out of this question without thinking with both sides.


Well, I found a little hack way to do it.  It turns out that 'pd'  
sends this proc when its done loading:

pdtk_canvas_getscroll .x64b920.c

And normally pdtk_canvas_getscroll is called with the toplevel path  
of .x64b920, for some reason when it finishes loading it calls  
pdtk_canvas_getscroll with the canvas name .x64b920.c.  So I added  
a ::loaded array, so you can check to see if a given toplevel .x64b920  
is loaded.  ::loaded(.x64b920) is first set to 0 when pdtk_canvas_new  
is called, then when pdtk_canvas_getscroll .x64b920.c is first  
received, ::loaded(.x64b920) is set to 1.  So you can "trace add  
variable ::loaded write" in order to run a proc when a patch has  
finished loading.  Works for me in my 'editmode_look.tcl' plugin.

.hc



----------------------------------------------------------------------------

There is no way to peace, peace is the way.       -A.J. Muste






More information about the Pd-dev mailing list