"Distribute" function like in illustrator or indesign

Hello devvvvs + vvvvorum,

a suggestion for a little function that would help a lot to keep patches cleaner:

Do you know the “distribute” command in adobe illustrator or indesign? Works like that:
You select 3 or more objects, than say “distribute” and the objects are distributed evenly between the leftest and rightest (or highest and lowest) object.

If you could do this with Nodes and IO-Boxes in a patch, that would be very helpful, mainly in combination with the nice “align” function (ctrl+l).

What do you think?

Cheers, Gerrit

+1… no text …

+1… no text …

I renovate my wish or feature request to implement a grid/snap to grid positioning system in the UI

+1… no text …

actually grid sounds cool

Yes snap function please, sometimes patching is like sewing on screen…

uhyeah +1 from me to both ideas!

+1 snap
… no text …

You can snap to grid via a setpatch, I’ve just made a quick proof of concept for you, you should be able to make a distribute in the same way if you need it…
Put it in your root patch, and you should be good to go, EnableGrid allows you to turn it on and off, put a keymatch in(?) and grid spacing is the grid size in the crazy micro pixels they use for screen positons, can’t remember the scalar, so can’t set a grid in pixels…

Patch to allow snapping nodes to a grid (24.0 kB)

the Snap-Function sounds really good to me, too!

@catweasel: Thanks for the patch. I think it’s a good approach, but for me it is not snapping everytime I move a node. Do you have the same behavior or am I doing something wrong?

EDIT: and it doesn’t affect IO Boxes and Comments, right?

Yeah its just a quick example, so I only xpath for nodes, you can easily add extras, like ioboxes etc, and you should be able to make a distribute function with a sort to get the first and last slices and then spread the values between them…
Its ironic me making a gird snap, as on the whole I’m an untidy patcher, tidying is the last thing I do to a patch!