[PD] a good way to remove selected data objects?

Chuckk Hubbard badmuthahubbard at gmail.com
Wed Feb 28 03:25:01 CET 2007


On 2/27/07, Rich E <reakinator at gmail.com> wrote:
> Hi all,
>
> I was wondering if anyone has come across a good way to selectively remove a
> visualized data structure, hopefully without having to use the mouse.  Eg,
> I'd like to be able to select something based on the position of my tablet
> pen and then remove it, as well as maybe clearing a corresponding array and
> whatnot.
>
> So far, the only thing I can think of is correlating a deselect message with
> a backspace [keyup], which would then give me a pointer to the structure
> removed with backspace.  This, however, isn't ideal, because there may be
> other data structures that need to be removed that are related to the one
> manually removed.  Also, I like avoiding the use of the trackpad... but I
> don't know what is currently possible in this area.  I remember there being
> talk on the subject, but cannot find the posts.

Hi Rich.  I don't know if this suits your purposes, but it has worked
for me.  I have a cursor that scans left to right on the score, and a
button I can hit to mark the beginning of the selection zone.  I move
the cursor some distance to the right and hit another button to mark
the end of the selection zone, and then a pointer runs through all the
scalars of that type and checks their X value (could easily be X and
Y, or some other field).  If it matches the selection zone, Pd sends
[editmode 1( to the subpatch in question and then a [mouse( message to
"click" on the scalar.  I forget the specifics, and where the
documentation is, but you can set this up to shift-click, so that it
selects every scalar that fits the parameters at once.  Then you can
hit backspace, or I think you can even have Pd automatically send a
key message corresponding to the backspace key to the subpatch,
deleting the items in question.
The downside to this is if you have multiple overlapping data types;
the mouse message selects everything at the given point.  The upside
is that you can use it to copy-paste or to move scalars as well as
deleting them.

An obvious alternative that takes a little longer is to have a backup
subpatch, and everything written to one goes to the other as well;
then the procedure would be clear the main subpatch, copy only the
desired items from the backup, then clear the backup and recopy.
Perhaps this would be simpler using [qlist] instead of a backup
subpatch, I've never tried.

This is bordering on cockamamie, but you could multiply every data
field of every scalar by its visibility flag, so that when it's set
invisible everything comes out as 0, and whenever you have to add a
scalar you first scan for any with 0 in that field and recycle them.
Might [route 0] or [select 0] the values, too, so that 0's don't even
get passed through.

I've given this a lot of thought, as I use Pd to create "scores", and
I have yet to find a great solution.  Let me know what you end up
doing.

-Chuckk

-- 
http://www.badmuthahubbard.com




More information about the Pd-list mailing list