object_attr_touch() , notify/redraw connected attrui

Thomas Resch's icon

hello,
is there a way to tell an attribute that it has been modified not by the setter?
so that for example attrui objects connected to my object would get notified and redrawn with the new value, although i used another function to change the value?

i found object_attr_touch() in the sdk, but it is not implemented.
thanks,
thomas

Emmanuel Jourdan's icon

What do you mean by it's not implemented?

With Max 6.0.4 SDK you should be able to do something like this:
// anywhere, decide you need to change the toto attribute (who binds to the j_toto variable in your object structure
// instead of calling object_attr_setlong((t_object *)x, gensym("toto"), 74) which would call the settr, you can set the value directly
x->j_toto = 74;

// and call
object_attr_touch((t_object *)x, gensym("toto")); // so the toto attribute notify anyone who want to know

In Max 5, you'll have to get the attribute object and then send the attr_modified notification.

Cheers,

Thomas Resch's icon

object_attr_touch() is documented, but I get a compiler error.
I'm using the latest sdk.

ndefined symbols for architecture i386:
"_object_attr_touch", referenced from:
_note_notify in note~globalUtilities.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

cheers,
thomas

Luigi Castelli's icon

Hi Thomas,

that's weird... I am calling object_attr_touch() without problems...
I am on MacOS 10.7.2 using Max/MSP SDK 6.0.0
I found other functions that are not exported, but object_attr_touch() works perfectly over here.

Could it be a problem with SDK 6.0.4 only ?

- Luigi

Emmanuel Jourdan's icon

It's working for me using Max 6.0.4 SDK.

In Max 5, you can do something like this:
t_object *attr = object_attr_get(x, gensym("yourattr"));

if (attr) {
object_notify(x, gensym("attr_modified"), attr);
}

Thomas Resch's icon

hey,
thanks and sorry to both of you.
my fault, had a mess with my search paths, it is working with SDK 6.04.
cheers,
thomas