Drag 'n Drop from Pyside2 GUI to VRED Scene (Python)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I want to realize a drag action from a qt table widget to a VRED geometry. In that table widget the name of a material is saved. Is there any proper way to realize such a task.
I was trying to solve the problem with a click event and when the mouse is released I check the mouse position with vrOSGWidget.getMousePosition(0). With vrOSGWidget.getSceneIntersection(0, x_mouse, y_mouse) I can get the geometry node and place the material with the specific material name on the geometry node. The problem is that when I start the click event on the GUI and as long as the mouse is clicked the method vrOSGWidget.getMousePosition(0) is giving me the value [-1, -1] back. As soon as I release the mouse button on the geometry the method vrOSGWidget.getMousePosition(0) returns a coordinate. But this coordinate is wrong! It is the coordinate where the mouse left the GUI for the first time. I have a litte scetch, which is demonstrating the problem a little better. The red X is the actual coordinate return when the mouse is released on the geometry and the black X should be the coordinate I want to have!
I hope anybody can help me with my problem or has a good solution to implement Drag n Dop events with Python, Pyside2 and VRED.
Thank you very much.
Michael