LINK gizmo in a DIALOG can't have an ACCEPT?



  • On 28/07/2016 at 00:43, xxxxxxxx wrote:

    When I try do add an ACCEPT parameter to a LINK element in a DIALOG (not a CONTAINER), I get an error.
    Isn't it possible to add an ACCEPT filter for LINK elements in DIALOG resources?



  • On 28/07/2016 at 01:41, xxxxxxxx wrote:

    Hello,

    could you please share your resource file and report what exact error you get?

    Bet wishes,
    Sebastian



  • On 28/07/2016 at 02:25, xxxxxxxx wrote:

    I will share, as soon as I get back home, later today.



  • On 28/07/2016 at 14:54, xxxxxxxx wrote:

    Here is the error:

    And my dialog resource is this one:

    DIALOG render_dynamicirr_dl
    {
         NAME IDS_DIALOG; CENTER_V; SCALE_H; FIT_H;

    GROUP IDC_STATIC
              {
                   ALIGN_TOP; SCALE_H;
                    BORDERSTYLE BORDER_THIN_IN; BORDERSIZE 4, 4, 4, 4;
                   COLUMNS 4;

    STATICTEXT RDIRR_LINK_TEXT { NAME RDIRR_LINK_TEXT; CENTER_V; ALIGN_LEFT; }

    LINK RDIRR_LINK
                   {
                   SCALE_H;
                   FIT_H;
                   ACCEPT { 1037745; }

    }

    BUTTON RDIRR_CANCEL { NAME RDIRR_CANCEL_TEXT; SIZE 0,16; }
                   BUTTON RDIRR_RENDER { NAME RDIRR_RENDER_TEXT; SIZE 0,16; }
              }

    GROUP IDC_STATIC
              {
                   ALIGN_TOP; SCALE_H; FIT_H;
                   BORDERSTYLE BORDER_THIN_IN; BORDERSIZE 4, 4, 4, 4;
                   COLUMNS 2;

    BUTTON RDIRR_PV { NAME RDIRR_RS_TEXT; SCALE_H; SIZE 0,12; }
                   BUTTON RDIRR_RS { NAME RDIRR_PV_TEXT; SCALE_H; SIZE 0,12; }
              }

    }



  • On 29/07/2016 at 01:01, xxxxxxxx wrote:

    Hello,

    indeed, there is no "ACCEPT" argument for a LinkBox custom GUI element. This is because the check if a certain element can be handled by a given link parameter is not done by the GUI element but by the system handling and displaying parameters.

    So only link parameters in parameter descriptions can automatically handle this, in a Gedialog you would have to handle this yourself.

    Best wishes,
    Sebastian



  • On 29/07/2016 at 02:13, xxxxxxxx wrote:

    Ok... so, where and how should I manage that? Inside the dialog Message method?



  • On 29/07/2016 at 09:16, xxxxxxxx wrote:

    Hello,

    you could react in the Command() function when the value of the link has chaged. Then you could test the new value and set it back if it does not fit your needs.

    Or you could catch the whole drag and drop operation in the Message() function. Then you could decide if you allow the drag and drop onto the link or not.

    Best wishes,
    Sebastian



  • On 31/07/2016 at 05:34, xxxxxxxx wrote:

    I was trying to implement that in the Message method but I can't seem to do so :-(
    It should start with:

    if msg.GetId() == c4d.MSG_DESCRIPTION_CHECKDRAGANDDROP:

    But after that, I can't understand what I must do.



  • On 31/07/2016 at 07:06, xxxxxxxx wrote:

    AFAIK you can't. Because it's not supported in Python.

    Here is how to do it in C++. But there is no msg.GetVoid() equivalent in Python that I know of.

    LONG myDialog::Message(const BaseContainer &msg, BaseContainer &result)  
    {  
      switch(msg.GetId())  
      {  
          case MSG_DESCRIPTION_CHECKDRAGANDDROP:  
          {              
              //This only accepts a polygon type object  
      
              Bool *accept = (Bool* )msg.GetVoid(LINKBOX_ACCEPT_MESSAGE_ACCEPT, nullptr);  
              PolygonObject *pObj = (PolygonObject* )msg.GetVoid(LINKBOX_ACCEPT_MESSAGE_ELEMENT);  
              if (accept && pObj) *accept = pObj->IsInstanceOf(Opolygon);  
      
          }break;  
      
      return GeDialog::Message(msg,result);  
    }
    

    So you will probably need to do it in the .pyp file. And not in the .res file.

        def CreateLayout(self) :  
      
          res = self.LoadDialogResource(ResBasedMenu)    #Loads GUI stuff from the .res file  
      
          #A linkbox gizmo created here in the code(not in the .res file)  
          acceptedObjs = c4d.BaseContainer()  
          acceptedObjs.InsData(c4d.Obase, "")   #accept all objects (change as desired)  
          acceptedObjs.InsData(c4d.Tbase, "")   #accept all  tags (change as desired)  
          lbsettings = c4d.BaseContainer()  
          lbsettings.SetData(c4d.DESC_ACCEPT, acceptedObjs)   
          self.lb = self.AddCustomGui(LINKBOX, c4d.CUSTOMGUI_LINKBOX, "", c4d.BFH_SCALEFIT|c4d.BFV_CENTER, 0, 0, lbsettings)  
      
          return res
    

    -ScottA



  • On 01/08/2016 at 00:23, xxxxxxxx wrote:

    Hello,

    with "catch the whole drag and drop operation" I meant handling the message BFM_DRAGRECEIVE.

    Best wishes,
    Sebastian



  • On 01/08/2016 at 11:04, xxxxxxxx wrote:

    Well, I did try it.
    Now it detects when I'm dragging into the whole window, not just to the LINK gizmo :-(
    I tried with MSG_DESCRIPTION_CHECKDRAGANDDROP and it only fires up with something being dragged into the LINK gizmo, like I want.
    But I can't figure out how can I check the type of the object being dragged.
    Any info on that?



  • On 02/08/2016 at 00:34, xxxxxxxx wrote:

    Hello,

    catching BFM_DRAGRECEIVE is about catching all drag and drop operations onto a GeDialog. This way you can check if a certain drag and drop operation onto a specific widget is allowed.

    With CheckDropArea() you can check if the drag operation is over a certain gadget, with GetDragObject() you can get the dragged elements. (Unfortunately these functions are currently not documented in the Python SDK).

    For questions no longer related to the original topic (which was about resource files) please open a new thread. Thanks.

    Best wishes,
    Sebastian



  • On 02/08/2016 at 02:31, xxxxxxxx wrote:

    Ok, thank you.
    I will start a new one


Log in to reply