Generic save state of everything

dhjdhjdhj's icon

OK --- now that someone has shown me how to use the basic pattr stuff to save the state of a patcher (https://cycling74.com/forums/struggling-to-save-state), I'm now looking for a more general solution.

I have a lot lot of top level patchers and having to insert 10 or so objects (representing the autopattr, pattrstorage and store/recall stuff) in every single patcher seems very awkward. I had hoped that I could at least have put those objects in an abstraction so that I would just have to include ONE extra object per patcher, but I haven't been able to get that to work.

Is there some way to simplify the saving/restoring of the entire state of an arbitrary patcher?

Chris Muir's icon

I usually end up with one top level patcher, but gobs of abstractions/bpatchers. In this scheme, each abstraction gets its own autopattr, and gets a scripting name. I have the bulk of the save/restore stuff in an abstraction included in the top level, that manages preset names, and menus to select presets by preset name. At the top level, I have a pattrstorage, an optional menu for selecting presets by name, my abstraction, and a button to open that abstraction to show some preset naming and saving stuff.

I'm not sure how I would go about it with multiple top level patchers.

dhjdhjdhj's icon

I don't know enough about max internals to do this but it seems to me that it ought to be possible to enumerate all objects in a patcher (and recursively through child patchers) and capture the state and then save it. Whether with a JavaScript object or an external, it would be an extremely useful thing to have lying around.

dhjdhjdhj's icon

Does the SDK have sufficient functionality to be able to enumerate and access all objects in a patcher and its children?