Object attributes for my GUI external don't save with the patch.
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.
You’re missing a call to attr_dictionary_process() in your ‘new’ method.
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?
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.