[PD] locality with new [field] object

Jonathan Wilkes jancsika at yahoo.com
Sat Aug 22 00:44:41 CEST 2015


Hi list,I just coded a new class called "field" to be used in conjunction with a new data structure type called "canvas".  (I got a prototype of the "canvas" type working awhile back, but this should be a bit more refined.)

You start with a struct:[struct foo float x float y canvas a b]
Then create a scalar from this struct.
The scalar will have an "x" value, a "y" value, and a canvas "a" which gets filled with the contents of an abstraction "b.pd" that is somewhere in Pd's search path.
Now here's the neat thing-- inside the newly instantiated "b.pd" you can do this:
[loadbang]|[field x]|[print x]
When you instantiate that scalar above, its canvas "a" will print out the value of the "x" field for that scalar.  In other words, the "a" canvas has access to all the field data of the scalar it belongs to.
The interface is exactly like [v], which means you can do this:
[loadbang]|[f]x[+ 1]|[field x]
This will _change_ the value of "x" for the parent scalar.  So if you drew a little rectangle, when you instantiate your scalar you'll see it moving across the screen.

Notice:* no gpointers necessary* no need to type the template name (since you can only have one per scalar)
The way I think of this is like a sprite of Mario, where you can click on the sprite and see the code which is controling Mario (making him move, sing, etc.).

Unfortunately the implementation is subject to my same uncertainty about realloc and pointers to array data.  But I'm hoping that either a) I'm wrong about that problem or b) someone will solve that problem and I'll use the same solution here.
I'll try to post some screencasts once I do some more testing.
Best,Jonathan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20150821/454dad41/attachment.html>


More information about the Pd-list mailing list