pdbe-molstar icon indicating copy to clipboard operation
pdbe-molstar copied to clipboard

How to save mol* state programmatically and load it on subsequent render

Open JamMaster1999 opened this issue 7 months ago • 1 comments

Hello,

Thanks for making the project light-weight and easily portable.

I have successfully implemented the PDBeMolstarPlugin and am able to render scenes without any issues by setting the options json.

Once the initial render takes place, the user might want to modify the scene to their liking using the GUI.

How do I retrieve this new state and how do I then load it back into the plugin to be rendered?

From just a quick look around, there is a state parameter on the viewer instance, but am not sure how to then load it in.

JamMaster1999 avatar May 10 '25 17:05 JamMaster1999

Ok I think I found the method. Curious if this is the most optimal way to do this:

To get the state: viewerInstance.plugin.state.getSnapshot();

To set the state: viewerInstance.plugin.state.setSnapshot();

JamMaster1999 avatar May 10 '25 17:05 JamMaster1999