M4L :Add/remove from presentation attibute : how to?

bennid's icon

Hi mates,
I want to create a dynamic interface for joystick in M4L,
here's basic post with all question if you want to help further...
https://cycling74.com/forums/joystick-to-m4l-mapper-how-to-make-it-versatile-and-turn-button-to-slider/?reply_id=313868

So, I want to be able to replace ( add or remove from presentation ) button and sliders, toggles and switch dynamically regarding joystick model, and also toggle or switch choice from user interface button.

thanks for your help,
Best regards and creativity for new year !

Mike S's icon

Send "presentation 0" to remove from presentation or 1 in place of 0 to add. You will need to also send the message "presentation_rect x x x x" where x are the coordinates of the UI object, once you add the object to the presentation (as far as I remember Max objects forget their presentation coordinates once removed from the presentation).

bennid's icon

Great thanks a lot mike!

Just to go deeper, do you imagine a way to store and recall position ?

Many thanks!

Stephane Morisse's icon

Simply message boxes ?

bennid's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hi Stephane and thanks for your replies,
I look for a way to retreive automatically coordinates for the button in presentation mode
here's my example patch
(please advice if any simpler way to do this ;-)
best regards

Jan M's icon

instead of removing them from presentation you can just hide them in locked patchers. like this the objects keep their position. message is "hidden 1/0".

bennid's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hi Jan,
thanks a lot i just spent 6 hours on this crap !...
I HATE MAX !

bennid's icon

sometimes...

Jan M's icon

That what comes with intense relations :)

Max Patch
Copy patch and select New From Clipboard in Max.

here is a quick and dirty solution:

If you need a more complex UI change take a look at the [bpatcher] helpfile under the "using offsets tab"

Cheers

bennid's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Many ThanksJan,
I'm back on it,
it seems there's a few beugs with m4l, but clicking add/remove twice in right clic menu makes your patch work on M4L.
I'd love to use bpatcher but doesn't seem to work on M4L ( impossible to select .amxd in parent file)
once again thanks for your advice, really helpfull !
Last thing, i made this do you see simpler way ( just for me to learn more !)
Cheers man !

Jan M's icon

Hi Bennid,

indeed bpatchers are not meant to be used with .amdx inside, but they do work 100% fine within M4L. By why would you like to load an entire M4L device into a bpatcher? The ideas behind bpatchers and changeable UIs is to separate the UI from the other part and display only those UI objects needed.

The patch you posted only contains some ui objects, no patch cords or anything else. My guess is that you copy/pasted it when the patch was in presentation mode. This way only the visible objects were included. Can you post the full patch?

Cheers,

Jan

bennid's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hi Jan,
i think we mixed up... i want to use bpatcher in amxd not amxd in bpatcher ;-)
but i can't set bpatcher target file to amxd filetype...
Sorry for last post but patch doesn't exist anymore ! here's the new one !

bennid's icon

sorry it's a bit messy patch... i hardly manage to make something clear... maybe with s and r objects but i just give up this way...

Jan M's icon

i want to use bpatcher in amxd not amxd in bpatcher ;-)
but i can’t set bpatcher target file to amxd filetype…

Sorry, but i don't really get it... What do you mean with "target filetype amdx" if you want to load a .maxpatch ....?

bennid's icon

sorry i try to be more clear
i want to use bpatcher inside a m4L device,
but when i go to inspector to set target file for bpatcher, i can only choose maxpat file,
which i don't have since i'm in a M4L so to say an .amxd file...

i'm i wrong?

Jan M's icon

yes that's a misunderstanding. You can load any max patch into a bpatcher (also when inside a M4L device that is in your Max search path). When you frieze your device all external files that are used are automatically copied into a single .amdx file. So you can just share your device as a single file.

Another option is to check the option "Embed Patcher in Parent" inside the bpatcher inspector. In this case the patcher will be part of the main patch, just the way a regular subpatcher would be. Juste note if you use the embeded patcher in several location changes will only show up for the instance that you edited.

The more elegant solution in my opinion is to keep it as a separate file. When you edit a M4L device it becomes a project inside ~/Documents/Max (or Max 7)/Max for Live Devices (That's the Mac path). Just save the patcher you'd like to load into the bpatcher there.

cheers,

Jan

bennid's icon

thanks a lot jan,
but i wonder if i'd be able to share it after that...
i 'd like the interface to be userfriendly and not for people to go and put stuff in "complex" location.. )

Jan M's icon

I answered that already:

When you frieze your device all external files that are used are automatically copied into a single .amdx file. So you can just share your device as a single file.

it's the snow flake icon down left.

bennid's icon

Sorry thanks for your patience,
my patch is almost finished ;-) but for next one i'll use it for sure !
best regards