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

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

Anonymous
Not applicable
437 Views
0 Replies
Message 1 of 1

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

Anonymous
Not applicable

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!

scene.png

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

 

0 Likes
438 Views
0 Replies
Replies (0)