From a2d93df061ad9c8702153be8e80a9dd0533d90aa Mon Sep 17 00:00:00 2001 From: Norbert Herrmann <n.herrmann@physi.uni-heidelberg.de> Date: Tue, 24 Nov 2020 16:22:19 +0100 Subject: [PATCH] add camera handling tools --- macro/beamtime/camera_restore.C | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 macro/beamtime/camera_restore.C diff --git a/macro/beamtime/camera_restore.C b/macro/beamtime/camera_restore.C new file mode 100755 index 0000000000..48fa4f808d --- /dev/null +++ b/macro/beamtime/camera_restore.C @@ -0,0 +1,30 @@ +/* +void camera_restore(const char* fname, int mode = 0) +{ + TEveManager::Create(); + writeCurrentCamera(fname); +} +*/ + +void writeCurrentCamera(const char* fname) +{ + TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera(); + TFile* f = TFile::Open(fname, "RECREATE"); + c.Write(); + f->Close(); +} + + +void readCurrentCamera(const char* fname) +{ + TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera(); + TFile* f = TFile::Open(fname, "READ"); + if (!f) + return; + + if (f->GetKey(c.ClassName())) { + f->GetKey(c.ClassName())->Read(&c); + c.IncTimeStamp(); + gEve->GetDefaultGLViewer()->RequestDraw(); + } +} -- GitLab