[PD] locality with new [field] object (Jonathan Wilkes)

Jonathan Wilkes jancsika at yahoo.com
Mon Aug 31 16:59:57 CEST 2015


Sorry I haven't made a screencast.  I'm just putting off doing the "GNU/Linux Dance of Choice" where I try out the 9 unusable screencast tools before finding the only one that's minimally operable (or not).

Imagine you have a drawing instruction like this:[draw rect 0 0 20 20]
When you create the scalar you get a little black box on a canvas.
With a canvas field like I described, you can right-click the scalar and choose "Open" to show a canvas window.

You could put this in that canvas window:
[ \  <- number box
|[field x]
 
And when you scroll the number box, the little black box will move horizontally.

This is even more powerful when used with all the methods I added to drawing instructions:
[struct foo float x float y float r canvas a b]

[loadbang]|[transform rotate r(|[draw rect 0 0 20 20]
And put this in the canvas field:

[  \ <- number box
|[field r]
Now you can rotate the square from inside the canvas field.
Similarly, if you had an image sequence of Mario, you could use [draw sprite], associate the index with a field, and then let Mario animate himself using his canvas field. :)
BTW-- right now, if [field z] can't find a "z" field in its t_word vec, it outputs an error.  But if we're in an array, I suppose I could have it also search the parent scalar for such a field.  If it did that, it'd be something like a closure in Pd.  For example, you could have an array of Marios, all of whom have their own personal data like "x", "y", and "index", but all of whom also _share_ data like "world", "enemies", and "time".
-Jonathan

hey List, Jonathan.
 
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.

 sounds really brainfunky! i'd love to see this in "action" in a screencast, cuz i just cant imagine how 

the "a" canvas has access to all the field data of the scalar it belongs to.

 cheers
~/.jc 

_______________________________________________
Pd-list at lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list


      On Tuesday, August 25, 2015 11:25 AM, jamal crawford <threen52 at ml1.net> wrote:
   

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


More information about the Pd-list mailing list