polyscope icon indicating copy to clipboard operation
polyscope copied to clipboard

Serialization of "View" and "Appearance" values

Open dcoeurjo opened this issue 4 years ago • 2 comments

There are several camera-related issues (with slightly some parts in common with this one) but anyway…This one may generalize couple of them.

It would be great to be able to serialize the "View" (including camera position/look-at) and "Appearance" stuff in order to be able to load/save settings from the UI or load one from the command line.

My main use case would be to load/save camera settings but this could be part of a more generic serialization feature for these kinds of parameters.

dcoeurjo avatar May 05 '21 08:05 dcoeurjo

Yeah! In general Polyscope is definitely in need of better camera controls, and serialization would be great as well. We're already in a fairly good place to implement serialization, since all properties are stored in global maps with unique string keys to support persistent values. Hopefully I will have some time soon after finishing up my thesis....

One small feature you might not be away of: at any time in the UI, you can hit ctrl-C to save the state of the camera as a json string to your clipboard. You can then restore this state with ctrl-V at a later time (or save these strings, edit them ,etc). You can programmatically access the same functionality via:

// in polyscope::view

std::string getCameraJson();
void setCameraFromJson(std::string jsonData, bool flyTo);

nmwsharp avatar May 07 '21 18:05 nmwsharp

Thanks for the tip, Nicholas ! I was not aware of that and this is great for my camera use case.

dcoeurjo avatar May 12 '21 06:05 dcoeurjo