autopattr and bpatchers

glen930's icon

Hello all,

I have a patch that has some top level controls and a patch contained in a bpatcher with more controls.

When using autopattr, the top level controls are recognized but not the controls contained within the bpatcher. I've enabled embedding in the bpatcher and have made sure all controls have a scripting name.

What am I doing wrong?

Thanks in advance for your help.

Glen

Ben Bracken's icon

You would need an autopattr in your bpatcher as well. It only works on the same "level" it is in, not subpatchers or parent patchers.

-Ben

glen930's icon

Thanks for the reply.

I'm still a little confused because the tutorial on patcher storage states that for pattr family of objects:

"We can maintain sets of data from objects throughout a Max patch hierarchy. For example, with pattr you can control the state of objects inside patcher and bpatcher objects all from the top level of the patch."

Is the tutorial in error?

Glen

Chris Muir's icon

No, autopattr is just what exposes the named controls in your bpatcher to the pattrstorage living at the top of your path hierarchy. You need an autopattr in any abstraction that you want to be part of the pattr world.

jonnyfive's icon

Also, I think you have to set @greedy to 1 at the top level autopattr or pattrstorage.

-j5

glen930's icon

Thanks Chris and Jonny, I understand now.

Glen

Morgan's icon

"Also, I think you have to set @greedy to 1 at the top level autopattr or pattrstorage."

Just to correct, this is not true. With @greedy 0, the autopattrs in subpatches are exposed to pattrstorage/autopattr in the main patcher. @greedy exposes _everything_ (sub-sub patches, regardless of autopattrs, etc.)

Read the help closely.

seejayjames's icon

Does [pattr] get exposed if greedy is set to 0 too? Or just [autopattr]...
or is [autopattr] just like a bunch of [pattrs]...
there's a lot going on :)

Jesse's icon

From pattrstorage's reference page:

     The word greedy, followed by a number between 0 and 2, sets the pattrstorage object's client search behavior flag. The default is 0 (disabled). greedy provides a way to limit the amount of data a single pattrstorage object will manage.

When disabled, the pattrstorage object can see all pattr objects or objects bound to autopattr objects in any child patches of the pattrstorage object (or child patches of those child patches, tunnelling down through the patcher hierarchy), until another pattrstorage object is found. Although the pattrstorage object found in a child patch will be a client of the parent pattrstorage object, no other objects at that level or below in the patcher hierarchy will be.

When the greedy attribute is set to 1, the pattrstorage object can see everything, all the way down to the bottom of the patcher hierarchy (including any pattrstorage objects it finds along the way).

When the greedy attribute is set to 2, the pattrstorage object can only see potential client objects in its patch. No other patches are searched.