glue-viz / glue

Linked Data Visualizations Across Multiple Files
http://glueviz.org
Other
728 stars 152 forks source link

Recording and rotating at the same time? #2504

Open SCO-SCI opened 1 month ago

SCO-SCI commented 1 month ago

The inability to rotate a 3D image and record it at the same time is a known issue with Glue. Has this issue been fixed, or is there a work around available?

Operating System: Windows 10 Pro Version 22H2 Python Version: 3.9.19 Anaconda Version: conda 24.5.0 Glue Version: 1.2.2 Installed using command: conda install -c glueviz glueviz=1.2

Carifio24 commented 1 month ago

Hi @SCO-SCI,

This isn't currently possible due to the fact that the Qt glue toolbar only allows one tool to be active at a time. I do have a workaround, though, using the glue terminal. Open the terminal (the Terminal button in the upper-right of the window), and run the following

from vispy import app

# You'll need to change these based on which tab your viewer is in, and the index of the viewer within that tab
tab_index = 0
viewer_index = 0
viewer = application.viewers[tab_index][viewer_index]  # application is an pre-defined variable in the glue terminal

def rotate(event):
    v._vispy_widget.view.camera.azimuth -= 1.  # Adjust this value to modify the rotation increment

timer = app.Timer(connect=rotate)
timer.start(0.1)  # Adjust this value to make the view rotate slower or faster (lower means faster)

# You can then stop using timer.stop()

This will start the view rotating (essentially copying the code that the rotate tool is using). Since the rotation tool in the toolbar isn't active, you can then record while the rotation is happening.

SCO-SCI commented 1 month ago

That looks great. Thank you for the workaround.

Ed