Forums > Dev

Object attributes for my GUI external don't save with the patch.

November 8, 2011 | 1:26 am

I am developing a Max/MSP (5.1.6 on a Mac) GUI external that wraps graphic widgets from another environment, and need to add Max Attributes at runtime (using OBJ_ATTR_FLOAT) after querying the object for a list of its property names and types. It is important that the attributes can be saved along with the patch (using OBJ_ATTR_SAVE), but I have been unable to get the save/restore functionality to work at all. I have attached the code for a simple external that explores the problem by creating a float attribute at class level and a float attribute at object level, while allowing for the GUI functionality to be disabled at compile time. The test result is that both class and object attributes work fine with the GUI disabled, but once the GUI code is activated (using jbox functions) then neither one works properly (the class attribute is stored in the patch file but does not load, and the object attribute does not show up at all in the patch file). Thanks in advance for your assistance.

  1. attrsave.c
November 8, 2011 | 3:30 am

You’re missing a call to attr_dictionary_process() in your ‘new’ method.


November 8, 2011 | 7:53 pm

Thanks for the suggestion, Tim. I do use attr_dictionary_process in my full GUI external, but thought it had to do with object box arguments and removed it to simplify the example. After putting the dictionary calls back in (see updated code attachment), the class attributes (CLASS_ATTR_FLOAT) are now indeed saved/loaded with the patch, but unfortunately object attributes (OBJ_ATTR_FLOAT) are still not saved or loaded. Any other ideas?

  1. attrsavev2.c
November 9, 2011 | 1:41 pm

Okay, now I understand. Unfortunately instance-attributes are not fully-featured at this time.

You’ll need to save your data by responding to a "jsave" method and then fetch your custom keys from the dictionary in your constructor.

Sorry to disappoint.


Viewing 4 posts - 1 through 4 (of 4 total)