Pattr, Preset, and Bindto
I've been working on something that uses a single interface (a collection of GUI objects) with a tab to switch between multiple identical versions.
I've been using pvar so far, but this means everything has to stay on the same patcher level, and I know pattr is a lot more powerful.
Concerned about how heavy using a whole bunch of unseen GUI objects would be I had also tried using a single set of GUI objects and a set of colls to edit and store their settings, but this got complicated beyond my grasp.
In the example I've made, this mostly works: you can use the tab to switch binding between objects, you can store and recall presets, but when recalling presets sometimes it copies the state of one GUI object to all of the others, destroying the preset. I can't figure out what's going wrong.
It's not a permanent change, because if you just switch back and forward between presets a few times you can recall the original settings, but it's a glitch that makes this unusable.
Thank you so much to anyone who can offer advice!
I see two issues in your patch.
First you're not using [pattrstorage] with [preset] correctly. These two objects shouldn't be connected. If you want to use [pattrstorage] with [preset] as a GUI for it, you need to give your [pattrstorage] a name, and set that name in the @pattrstorage attribute of your [preset].
Then, the actual issue is that you are also storing/recalling the "remote" [multislider] and the layer [tab] selector. Depending on the order in which objects get recalled (which is undetermined when using [preset] as far as I know), the remote slider might be recalled with data from pattern 1 but while still being bound to pattern 2. That's what would make both multisliders sometimes having the same state, despite the stored states being different. The simplest fix would be to hide the remote multislider from [pattrstorage] using @invisible 1 in its attached [pattr]. This way, only pattern1 and pattern2 multisliders get recalled, as well as the layer [tab]. @default_active 0 would also work: the value would be stored in [pattrstorage], but never recalled.
If you want to use [preset] only instead, then you just need to exclude the remote object from the presets using [preset] middle outlet:
Such a thorough and clearly explained reply.
I've learned some very key things here, even though I know it's going to take some time to properly integrate them.
Thank you so much.