Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Can't detect Drag finish

    SDK Help
    0
    24
    15.5k
    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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 02/04/2003 at 16:04, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   8.100 
      Platform:    Mac  ;  
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      I always get nil when reading

      msg->GetData(BFM_DRAG_FINISHED)

      Is it broken? This way I can't determine if a user released the mouse. Thank you very much in advance for any help.

      Rui Batista

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 03/04/2003 at 01:03, xxxxxxxx wrote:

        Hi Rui,
        here is an old message method of one of my old COFFEE Plugins, this did work, don´t know if it still works but it should:
        MyDialog::Message(msg)
        {
        var doc = GetActiveDocument(),op;
         
         if(msg->GetId() == BFM_DRAGRECEIVE) 
         {
          
          if(CheckDropArea(FIND, msg, TRUE, TRUE))
          {
           
           if (msg->GetData(BFM_DRAG_FINISHED))
           {
           
           fobj= GetDragObject(msg);
           SetString(FIND, fobj->GetName());
           
           return TRUE;
           }
           op = GetActiveObject(doc);
           SetString(FIND,stradd("Insert ",op->GetName()));
           return SetDragDestination(MOUSE_POINT_HAND);
          }
          
          else SetString(FIND," ");
         }
         return super::Message(msg);
        }
        FIND is an id for a statictext field.
        Best
        Samir

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 03/04/2003 at 01:14, xxxxxxxx wrote:

          Thank you Samir. I'm going to try it. Just one question. Does it only work with static text fields? Doesn't it work with edit fields too?

          Rui Batista

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 03/04/2003 at 01:20, xxxxxxxx wrote:

            never tried. But could work I guess. Try it out 🙂

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 03/04/2003 at 01:43, xxxxxxxx wrote:

              It doesn't work Samir 😞
              Check ou the comments I included in the code.

                
              if(msg->GetId()==BFM_DRAGRECEIVE)  
                   {  
                        if (CheckDropArea(FIND_MAT_TXT1,msg,TRUE,TRUE))  
                        {  
                             if (msg->GetData(BFM_DRAG_FINISHED))  
                             {  
                                  dropped = GetDragObject(msg);  
                                  SetString(FIND_MAT_TXT1, dropped->GetName());  
                                  println("***"); // This never gets printed  
                                  return TRUE;  
                             }  
                          return SetDragDestination(MOUSE_POINT_HAND); //this is not even accepted by C4D. It returns "Expression expected"  
                        }  
                   }  
              return super::Message(msg);  
              }  
              

              Maybe something changed in the SDK. For the guys who did the changes in the latest SDK, how can I detect that a user released the mouse inside some gadget?

              Rui Batista

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 03/04/2003 at 02:45, xxxxxxxx wrote:

                Hi,
                it does work fine for me. Even with an edittext field. Here is an example plugin. it works without any problems in c4d 8.1:
                Just copy this code into a cof file.

                    
                    
                    var PLUGIN_ID = 1010111;
                    
                    
                    
                    
                    class MyDialog : GeDialog  
                    {  
                     public:  
                      MyDialog();  
                      CreateLayout();  
                      Message(msg);  
                    }
                    
                    
                    
                    
                    MyDialog::MyDialog()  
                     {  
                      super(PLUGIN_ID);  
                     }
                    
                    
                    
                    
                    enum  
                    {  
                     DRAG_TEST=1000  
                    }
                    
                    
                    
                    
                    MyDialog::CreateLayout()  
                    {  
                     AddEditText(DRAG_TEST , BFH_SCALE, 200, 0);  
                     return TRUE;  
                    }  
                    var obj;  
                    MyDialog::Message(msg)  
                    {  
                     if(msg->GetId() == BFM_DRAGRECEIVE)    
                     {  
                      if(CheckDropArea(DRAG_TEST, msg, TRUE, TRUE))  
                      {  
                       obj= GetDragObject(msg);  
                       SetString(DRAG_TEST, obj->GetName());  
                       SetDragDestination(MOUSE_POINT_HAND);  
                       return TRUE;
                    
                    
                    
                    
                      }  
                     }  
                     return super::Message(msg);  
                    }
                    
                    
                    
                    
                    class MyMenuPlugin : MenuPlugin  
                    {  
                     public:  
                      MyMenuPlugin();  
                      GetID();  
                      GetName();  
                      GetHelp();  
                      Execute(doc);  
                      RestoreLayout(secret);  
                    }
                    
                    
                    
                    
                    MyMenuPlugin::MyMenuPlugin() { super(); }  
                    MyMenuPlugin::GetID() { return PLUGIN_ID; }  
                    MyMenuPlugin::GetName() { return "Drag"; }  
                    MyMenuPlugin::GetHelp() { return "Drag"; }
                    
                    
                    
                    
                    var d;  
                    MyMenuPlugin::Execute(doc)  
                    {  
                     d->Open(TRUE,-1,-1);  
                    }  
                    MyMenuPlugin::RestoreLayout(secret)  
                    {  
                     if (!d) d = new(MyDialog);  
                     d->RestoreLayout(secret);  
                    }
                    
                    
                    
                    
                    main()  
                    {  
                     d = new(MyDialog);  
                     Register(MyMenuPlugin);  
                    }
                

                Best
                Samir

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 03/04/2003 at 02:59, xxxxxxxx wrote:

                  The console prints out "Expression already defined" at line 7 😞

                  Rui Batista

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 03/04/2003 at 03:04, xxxxxxxx wrote:

                    Then you have made something wrong or the copy & paste didn´t work correctly. It works here without problems. So it should work for you either.

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

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 03/04/2003 at 03:18, xxxxxxxx wrote:

                      I copied it again and still gives me the same error. I sent you the plug to your mail account in FC. Check it out. Thank you, Samir.

                      Rui Batista

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

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 03/04/2003 at 04:51, xxxxxxxx wrote:

                        I can do it now, but I have another problem. Since you are being so helpful, could you give me just a little more help, Samir? 🙂
                        Check this out:

                          
                        if (instanceof(dropped,BaseTag))  
                                       {  
                                       if(dropped->GetType() == 5616)  
                                            {  
                                            drop_find=dropped->GetMaterial();  
                                            println(drop_find->GetName());  
                        ...  
                        

                        I assumed that this was the way to get the name of the material that sits inside the Material Tag. But I get a Member not Found at the println line.
                        What am I doing wrong?
                        Thank you very much in advence.

                        Rui Batista

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

                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                          On 03/04/2003 at 06:04, xxxxxxxx wrote:

                          Hi,
                          GetMaterial will return a Marker and not an object. You will have to go through all Materials and compare the material marker with the returned marker. If they are the same you can use that found material. Afaik there is no other way in COFFEE yet.
                          Best
                          Samir

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

                            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                            On 03/04/2003 at 06:16, xxxxxxxx wrote:

                            Oh, ok... COFFEE really needs to evolve a bit more.
                            Will do that. Thank you, Samir.

                            Rui Batista

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

                              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                              On 03/04/2003 at 06:36, xxxxxxxx wrote:

                              Know what? It's not working 😞
                              I did the following:

                                
                              matmarker1=dropped->GetMaterial();  
                              mat = doc->GetFirstMaterial();  
                              while(mat&&(matmarker2=mat->GetMarker())!=matmarker1)mat=mat->GetNext();  
                              if(!mat)return FALSE;  
                              

                              But it never finds any match. I read the the dropped->GetMaterial() returns a marker that is only valid at runtime. What could this mean?

                              Rui Batista

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

                                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                On 03/04/2003 at 06:44, xxxxxxxx wrote:

                                what happens if it matches? I don´t see any printouts or anything? How do you know then?
                                Samir

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

                                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                  On 03/04/2003 at 06:57, xxxxxxxx wrote:

                                  I just pasted the code that does the search, Samir. The code that uses the found mat would follow. In fact, it already exists. I just did a println(mat->GetName());
                                  But it never reaches that part of the code.
                                  I even placed a println(dropped); before and I get a different value all the time. Even when keeping the mouse still inside the field I want the tag to be dragged to. It just spits out a list of different values. Like if the value of dropped is changing all the time. (by the way, dropped value is set by dropped = GetDragObject(msg);)
                                  In short, how can I get the name of the material assigned to a specific material tag?

                                  Rui Batista

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

                                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                    On 03/04/2003 at 07:04, xxxxxxxx wrote:

                                    well, you could try to get the material link of the texture tag. Isn´t this possible in COFFEE? The id for the Container ID is 1010 (TEXTURETAG_MATERIAL). You could then use this object (or maybe it´s a string returned) to get the name and use FindMaterial to get the material. But I don´t know if this will work.
                                    Best
                                    Samir

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

                                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                      On 03/04/2003 at 07:14, xxxxxxxx wrote:

                                      Isn't that what matmarker1=dropped->GetMaterial(); does? Getting the material that is assigned to the tag pointed by dropped?
                                      Since dropped passed these two tests:

                                      if (instanceof(dropped,BaseTag))
                                                          {
                                                          if(dropped->GetType() == 5616)

                                      (5616 is the value of TTexture)

                                      I assumed that dropped is a pointer to the texture tag itself. Isn't it?

                                      Rui Batista

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

                                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                        On 03/04/2003 at 07:21, xxxxxxxx wrote:

                                        yes dropped is a pointer to the texture tag, but getmaterial will only give you a marker but not the name of the material. What I told you to do is to get the material name directly out of the TextureTag container but this doesn´t seem to work.
                                        So, the only way spontaneously said to me is the markers.
                                        Best
                                        Samir

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

                                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                          On 03/04/2003 at 07:24, xxxxxxxx wrote:

                                          But hey, it´s long ago I used coffee so maybe there is another way. 🙂

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

                                            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                            On 03/04/2003 at 07:26, xxxxxxxx wrote:

                                            You are being really helpful Samir. Thank you so much.
                                            It's a shame that I'm no programmer and can't make this work 😞
                                            It seemed such a simple thing to do at first. I will start another thread with only this question to see if someone else can also help.

                                            Rui Batista

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