autopattr autorestore in Abstractions

    Apr 19 2010 | 11:11 pm
    I am quite fond of the @autorestore 1 feature of [autopattr] (enabled by default). With patches that don't require multiple presets, I typically just drop in an [autopattr @autoname 1] so that my recent parameters are automatically saved without dealing with writing/read files and recalling presets.
    I've found that this functionality does not work with abstractions in a patch. If I have a patch with abstractions or bpatchers (containing their own autopattrs), autopattr will only autorestore the values of the objects in the main patch, ignoring the objects in the abstractions. Adding @greedy 1 or @dirty 1 does not help. Adding @autorestore 0 to the autopattrs in the abstractions does not help.
    When I create a named autopattr and look at the storagewindow with a likewise named pattrstorage object, I can see the values of the objects in the abstractions... can I make autopattr reach into abstractions and change their values like pattrstorage does when you recall a preset? I know it's 'seeing' them, but it doesn't effect them.
    One particular application for this is the following: I have a bpatcher which is a GUI frontend to pattrstorage, exposing all of its messages in a nice way. I would like for some of the parameters of this bpatcher to be automatically set to their last values when I open a patch. There seems to be no way to do this except for to create yet another pattrstorage to recall the parameters of the pattrstorage GUI object!

    • Apr 19 2010 | 11:17 pm
      You can test this by putting the two attached files in a directory and following these instructions:
      1. Open 'autopattr.trouble'. 2. Change the values of the float box. 3. Open the abstraction and change the values of its float box. 4. Save. 5. Close. 6. Reopen. 7. The value of the float box in the main window is recalled automatically. 8. The value of the float box in the abstraction is the default, 0.
      How can I make this so that the value of the float box in the abstraction is automatically recalled?
    • May 04 2010 | 8:56 pm
      No biters? I ended up using a standard pattrstorage setup with as much autosaving as possible. I still needed to write presets by hand though.
    • May 05 2010 | 8:51 am
      Hello Morgan,
      This is the normal behaviour of autopattr. The autorestore state is saved in the abstraction, but saving the main patch doesn't save the abstraction, so it's autorestore state isn't modified.
      You can understand this better if you open the maxpats as text files. The autopattr.trouble.maxpat only owns a reference to autopattr.doesntrecall.maxpat, so it doesn't save it's content.
      Hope it's clear.
      Pattrstorage is the way to go.
    • May 10 2010 | 5:48 pm
      Great, I came up with a solution using pattstorage and a little abstraction that stores and saves when I save or close the patch.
      [closebang] and [jcom.savebang] -> (store 1) and (writeagain)