[PD] [PD-announce] getpatchname
Jamie Bullock
jamie at postlude.co.uk
Fri Jul 14 11:19:41 CEST 2006
On Thu, 13 Jul 2006 17:56:33 -0400 (EDT)
Mathieu Bouchard <matju at artengine.ca> wrote:
>
> a backpointer is simply a pointer to the parent node, supposing that there
> are parent/child relationships. In Pd, this always means a t_canvas*.
>
> what Miller said is that canvas_getcurrent() is only valid while inside
> the constructor. So you have to make a backup of the value of
> canvas_getcurrent() from inside the constructor, into the struct
> t_getpatchname.
>
Thanks. I thought it was something like that. Taking a closer look it seems to work like this:
It is safe to call canvas_getcurrent() outside the constructor, but it just returns 0 because (&s__X)->s_thing points to NULL, whereas inside the constructor it points to the symbol pointer for the current canvas.
> BTW, should it be called [getpatchname] or [getcanvasname] ?
>
I think [getpatchname] is better. Some people might think that [getcanvasname] returned the name of a [cnv].
Jamie
More information about the Pd-list
mailing list