save state of camera?

Asked by Bruno Chareyre

Hi,
I am almost sure there is (or was) a way to save the settings of the QGL window (zoom, camera, maybe even clip planes) into a file for later use in another session.
Does anybody know how to do that?
Thanks
Bruno

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Kneib François (francois-kneib) said :
#1

Hi Bruno,

very interesting thing to do. I just found it, the qt viewer is saved into the simulation if you use O.save(...) :

1°) launch yade, launch the 3d view.
2°) type : V=yade.qt.views()[0]
3°) move the view as you want to save it.
4°) type : V.saveState(0) # where 0 is a memory slot number, you should be able to save many 3d-view sates by changing this integer.
5°) save the simulation with : O.save("whatever")
6°) close and re-launch yade.
7°) load the simulation with O.load("whatever")
8°) launch the 3d view
9°) type again : V=yade.qt.views()[0]
10°) type : V.loadState(0)
11°) et voilà

Warning : after step 6°), you have to load the simulation before starting the 3D view. Otherwise the memory slot will not be recovered.

Revision history for this message
Chareyre (bruno-chareyre-9) said :
#2

Thank you, but it doesn't work for me. It does exactly the same as the
F7-F9 keys, and I just reported a bug against them [1].
No error message but the displayed object disappears after 10°). Not for
you?
I re-wrote saveState/loadState after finding this bug (uncommited). Now
I can save/load correctly. The problem it is only restoring the viewer
(camera position, basicaly), not the renderer (background color,
clipping planes, etc.). It is a regression compared to what it was
supposed to do (saving both), but it works... Not sure what to do.

B

Revision history for this message
Kneib François (francois-kneib) said :
#3

I have done my tests without bodies, just by showing the 3 axis, so I was not aware of this bug.
I have just noticed that once you have loaded a view state, all changes you make at the renderer with the controller will not apply (background color etc ...). It is certainly linked to the bug you reported.

Can you help with this problem?

Provide an answer of your own, or ask Bruno Chareyre for more information if necessary.

To post a message you must log in.