Provide mechanism to load/store GUI settings
When iterating on the development of some algorithm, it's common to repeatedly re-load Polyscope; in some cases, the user has to set the same options over and over again (e.g., the camera, the ground plane, the mesh material, etc.).
Would be nice to have a mechanism for saying, "save the state now" (e.g., upon exit) and also for reading this state back in upon the next invocation of Polyscope. E.g., functions storeGuiState( filename ) and loadGuiState( filename ).
Implementing these methods would entail some kind of serialization of the GUI state. Easiest would be to just handle "global" state that does not refer to any specific data passed to Polyscope.
Even cooler would be to also store settings attached to individual named data items—and ignore these settings if these items cannot be found (or have different types) on load. Polyscope should make it feasible to do this, since data can be queried by name.
Glad you brought this up, I definitely agree!
Actually 90% of this machinery already in place due to the PersistentValue<>s that are used for all parameters and globally cached via unique name (http://polyscope.run/basics/parameters/#persistent-values). Also, Polyscope already writes out a .polyscope.ini file, which for now just preserves the window size and location.
This was initially part of my plan for PersistentValue<>s, but I held off going all the way to restoring state automatically because I was worried about the application doing too many things "magically", reading from hidden files, etc. However, your comment brings up a great point that I can just make it opt-in, and allow users who know what they are doing to restore state when they want it and speed up their workflow.
Yeah, exactly. This is just something that the user can call if they want to — just like they can call any Polyscope routine if they want to! I agree that baking it in by default is not a good way to go. (But maybe include a well-commented example in the example code.)