GeUserArea Drag&Drop



  • On 27/04/2016 at 09:21, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   14 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hello all,

    I've been looking into the Drag&Drop functionality for GeUserAreas and I can't get it to work. In my GeDialog I have GeUserAreas that correspond to materials in separate files. My goal is for the user to be able to start dragging a GeUserArea to the Material Manager or over an object and have it placed properly.
    Having it dragged to the Material Manager works correctly, when I try doing the same over an object it only creates an empty texture tag.

    I started my code based off a forum post that had the same question,
    https://plugincafe.maxon.net/topic/7546/9450_dragdrop-from-geuserarea-solved&KW=HandleMouseDrag&PID=44368#44368.

    In my GeUserArea's InputEvent() I have the HandleMouseDrag function

      
      GeData data;  
      msg.GetParameter(DescLevel(BFM_INPUT_DEVICE), data);  
      if (data.GetLong() == BFM_INPUT_MOUSE)  
      {  
          msg.GetParameter(DescLevel(BFM_INPUT_CHANNEL), data);  
          if (data.GetLong() == BFM_INPUT_MOUSELEFT)  
          {  
                
              AutoAlloc<AtomArray> arr;  
              arr->Append(BaseMaterial::Alloc(Mmaterial););  
             
              if(HandleMouseDrag(msg, DRAGTYPE_ATOMARRAY, arr, 0) == TRUE)  
              {  
              }  
                
              return TRUE;  
           }  
      }  
    

    I also created a SceneHook plugin based off the responses to some of the forum posts. When I run the plugin my SceneHook plugin does not receive any of the messages that it seems it should be, I receive no print outs from the function running.

      
    Bool SettingsSceneHook::Message(GeListNode* node, LONG type, void* data)  
    {  
        
      if(type == MSG_DESCRIPTION_CHECKDRAGANDDROP)   
      {  
          GePrint("Description Check Drag&Drop");  
      }  
      if(type == MSG_MATERIALDRAGANDDROP)   
      {  
          GePrint("Material Drag&Drop");  
      }  
      if(type == MSG_DRAGANDDROP)   
      {  
          GePrint("Drag&Drop");  
      }  
      return TRUE;  
    }  
    

    I've been looking into this for a couple of days now and I'm not sure where the issue is, any assistance would be greatly appreciated.

    Johan



  • On 28/04/2016 at 00:52, xxxxxxxx wrote:

    Hi Johan,

    Directly dropping the newly created material over an object can't work as it doesn't exist in the document and the TextureTag can't resolve its link.
    The dropped material has to be inserted in the document before so I'm not sure how your plugin workflow should be.

    About the SceneHook messages I don't think they can be useful in such situation:

    • The description messages are sent to the changed node, not globally.
    • The MSG_MATERIALDRAGANDDROP is sent to materials.
    • And the MSG_DRAGANDDROP is sent to elements in the Attribute Manager.


  • On 29/04/2016 at 11:02, xxxxxxxx wrote:

    Thank you for the quick response. I thought that that might be the case, just wanted to make sure before moving forward.

    Johan


Log in to reply