Title says it all.
Regards,
Scott
Title says it all.
Regards,
Scott
Hmmm... yes, but it would take some work. Basically you would need to loop through all the widgets and generate the JSON needed to recreate them. You would also need to capture all the extra functions you define in an object as well. Once you do this you could then save the info using HTML5 local storage methods.
Note that each widget has an object named props that stores the original values as generated by JSON (or by dynamic creation). The tricky part is that this object is not updated when properties are changed dynamically via scripting. So if you were moving widgets around on the screen, for example, you would have to make sure you were updating the props object appropriately. If you do this then you can just store the props object and you should be able to recreate widgets reliably from that.
As an example, if you sent:
/control/setBounds yourWidget 0 0 .5 .5
you should probably follow it up with:
/control/runScript "yourWidget.props.bounds = [0,0,.5,.5];"
You could also specify a custom OSC delegate that would do this automatically in Control so that you only had to send one OSC message.
Once you have the JSON of a widget, just call control.addWidget(yourJSON) to add it to an interface.
I would say a good first step would be to see if you can save / recall the props object of a button that hasn't been dynamically modified using HTML local storage. There's an easy to follow guide to local storage in the ebook found here: