I see canvasdelete adds a "delete" method for canvas. I'm thinking of adding a "deleteany" method that takes A_GIMME and deletes any object that matches the args.
Examples:
[deleteany foo(--[sendcanvas] deletes [foo] and [foo 12] [deleteany foo 12(--[sendcanvas] deletes [foo 12] but not [foo]
Or maybe this interface would fit better with dynamic patching:
[deleteany obj foo(--[sendcanvas] deletes [foo] and [foo 12] but not [foo( [deleteany text foo 12(--[sendcanvas] deletes comment "foo 12" [deleteany msg(--[sendcanvas] would delete all message boxes
Basically combining the core functionality of the "find" method with the "delete" method.
It would be a mildly useful improvement, but could be very useful if there were something like this:
[connectany "obj foo" 0 "obj bar" 0(--[sendcanvas] [foo] [bar] becomes [foo]--[bar]
Unfortunately Pd doesn't have sublists, and symbols with spaces are still pretty clunky.
Maybe connectany should be a separate external rather than a canvas method. Can anyone think of a decent interface for something like this? It would vastly improve the flexibility of dynamic patching.
-Jonathan
Oops, I created a strange subject for this thread. I just mean that these methods or externals search for matching objects then do their stuff.
Also, I suppose one way to achieve something like I'm talking about would be to have a [find] object that returnsthe order number for matching objects-- then you could use the already existing delete and connect methods.
Still, if it's possible it'd be more powerful to have the canvas methods directly for this-- that way you could type the code for dynamic patching completely in an object box, whereas using externals would require the message box to create the objects and a separate message to the external to find the objects to be connected. Compare:
[obj 20 20 foo, obj 20 40 bar, connectany foo 0 bar 0(--[sendcanvas]
to:
[obj 20 20 foo, obj 20 40 bar(--[sendcanvas]
[foo( [bar(
| |
[find] [find] | |
[pack 0 0]
| [connect $1 0 $2 0( | [sendcanvas]
Of course it gets more complex when working with lots of objects, but in that case you'd probably be using wrapper abstractions either way, and it's way easier to give things symbolic/numeric args that don't change than try to keep up with creation ordering.
-Jonathan
----- Original Message -----
From: Jonathan Wilkes jancsika@yahoo.com To: "pd-dev@iem.at" pd-dev@iem.at Cc: Sent: Tuesday, November 20, 2012 3:33 PM Subject: [PD-dev] canvasdelete search method
I see canvasdelete adds a "delete" method for canvas. I'm thinking of adding a "deleteany" method that takes A_GIMME and deletes any object that matches the args.
Examples:
[deleteany foo(--[sendcanvas] deletes [foo] and [foo 12] [deleteany foo 12(--[sendcanvas] deletes [foo 12] but not [foo]
Or maybe this interface would fit better with dynamic patching:
[deleteany obj foo(--[sendcanvas] deletes [foo] and [foo 12] but not [foo( [deleteany text foo 12(--[sendcanvas] deletes comment "foo 12" [deleteany msg(--[sendcanvas] would delete all message boxes
Basically combining the core functionality of the "find" method with the "delete" method.
It would be a mildly useful improvement, but could be very useful if there were something like this:
[connectany "obj foo" 0 "obj bar" 0(--[sendcanvas] [foo] [bar] becomes [foo]--[bar]
Unfortunately Pd doesn't have sublists, and symbols with spaces are still pretty clunky.
Maybe connectany should be a separate external rather than a canvas method. Can anyone think of a decent interface for something like this? It would vastly improve the flexibility of dynamic patching.
-Jonathan
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
On 11/20/2012 09:33 PM, Jonathan Wilkes wrote:
Basically combining the core functionality of the "find" method with the "delete" method.
as you already noticed, the desired functionality can be achieved with 2 separate objects, one for deleting one for finding. in general i would think twice to implement any object that "combines" rather than implementing the different parts and let the user combine.
fgmadr IOhannes
----- Original Message -----
From: IOhannes m zmölnig zmoelnig@iem.at To: pd-dev@iem.at Cc: Sent: Tuesday, November 20, 2012 8:51 PM Subject: Re: [PD-dev] canvasdelete search method
On 11/20/2012 09:33 PM, Jonathan Wilkes wrote:
Basically combining the core functionality of the "find" method
with the "delete"
method.
as you already noticed, the desired functionality can be achieved with 2 separate objects, one for deleting one for finding. in general i would think twice to implement any object that "combines" rather than implementing the different parts and let the user combine.
With the object, yes, but with the canvas methods I'm not sure the logic applies, as they would give the user a much easier way to design dynamic patches that cannot be implemented by a solution using separate classes.
But the difficulty of parsing the A_GIMME for something like "connectany" may make this a theoretical rather than practical distinction.
-Jonathan
fgmadr IOhannes
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev