pattrstorage vs coll

Apr 10, 2006 at 6:49pm

pattrstorage vs coll

I have a general (and somewhat vague) question about pattrstorage.

I’ve been using colls to store settings for scenes and objects that I’m managing manually in a javascript-instantiated jit.gl.sketch. Lately I’ve been looking at pattrstorage, and it seems to have some real advantages over coll.

However, pattrstorage is designed to store state information for named interface objects, and I’m using one set of interface controls for all my 3D models/objects. The user selects a model (out of multiple models in the scene), and while that model is selected, the interface objects affect that model. Thus I need to store and recall state information for all my models, even though each one doesn’t have a dedicated interface. At the same time, I have other interface objects that control overall scene parameters, and for those parameters, there is a named control for each parameter in each scene.

In other words, I have a hierarchy something like this:

scene1
camera position
lighting [etc]
object1
color
position [etc]
object 2
color
position [etc]
object 3
[etc]
scene2
[etc]

So:

1. Is it possible to ‘nest’ pattrstorage in some way, so that a single preset could control single parameters for some objects, and multiple parameters for other objects? Or will I need to have a pattrstorage preset for every single object in my scene, thus duplicating all the scene parameters?

2. If there is a way of doing this, how might I restore data from pattrstorage to multiple objects in my javascript? I can think of one way of doing it with gates and priorities, but I’m wondering if there’s some simple method that I’ve missed.

Finally: am I totally on the wrong track; is pattrstorage designed specifically for use with interface objects, and is coll still a better option for the kind of information I’m trying to store?

Sorry these questions are so amorphous, and I apologize in advance if the answer is somewhere in the documentation staring me in the face.

pH

#25335
Apr 10, 2006 at 7:24pm

Am 10.04.2006 um 20:49 Uhr schrieb Perry Hoberman:
> 1. Is it possible to ‘nest’ pattrstorage in some way, so that a
> single preset could control single parameters for some objects, and
> multiple parameters for other objects? Or will I need to have a
> pattrstorage preset for every single object in my scene, thus
> duplicating all the scene parameters?

Yes, pattrstorages nest. This is demonstrated in the pattrstorage.help
file. You can use a “master” pattrstorage to control the preset state of
clients.

> 2. If there is a way of doing this, how might I restore data from
> pattrstorage to multiple objects in my javascript? I can think of one
> way of doing it with gates and priorities, but I’m wondering if
> there’s some simple method that I’ve missed.

I’m not entirely sure how you mean this here. You likely just want to
send messages for pattrstorage out of a special outlet in the JS object.
If you mean that you have a “state” to save inside of a JS object, you
need to add getvalueof and setvalueof functions to your JavaScript code,
as documented in the JSinMax document.

> Finally: am I totally on the wrong track; is pattrstorage designed
> specifically for use with interface objects, and is coll still a
> better option for the kind of information I’m trying to store?

pattrstorage is designed to manage data for any named object which
supports the “getvalueof” and “setvalueof”. At this time, most of these
objects are UI objects, since we wanted pattr to be compatible with
objects that preset is compatible with. In the future, this will include
many, many more objects — basically any objects with attributes. Any
attribute of any object can be managed by pattr/pattrstorage.

jb

#74511
Apr 10, 2006 at 11:07pm

>Yes, pattrstorages nest. This is demonstrated in the
>pattrstorage.help file. You can use a “master” pattrstorage
>to control the preset state of clients.

Sorry, but I can’t find any reference to nesting in the pattrstorage.help file. The closest things I can find are the subpatch for ‘greedy’, and the patch for ‘slot_mgmt, both of which use additional pattrstorage objects to demonstrate various points, but neither of which demonstrates nesting in any way that I can discern.

#74512
Apr 10, 2006 at 11:17pm

Okay, I think I get it – if ‘greedy’ is off, then the preset of the subpatcher pattrstorage object can be controlled from the outer patch, and it in turn controls the named objects in the subpatch.

So then nesting is possible as long as the nested pattrstorage is in a subpatch?

Is there any way to have several pattrstorage objects at the same level, each controlling different named objects?

#74513
Apr 11, 2006 at 2:23pm

Yes, multiple pattrstorages at the same patcher level doesn’t work —
they interfere with one another.

jb

#74514

You must be logged in to reply to this topic.