presets and jsui

Garrett's icon

Hi

is there a reasonably easy solution to save presets for jsui elements? Below I have a patch for storing and wiping presets which for a toggle on/off. There is also a jsui toggle but preset does not work with jsui - is there a way to retrigger its saved state and the tings it effected? Thanks in advance

a+
gar

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


nick rothwell | project cassiel's icon

On 10 Feb 2008, at 21:53, Garrett Lynch wrote:

> is there a reasonably easy solution to save presets for jsui elements?

Almost certainly not.

If you want to use the (deprecated) preset machinery with js or jsui,
your only option is to surround the object with "real" Max objects and
bind the preset to these.

If you use the pattr machinery, you are responsible for saving and
restoring state to/from JavaScript: this state is an array of atoms,
so it's possible to encode fairly complex data structures.

    -- N.

Nick Rothwell / Cassiel.com Limited
www.cassiel.com
www.myspace.com/cassieldotcom
www.last.fm/music/cassiel
www.reverbnation.com/cassiel
www.linkedin.com/in/cassiel
www.loadbang.net

jln's icon
Garrett's icon

hi

I keep getting stack overflows when I use the hidden toggle solution. Going to have a look at pattrstorage as I've not used it before. Thanks.

a+
gar

kjg's icon

I think a set message fixes the stack overflow:

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


Garrett's icon

this seems fine to me, I've seen far less elegant solutions - thanks for that, finished test below.

a+
gar

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