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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Drag&drop from GeUserArea [SOLVED]

    SDK Help
    0
    14
    1.1k
    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
      Helper
      last edited by

      On 16/11/2013 at 06:06, xxxxxxxx wrote:

      If I remember correctly, this will need to be handled by a SceneHook plugin.  Override the Message() method and check for these (as needed) :

      MSG_DESCRIPTION_CHECKDRAGANDDROP ``MSG_MATERIALDRAGANDDROP ``MSG_DRAGANDDROP

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

        On 16/11/2013 at 11:25, xxxxxxxx wrote:

        I was curious about this. So I gave it a try myself.
        But I can't get the messages to fire in my SceenHook plugin for some reason.
        What else is needed for a message to execute?

        Bool MySceneHook::Message(GeListNode *node, LONG type, void *data)  
        {  
          BaseDocument *doc = GetActiveDocument();  
          BaseObject *obj = doc->GetFirstObject();  
          if(!obj) return FALSE;  
          
          MaterialDragAndDrop mdd;                 //Create an instance of the MaterialDragAndDrop struct (class)  
          mdd.op = obj;                            //Point to this object  
          //if(mdd.op) GePrint(mdd.op->GetName()); //works..But prints all the time. Not just when dropping a material on the obj  
          
          if(type == MSG_MATERIALDRAGANDDROP)  
          {  
              GePrint(mdd.op->GetName());         //<---Not working! :-(  
          }  
          
          if(type == MSG_DESCRIPTION_CHECKDRAGANDDROP)  
          {  
              GePrint(mdd.op->GetName());         //<---Not working! :-(  
          }  
          
          if(type == MSG_DRAGANDDROP)  
          {  
              GePrint(mdd.op->GetName());         //<---Not working! :-(  
          }  
          
          
          return TRUE;  
        }
        

        -ScottA

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

          On 17/11/2013 at 06:05, xxxxxxxx wrote:

          If that is the case, then these might only be sent to a recipient plugin 'object' (checking in its Message() method).  That would mean there is no way to handle general drag-and-drop as the op intends.

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

            On 17/11/2013 at 10:01, xxxxxxxx wrote:

            Thanks, but it's very annoying to can't do it. I hope any devs can give a hand for that. I have developped a custom browser over GeUserArea but i cannot drag&drop; materials from to any where.

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

              On 17/11/2013 at 10:05, xxxxxxxx wrote:

              i forgot to say, as you know GeUserArea can detect the dropped materials...
              this for getting:

                case BFM_DRAGRECEIVE:
              
              
                       {
              
              
                          String string, str;
              
              
                          LONG type = 0;
              
              
                          void \*object = NULL;
              
              
                          C4DAtomGoal \*bl = NULL;
              
              
                
              
              
              
                          GetDragObject(msg,&type,&object);
              
              
                
              
              
              
                          if (type==DRAGTYPE_ATOMARRAY && ((AtomArray\* )object)->GetCount()==1 && ((AtomArray\* )object)->GetIndex(0))
              
              
                          {
              
              
                              bl = (C4DAtomGoal\* )((AtomArray\* )object)->GetIndex(0);
              
              
                     
              
              
                              if (bl->IsInstanceOf(Mmaterial))
              
              
                              {
              
              
                                  str += "Mmaterial";
              
              
                              }
              
              
                          }
              
              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                On 17/11/2013 at 11:07, xxxxxxxx wrote:

                ^Thanks for posting that code khor.
                I didn't have that one in my notes.

                -ScottA

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

                  On 17/11/2013 at 13:03, xxxxxxxx wrote:

                  you're welcome. If it helps i can completed last part as:

                           case BFM_DRAGRECEIVE:
                  
                  
                           {
                  
                  
                              String string, str;
                  
                  
                              LONG type = 0;
                  
                  
                              void \*object = NULL;
                  
                  
                              C4DAtomGoal \*bl = NULL;
                  
                  
                    
                  
                  
                  
                              GetDragObject(msg,&type,&object);
                  
                  
                    
                  
                  
                  
                              if (type==DRAGTYPE_ATOMARRAY && ((AtomArray\* )object)->GetCount()==1 && ((AtomArray\* )object)->GetIndex(0))
                  
                  
                              {
                  
                  
                                  bl = (C4DAtomGoal\* )((AtomArray\* )object)->GetIndex(0);
                  
                  
                                  if (bl->IsInstanceOf(Mmaterial))
                  
                  
                                  {
                  
                  
                                      str += "Mmaterial";
                  
                  
                                  }
                  
                  
                              }
                  
                  
                              else
                  
                  
                                  str = str+"unknown object";
                  
                  
                    
                  
                  
                  
                              if (msg.GetLong(BFM_DRAG_FINISHED))  info("Dropped..."+str);
                  
                  
                    
                  
                  
                  
                               return SetDragDestination(MOUSE_POINT_HAND);
                  
                  
                               break;
                  
                  
                           }
                  
                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    On 17/11/2013 at 13:54, xxxxxxxx wrote:

                    Thanks again.

                    That handles dragging things ** to** the UA nicely.
                    Now we just need someone to post how to handle dragging from the UA.

                    -ScottA

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

                      On 18/11/2013 at 15:40, xxxxxxxx wrote:

                      i found a hacked way for drag from a GeUserArea to another  GeUserArea. I'm testing now .
                      But still really need help for native method

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

                        On 23/03/2015 at 02:45, xxxxxxxx wrote:

                        Hello khor, did you find a solution to start a drag from a User Area? I need to do this as well, and I
                        have doubts it will be possible from Python if even from C++. 😢

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

                          On 23/03/2015 at 07:59, xxxxxxxx wrote:

                          Hi,

                          I'm not sure I'm getting this right, but in order to start a mouse drag from a GeUserArea you simply call HandleMouseDrag from GeUserArea class.
                          I don't think the function exists in Python. Or if it does, it's at least undocumented.

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

                            On 23/03/2015 at 08:12, xxxxxxxx wrote:

                            Hi Andreas,

                            thanks, seems like I missed this method. Maybe I can work around this method missing from
                            with a C++ Plugin somehow.

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

                              On 23/03/2015 at 08:22, xxxxxxxx wrote:

                              Just verified, HandleMouseDrag is not available in Python.

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