On 08/22/2013 10:46 AM, Jack wrote:
Le 22/08/2013 16:36, Jonathan Wilkes a écrit :
On 08/22/2013 03:53 AM, Jack wrote:
Le 22/08/2013 07:13, Jonathan Wilkes a écrit :
Hi list,

I've got some updates to [canvasinfo], [pdinfo], and [classinfo] that I'll put in a demo build either tomorrow or the next day.

I also added a new data structure class with two creators:
[drawimage] - draw an image on a canvas
[drawsprite] - draw a sprite on a canvas

The [drawsprite] object takes the name of a directory containing an image sequence and
loads the images into tcl/tk memory when the object gets created.  A ds float field can then be
associated with that image so that when you change its value it jumps to that image in the
sequence.  I used the code from [drawnumber], so you can even animate the sprite by clicking
and dragging on the image.

Since all the images are preloaded into tcl/tk, animating them is fairly straightforward-- tk just
clears the old image and copies the new one from one of the images it has in memory.

Of course the upshot is fairly obvious-- we can finally have ponies running around inside Pure
Data patches.

E.g., thanks to this:
http://friendshipismagic.smackjeeves.com/comics/1223051/female-pony-base-sprites/

I can now do this:
https://puredata.info/Members/jancsika/omgponies.webm/view

I just added the "realtime code selection" as an afterthought using [cnv] objects.  However, it
would be neat to be able to group code and highlight it programmatically as the data is flowing.

-Jonathan


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

Very funny animation, we can now design platform games directly in a patch. ! ;)
More seriously, it could replace the [#see] object from gridflow, interresting...
++

As I understand it, [#see] is much more powerful because it's visualizing stuff
created from gridflow computations on the fly.  But it's probably also much slower
for that same reason.

One drawback to [drawsprite] is if you wanted to abuse it to draw a large image
sequence-- say a video clip-- you're going to use a ton of memory loading the images
into wish's memory.  And by default tcl/tk doesn't free that memory back to the OS.
However it does free it up within tcl/tk when the corresponding [drawsprite] is deleted--
so if you delete it and undo a bunch of times it won't consume more memory than it did
in the first place.

But for small sprites this isn't really an issue, and once the images are loaded it is very
cheap to copy/cut the scalar images on a canvas.

-Jonathan


Jack




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



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

Is it possible to add an argument to [drawsprite] to load the first X frame of the video ? Then, it will limit the memory used for large videos.
++

Right now it just scoops up all valid gifs (and pngs if you have tkpng lib) in the directory you specify.

I guess the ds "quanta" syntax could be used for this.  If ds member field "a" is associated
with the sequence number for a sprite, maybe a(0:99)(blah:blah) could just load the first 100 images
inside that dir.  (The blah:blah part would control how many pixels the sprite can be click-dragged,
which isn't that import here.)

-Jonathan


Jack




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