Forums > Javascript

Objects automatically connect by proximity.

February 7, 2010 | 2:38 am

I’ve been putting together a patch that creates named bpatchers, and connects them in order when they’re created. The patch keeps track of their vertical order. So if I switch the order, pressing a button reconnects the bpatchers in vertical order and disconnects the old connections. It has been difficult, and now the patch is getting too complicated to support the actual functions of the bpatchers. The main idea is to connect objects automatically (or with a reconnect button) by proximity or vertical order. Any suggestions or advice ? I can post my patch, but I’m trying to start new. Thanks .. !


February 7, 2010 | 12:54 pm

If you post your patch I will take a look and help if I can.

lh


February 7, 2010 | 7:04 pm

what a mess….

– Pasted Max Patch, click to expand. –

February 7, 2010 | 7:22 pm

You haven’t posted the javascript file from the patch. I’ll take a look at it though.

lh


February 7, 2010 | 7:39 pm

Shoot, you’re right. But Luke, I think you gave me the script. It was a replacement for [posit]. it queries the x-y coordinates of an object with a scripting name.


February 7, 2010 | 8:00 pm

Ah no problems there then. I’ll check it out!

lh


February 10, 2010 | 12:19 am

Right, here’s what I have so far. It is by no means perfect but it does a fair lot and should set you on the right track. Rock’n'roll! If you create some objects by selecting from the [umenu] you can then click on the [inlet] at the top of each [bpatcher] and drag it around the screen. It will try and re-order the [bpatchers] by vertical position each time you release the mouse. At the moment it does this even if the order has not changed and there’s no sort of alignment done. There are a few other things you might want to improve, the position where new [bpatchers] are created is relative to the number of existing [bpatchers] which are assumed to all be the standard size, not their actual position on screen. I’ll see if I can improve it a bit more but 10 hour days at work might decide otherwise!

lh


February 10, 2010 | 3:33 am

Good job. I need to go through some javascript tutorials. What took me a huge messy patch (and didnt work) is accomplished in your script. I really appreciate the help. It works entirely for my purposes..I’ll send you the patch it will be incorporated into sometime soon…thanks luke !

-brandon


May 14, 2010 | 12:59 am

Hey Brandon. If your patch managed to survive I’d be interested in seeing what became of it!

lh


Viewing 9 posts - 1 through 9 (of 9 total)