GetDragObject always returning exception

On 02/08/2016 at 02:38, xxxxxxxx wrote:

I'm trying to detect what type of object is being dragged into a LINK gizmo, inside a dialog defined by a res file.

I'm using the code:

def Message(self, msg, result) :   
               return gui.GeDialog.Message(self, msg, result)   
          print obj   
     return gui.GeDialog.Message(self, msg, result)   

But the print obj is never reached.
I'm not even sure if I'm using the GetDragObject() command correctly because it is not documented in the Python SDK.

On 02/08/2016 at 09:54, xxxxxxxx wrote:

Whenever I place questions here, I don't stop trying to search for ways to solve my problems and get results.
So, here is what I have come up with:

def Message(self, msg, result) :   
     if msg.GetId() == c4d.BFM_DRAGRECEIVE:   
          # check if the dragging operation is into my LINK gizmo   
          if self.CheckDropArea(MY_LINK_GIZMO,msg,True,True)==True:   
               # get the drag information   
               # get the list of objects dragged   
               # in my case, I just allow one   
               if len(obj)==1:   
                    # if it is the allowed type, happily return   
                    if obj[0].GetType()==ALLOWED_ID: return gui.GeDialog.Message(self, msg, result)   
               # otherwise, signal that is not allowed   
               return self.SetDragDestination(c4d.MOUSE_FORBIDDEN)   
     return gui.GeDialog.Message(self, msg, result)   

On 03/08/2016 at 05:09, xxxxxxxx wrote:

Hi Rui,

just want to acknowledge reacting on BFM_DRAGRECEIVE message is the correct approach.