allen-cell-animated / agave

Other
33 stars 5 forks source link

Feature/manipulators #131

Closed toloudis closed 9 months ago

toloudis commented 10 months ago

This PR introduces a code framework for in-viewport manipulators. At a high level, here are the important strategic changes:

Agave's camera controls are now implemented within this framework, and as a demonstration of new capabilities, pressing A in viewport will animate the camera to center the view. Apart from this, the rest of AGAVE should be expected to work as before.

Future work: Next steps are to complete a rotate tool, add scroll-to-zoom, and consider UX to complete the integration of in-viewport interaction with respect to user flow. (when to hide/show the tools, when to initiate interactivity, and how to get tool updates to be shown in the rest of the UI). Implementation details most likely will include having some kind of SceneObject class with a position and rotation that can be edited.

toloudis commented 10 months ago

As this is a big PR, here's my suggestion of how to get through it short of splitting it apart.

The big files are gesture.h/cpp, Manipulator.h/cpp, and ViewportWindow.h/cpp. (CCamera.h/cpp also got some significant code added but it's not very complicated.)

The remaining changes are relatively small / easy to understand in comparison.

One way to get through the big files is to read the comments first. I think it's pretty well commented. Also because it's derived from some blog posts, the blog goes into more depth explaining the motivation.

The big idea is "immediate mode" - on every redraw we are updating the input state (including picking), updating camera, evaluating manipulator actions, recalculating their drawing primitives, and then redrawing.

toloudis commented 10 months ago

This definitely would have benefit from being split into several smaller PRs, because of the time commitment and the quality of discussion we're able to have about each piece.

Understood.

One thing I noticed from playing around with the UI is that the way Gestures is set up doesn't seem to support changing what modifiers you're using in the middle of a click/drag operation. That might be a UX question to consider down the line.

I think you could do this by looking at the gesture input state in the action and draw functions. You'd just have to implement the Manipulator to check for what info it cares about.