Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide interaction for external window #418

Open
GitCodeBoy opened this issue Sep 9, 2022 · 7 comments
Open

Provide interaction for external window #418

GitCodeBoy opened this issue Sep 9, 2022 · 7 comments
Milestone

Comments

@GitCodeBoy
Copy link

Is your feature request related to a problem? Please describe.
I follow the test example to build a external widget/window inherit QOpenGLWindow in Qt.Use f3d.window.render() to draw the content.However, It doesn't interact with users the way Native types do,like handling mouse or keyboard event.
It may be a good idea to provide interaction for external window. Enable External Windows to have similar functionality as native Windows.

@mwestphal mwestphal added this to the 2.0.0 milestone Sep 9, 2022
@mwestphal mwestphal removed this from the 2.0.0 milestone Feb 2, 2023
@mwestphal mwestphal added the help wanted Please help with this issue! label Jan 7, 2024
@mwestphal
Copy link
Contributor

@Meakk do you think this is even doable ? Unless I'm mistaken the interaction layer would actually depend on the chosen lib providing the OpenGL context, at least it's how it is implemented for Qt in VTK.

@mwestphal mwestphal removed the help wanted Please help with this issue! label Jan 23, 2024
@Meakk
Copy link
Member

Meakk commented Jan 23, 2024

Hmmm, we could have an external interactor too so the user can just forward the mouse/keyboard events, what do you think?
Something like interactor.triggerMouseEvent(type, posX, posY, buttonHeld).
I don't know what would be the complexity for that, but I guess having the redesign an interactor can be annoying for libf3d developers.

@mwestphal
Copy link
Contributor

That would work I suppose. I wish we had an actual usecase first and I dont think @GitCodeBoy is still using the libf3d.

@mwestphal mwestphal added this to F3D Feb 3, 2024
@mwestphal mwestphal added this to the 2.4.0 milestone Feb 4, 2024
@mwestphal mwestphal moved this to Investigate in F3D Feb 4, 2024
@mwestphal mwestphal moved this from Investigate to Discuss in F3D Feb 4, 2024
@mwestphal mwestphal modified the milestones: 2.4.0, 3.0.0 Feb 9, 2024
@JPLost
Copy link
Contributor

JPLost commented May 26, 2024

Here is example for tkinter in Python.
Idea is for quick mesh manipulation/prototyping using F3D viewer with its builtin properties.

LanPTR3D.zip

@Meakk
Copy link
Member

Meakk commented Jun 7, 2024

Copy from Discord discussion https://discord.com/channels/1046005690809978911/1248564285328851015


So, I've been thinking of our current interactor logic and how it's pretty much unusable when using an "external" window.
When using the external context, the event loop is managed externally so you cannot really do a interactor.start() .
The main issue is the user has to reimplement all the interaction logic and handle the camera manually, which is a huge pain point.
We've seen Nokse. reimplementing it, and I've also reimplemented it in Java for the Android implementation (spoiler: it doesn't work well)
One solution for that would be to add public forwarder API to trigger events manually from the app. It could be something like that:

while (userEventLoop)
{
  switch(eventType)
  {
    case MOUSE_MOVE:
      engine.getInteractor().triggerMouseMove(event.mouse_dx, event.mouse_dy);
    case KEY_PRESS:
      engine.getInteractor().triggerKeyPress(event.modifiers, event.key);
    case FILE_DROP:
      engine.getInteractor().triggerFileDrop(path);
    case...
   }
   engine.getWindow().render();
}

The code above is basically what VTK is doing for native interactors at low level when we call start().
By doing that, the user handles the event loop, but F3D will handle all kind of interaction so all camera manipulations, key bindings and file drop come for free for the user.

@mwestphal
Copy link
Contributor

So in short we need to provide a dedicated API for this, so not breaking.

@Meakk
Copy link
Member

Meakk commented Feb 25, 2025

Just a comment to specify we need a way to transmit and multi-touch support for the Android app.

@mwestphal mwestphal modified the milestones: 3.1.0, 3.2.0 Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Discuss
Development

No branches or pull requests

4 participants