Bindto pattrstorage slot number?

Mar 14, 2008 at 5:32am

Bindto pattrstorage slot number?

I am reworking a patch to separate the logic and the UI with the pattr system. So far it is working out really well.

I am controlling pattrstorage remotely from my UI patch via a pattrforward. That works fine. But I’m stuck on one detail: I have a pattrstorage hierarchy and the top-level pattrstorage will change the slot numbers of my lower-level pattrstorages. I need my UI objects to update to reflect the active slot numbers. The problem is I can’t seem to get the current slot number through the pattr system. For example, I can’t access anything about a pattrstorage object through a pattrhub. I guess this is because you can’t bindto a pattrstorage.

Are there any tricks to make this happen? Or am I going to have to either
(A) introduce an additional pattr to store the slot number, and bindto that.
or
(B) Do some scripting with forward and receive objects to communicate the slot number back to my UI patch?

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 39 50 14 196617 2;
#P message 18 50 14 196617 1;
#P message 86 37 14 196617 2;
#P message 65 37 14 196617 1;
#P message 65 64 49 196617 store $1;
#N vpatcher -4 229 202 357;
#P window setfont “Sans Serif” 9.;
#P newex 24 61 86 196617 pattr @name var;
#X prestore 1 0 0;
#P objectname var;
#P newex 25 34 133 196617 pattrstorage @name preset;
#X client_rect 0 0 640 240;
#X storage_rect 0 0 640 240;
#P objectname preset;
#P pop 1;
#P newobj 136 64 39 196617 p logic;
#P objectname logic;
#N vpatcher 206 55 673 316;
#P origin 24 0;
#P window setfont “Sans Serif” 9.;
#P message 329 104 71 196617 getvar::name;
#P message 42 45 14 196617 2;
#P message 21 45 14 196617 1;
#P message 103 56 14 196617 2;
#P message 82 56 14 196617 1;
#P message 267 103 40 196617 getvar;
#P newex 322 161 73 196617 print pattrhub;
#P message 167 101 84 196617 getpreset::name;
#P newex 175 137 157 196617 pattrhub @patcher parent::logic;
#P message 81 121 49 196617 store $1;
#P newex 67 179 168 196617 pattrforward parent::logic::preset;
#P window linecount 3;
#P comment 161 58 100 196617 can’t remotely access anything from pattrstorage?;
#P window linecount 1;
#P comment 64 209 274 196617 how do I get parent::logic::preset’s slot number over here?;
#P connect 11 0 2 0;
#P connect 10 0 2 0;
#P connect 3 0 2 0;
#P connect 8 0 3 0;
#P connect 9 0 3 0;
#P connect 12 0 4 0;
#P connect 5 0 4 0;
#P connect 7 0 4 0;
#P connect 4 1 6 0;
#P pop 1;
#P newobj 135 36 24 196617 p ui;
#P objectname control;
#P newex 44 96 67 196617 pattrstorage;
#X client_rect 23 598 663 838;
#X storage_rect 0 0 640 240;
#P objectname u914000009;
#P connect 7 0 0 0;
#P connect 6 0 0 0;
#P connect 3 0 0 0;
#P connect 5 0 3 0;
#P connect 4 0 3 0;
#P window clipboard copycount 8;

#36346
Mar 14, 2008 at 7:26pm

You can bind to pattrstorage with a pattr object, or an autopattr object. The pattrhub object, however, doesn’t see pattrstorage objects. I would probably use pattrforward, the ‘getcurrent’ message to pattrstorage, route and a send to get that information as necessary, but your needs may require the use of other object types.

jb

#124637
Mar 15, 2008 at 12:49am

Quote: Jeremy Bernstein wrote on Fri, 14 March 2008 12:26
—————————————————-
> You can bind to pattrstorage with a pattr object

Yes, although when I interact with the pattrstorage I see
“warning: method getname called on invalid object” in the max window. Seems harmless?

I’d prefer to use pattrs purely for state management and not communication…

> I would probably use pattrforward, the ‘getcurrent’ message to pattrstorage, route and a send to get that information as necessary, but your needs may require the use of other object types.

Sounds good. Actually [route recall] -> [send] should work fine for me. Usually I avoid send/receive but it seems like the best option here (at least until a certain oo library comes out).

Thanks for the response.

#124638

You must be logged in to reply to this topic.