Drag and Drop file from desktop?

Hi! First time posting!

I tried looking everywhere, and can’t find a way to handle a drop from the OS. Trying to drop a texture from the desktop and get the path/info to load it consequently.

I might create a second window with QT or any other window management, but it would be awesome to keep it all Panda3d!

Thanks!

Anybody has an answer on how to drag and from OS to the Panda3d Window?

This is not supported in Panda out of the box, that I know of—it’s not something anyone has asked before. Maybe it’s possible by embedding Panda into another toolkit, I don’t know.

On Windows, from a cursory look, it appears that the OS sends the WM_DROPFILES event:
https://docs.microsoft.com/en-us/windows/win32/shell/wm-dropfiles

It would not be particularly difficult to extend the Panda source to do this. Code to catch this would need to be added to winGraphicsWindow.cxx, which should call the DragQueryFile API function to obtain a filename.

Thanks so much rbd! At least I know I was not missing a function that already existed. I am not too savvy to modify the P3D source code, but definitely would try at some point. Should I add it as a request to Github?

I’d invite you to try; I’m happy to help if necessary. But sure, adding it as a request to GitHub is a fine idea too. :slight_smile:

@rdb I wanna know if this feature is now in panda3d or not! I really need it

It has not been implemented as of yet. See this issue to track the feature request:

2 Likes

please let me know when it is in panda3d