Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Drag and drop file on GeUserArea

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 343 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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?

      Thanks,

      Chris

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 29/04/2015 at 07:10, xxxxxxxx wrote:

        Hi Chris,

        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.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 29/04/2015 at 20:24, xxxxxxxx wrote:

          Yannick,

          Excellent! Works fine, but I'm a little puzzled by a couple of things.

          1. If I don't do:
          return  self.SetDragDestination(c4d.MOUSE_MOVE)
          

          from inside:

          if msg.GetId()==c4d.BFM_DRAGRECEIVE:
          

          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...'

          Also,

          self.SetDragDestination(c4d.MOUSE_MOVE)
          

          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?

          Thanks,

          Chris

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 06/05/2015 at 23:38, xxxxxxxx wrote:

            Hi Chris,

            1. Returning self.SetDragDestination(c4d.MOUSE_MOVE) ensures that your code intercepts BFM_DRAGRECEIVE message.

            2. 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.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post