Drag and drop file on GeUserArea
On 28/04/2015 at 12:58, xxxxxxxx wrote:
I'm trying to add the ability for a user to drag and drop a file on my plugin.
Is there some way I can get the file path of a file dropped on a GeUserArea?
On 29/04/2015 at 07:10, xxxxxxxx wrote:
To get the drag information call self.GetDragObject(msg) from the GeUserArea.Message(). See this post for an example of implementing Message() and filtering BFM_DRAGRECEIVE message.
The 'object' key in the returned dictionary holds the drag object data: in the case of a file it's its name.
On 29/04/2015 at 20:24, xxxxxxxx wrote:
Excellent! Works fine, but I'm a little puzzled by a couple of things.
- If I don't do:
C4D intercepts my image file and displays it in the 'Picture Viewer'.
How does that return prevent that?
I tried just 'return True', but it seemed like that didn't always stop C4D from loading the image file.
Should 'return True' always stop it, or is there some magic in 'return self.SetDragDest...'
never sets the mouse cursor no matter what I try. Should it?
Since the drag starts outside the userarea, it is a file, is there some way I can detect the dragging over the userarea and trigger a redraw() so I can display something while they are dragging, before they drop the file?
On 06/05/2015 at 23:38, xxxxxxxx wrote:
Returning self.SetDragDestination(c4d.MOUSE_MOVE) ensures that your code intercepts BFM_DRAGRECEIVE message.
Only BFM_DRAGRECEIVE is sent when drag and drop is begun from outside the user area. And while hovering the user area only BFM_DRAW/DrawMsg() is sent so unfortunately there's no way to know if the mouse is dragging or not.
Sorry for the late reply.