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

    Adding a "Link" object to dialog

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 280 Views
    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 Offline
      Helper
      last edited by

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

      On 19/11/2012 at 19:32, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:    Mac  ;  
      Language(s) :     C++  ;

      ---------
      Hello

      I am slowly working my way through C++ the C4D way. 
      Working on MacOS 10.6 under XCode 4.5. So all my experiments are based on cinema4dsdk and other examples I have found here and elsewhere.

      My question is:
      How do I add a "LINK" field to a dialog?

      Looking at some code from the NoskeWiki below all gadgets are created with "Add..." but going through the documentation I can't find any info on how to add a LINK to a dialog. I know how to put a LINK in a .res file but then have not been successful yet to actually use the data from a res file in a command/tool plugin. I did it in a Expression Plugin. Sorry, this is probably a real rookie question.....

        virtual Bool CreateLayout(void)
        {
          this->SetTitle( "Object Converter" );
       
          LONG SC_VH = BFH_SCALEFIT | BFV_SCALEFIT;
       
          GroupBorderSpace( 10, 10, 10, 10 );
          GroupSpace(5,5);
       
          AddStaticText   (DLG_LBL1, BFH_LEFT,0,0, "This plugin helps ready, clean and reduce models for export to programs ", BORDER_NONE);
          AddStaticText   (DLG_LBL2, BFH_LEFT,0,0, "like Unity. Click 'Help' for more info.", BORDER_NONE);
          AddStaticText   (DLG_LBL3, BFH_LEFT,0,0, "", BORDER_NONE);
       
          GroupBegin( DLG_GRP2,SC_VH,2,0,"actions based on object names:",BFV_GRIDGROUP_EQUALROWS );
       
            GroupBorder(BORDER_WITH_TITLE|BORDER_THIN_IN);
            GroupBorderSpace( 5, 5, 5, 5 );
            GroupSpace(3,3);
       
            //AddSeparatorH   (SC_VH);
            //AddSeparatorH   (SC_VH);
       
            AddStaticText   (DLG_LBL4, BFH_LEFT,100,0,"action:", BORDER_NONE);
            AddStaticText   (DLG_LBL5, BFH_LEFT,30,0,"text", BORDER_NONE);
       
            AddCheckbox     (DLG_CHK_DEL1,   SC_VH,100,0,"delete objects containing:");
            AddEditText     (DLG_EDIT_DEL1STR, SC_VH,30,0);
       
            AddCheckbox     (DLG_CHK_TURNON,  SC_VH,0,0,"make visible objects \" \" \" \" \" \" \" \":");
            AddEditText     (DLG_EDIT_TURNONSTR,SC_VH,0,0);
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 19/11/2012 at 23:25, xxxxxxxx wrote:

        // As a member of your class, for instance  
        LinkBoxGui*    myLinkBox =    NULL;  
          
        // In GeDialog.CreateLayout()  
        BaseContainer    tbc;  
        tbc.SetBool(LINKBOX_HIDE_ICON,        FALSE);  
        myLinkBox =    (LinkBoxGui* )AddCustomGui(MY_LINK_BOX_ID,CUSTOMGUI_LINKBOX,String(),BFH_SCALEFIT|BFV_SCALEFIT,0L,0L,tbc);  
        if (!myLinkBox)        return FALSE;  
          
        // GeDialog.Message  
        //*---------------------------------------------------------------------------*  
        LONG IPPDialog::Message(const BaseContainer& msg, BaseContainer& result)  
        //*---------------------------------------------------------------------------*  
        {  
          //GePrint(BaseContainerToString(msg));  
          LONG    mid =    msg.GetId();  
          if        (mid == BFM_DRAGRECEIVE)        return Msg_DragReceive(msg, result);  
          // ...  
          return GeDialog::Message(msg, result);  
        }  
        // IPPDialog.Msg_DragReceive - BFM_DRAGRECEIVE  
        // - How to verify and accept what is being dropped into the LinkBox  
        //*---------------------------------------------------------------------------*  
        LONG IPPDialog::Msg_DragReceive(const BaseContainer& msg, BaseContainer& result)  
        //*---------------------------------------------------------------------------*  
        {  
          // LinkBox  
          if (!CheckDropArea(MY_LINK_BOX_ID, msg, TRUE, TRUE))    return GeDialog::Message(msg, result);  
          if (msg.GetLong(BFM_DRAG_LOST))                            return GeDialog::Message(msg, result);  
          
          LONG        cursor =    MOUSE_POINT_HAND;  
          LONG        type =        0L;  
          void*        object =    NULL;  
          BaseObject*    op =        NULL;  
          
          GetDragObject(msg, &type, &object);  
          
          if ((type == DRAGTYPE_ATOMARRAY) && (((AtomArray* )object)->GetCount() == 1L) && ((AtomArray* )object)->GetIndex(0))  
          {  
              op =    (BaseObject* )((AtomArray* )object)->GetIndex(0L);  
              // Add whatever restrictions here (such as only allowing Spline objects, for instance)  
              if (op->IsInstanceOf(Obase))    cursor = MOUSE_INSERTCOPY;  
              else  
              {  
                  cursor =        MOUSE_FORBIDDEN;  
                  op =            NULL;  
              }  
          }  
          
          if (msg.GetLong(BFM_DRAG_FINISHED))        myLinkBox->SetLink(op);  
          
          return SetDragDestination(cursor);  
        }
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 26/11/2012 at 18:48, xxxxxxxx wrote:

          Thanks for posting this code!

          Sorry I am a bit late. Was out of town over Thanksgiving.
          I'll try this out later tonight.

          Peter

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