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 and drop to UserArea

    SDK Help
    0
    2
    431
    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 25/12/2017 at 01:22, xxxxxxxx wrote:

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

      ---------
      How can I get an animatable parameter by drag and drop?
      The Object Manager object was created by adding LinkBoxGUI with AddCustomGui.
      Is there a drag-and-drop correspondence GUI for the parameter?
      Since I was not able to make LinkBox remodeling because it was difficult, I wanted to create it using user area drag and drop, but I saw the sample file of SDK manual and AsyncTest and made it for the same, but I understood how to receive the message did not.

        
      #pragma once   
      #include "c4d.h"   
      #include "c4d_commanddata.h"   
      #include "c4d_gui.h"   
        
      #define IDS_UserAreaTest 1000001   
        
      Bool RegisterUserAreaTest(void);   
        
      Bool PluginStart(void)   
      {   
           if (!RegisterUserAreaTest())   
                return false;   
           return true;   
      }   
        
      void PluginEnd(void)   
      {   
      }   
        
      Bool PluginMessage(Int32 id, void* data)   
      {   
           switch (id)   
           {   
                case C4DPL_INIT_SYS:   
                     return true;   
                case C4DMSG_PRIORITY:   
                     return true;   
                case C4DPL_BUILDMENU:   
                     break;   
                case C4DPL_COMMANDLINEARGS:   
                     break;   
                case C4DPL_EDITIMAGE:   
                     return false;   
           }   
           return false;   
      }   
        
      class UserAreaLinkBox : public GeUserArea   
      {   
      public:   
           virtual Bool GetMinSize(Int32& w, Int32& h);   
           virtual void DrawMsg(Int32 x1, Int32 y1, Int32 x2, Int32 y2, const BaseContainer& msg);   
      };   
        
      Bool UserAreaLinkBox::GetMinSize(Int32& w, Int32& h)   
      {   
           w = 100;   
           h = 20;   
           return true;   
      }   
        
      void UserAreaLinkBox::DrawMsg(Int32 x1, Int32 y1, Int32 x2, Int32 y2, const BaseContainer& msg)   
      {   
           this->OffScreenOn();   
           this->DrawSetPen(Vector(110, 110, 0));   
           this->DrawRectangle(x1 + 2, y1 + 2, x2 - 2, y2 - 2);   
      }   
        
      class UserAreaTestDialog : public GeDialog   
      {   
      public:   
           virtual Bool CreateLayout();   
           virtual Int32 Message( const BaseContainer& msg, BaseContainer& result );   
           virtual Bool CoreMessage( Int32 id, const BaseContainer &msg; );   
           void Update();   
           UserAreaLinkBox ua;   
      };   
        
      Bool UserAreaTestDialog::CreateLayout()   
      {   
           SetTitle( "UserAreaTest" );   
           Update();   
           return true;   
      }   
        
      Int32 UserAreaTestDialog::Message( const BaseContainer& msg, BaseContainer& result )   
      {   
           switch (msg.GetId())   
           {   
                case BFM_DRAGRECEIVE:   
                     if (msg.GetInt32(BFM_DRAG_LOST))   
                     {   
                          GePrint("BFM_DRAG_LOST");   
                     }   
        
                     if (msg.GetInt32(BFM_DRAG_FINISHED))   
                     {   
                          GePrint("BFM_DRAG_FINISHED");   
                     }   
        
                     if (CheckDropArea(200, msg, true, true))   
                     {   
                          GePrint("CheckDropArea");   
                     }   
                     break;   
                default:   
                     break;   
           }   
           return GeDialog::Message( msg, result );   
      }   
        
      void UserAreaTestDialog::Update()   
      {   
           LayoutFlushGroup(100);   
           FreeChildren(100);   
           GroupBegin(100, BFH_SCALEFIT, 1, 1, "", BFV_BORDERGROUP_FOLD_OPEN, 0);   
           {   
                C4DGadget* c4dgadget = AddUserArea(200, BFH_SCALEFIT, 100, 20);   
                if (c4dgadget)   
                     AttachUserArea(ua, 200);   
           }   
           GroupEnd();   
           LayoutChanged(100);   
      }   
        
      Bool UserAreaTestDialog::CoreMessage( Int32 id, const BaseContainer &msg; )   
      {   
           switch( id )   
           {   
                case EVMSG_CHANGE:   
                     Update();   
                     break;   
           }   
           return GeDialog::CoreMessage( id, msg );   
      };   
        
      class UserAreaTest : public CommandData   
      {   
           INSTANCEOF( UserAreaTest, CommandData )   
      public:   
           virtual Bool Execute( BaseDocument* doc );   
           virtual Bool RestoreLayout( void* secret );   
           static UserAreaTest* Alloc() { return NewObjClear( UserAreaTest ); }   
      private:   
           UserAreaTestDialog _dialog;   
      };   
        
      Bool UserAreaTest::Execute( BaseDocument* doc )   
      {   
           if( _dialog.IsOpen() == false )   
                _dialog.Open( DLG_TYPE_ASYNC, IDS_UserAreaTest, -1, -1, 400, 400 );   
           return true;   
      }   
        
      Bool UserAreaTest::RestoreLayout( void* secret )   
      {   
           return _dialog.RestoreLayout( IDS_UserAreaTest, 0, secret );   
      }   
        
      Bool RegisterUserAreaTest( void )   
      {   
           return RegisterCommandPlugin( IDS_UserAreaTest, String( "UserAreaTest" ), 0, nullptr, String( "UserAreaTest" ), UserAreaTest::Alloc() );   
      }   
        
      

      GePrint ("BFM_DRAG_LOST");
      GePrint ("BFM_DRAG_FINISHED");
      Please tell me how to get to.
      Or please tell me if there is better usage.

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

        On 26/12/2017 at 00:06, xxxxxxxx wrote:

        I have now seen the fact of shock.
        I accidentally saw this forum with a different personal computer.
        When searching using the keyword of drag, the same question hit a lot.
        I noticed the cause was investigated.
        When this forum is logged in, the search result is greatly reduced.
        Why is this forum constantly watching nearly 100 people. I was concerned that there was only one or two people logging in.
        I will not be able to recover for the time being.

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