Accessing buttons on a pop up dialog



  • On 17/09/2015 at 15:28, xxxxxxxx wrote:

    Is it possible to access a button on a dialog from within a python script?

    I have a script controlling the cache object from the X-particles plugin. At one point in the script, I need to click a button on the attributes panel, which I do with

    c4d.CallButton(cache, c4d.XOCA_CACHE_FILL)
    

    This calls up a dialog with several buttons. I can then click any of the buttons with a mouse click manually and the script will resume, but I am wondering if I can access and "click" one of the second set of buttons via python (the Overwrite button).

    I found the string names for the buttons here:

    // C4D-DialogResource
      
    DIALOGSTRINGS IDD_CACHEBUILD
    {
      IDS_BUTTON   "Overwrite";
      IDS_BUTTON1  "New Cache";
      IDS_BUTTON2  "Cancel";
      IDS_DIALOG   "Build Cache";
      IDS_STATIC   "A cache already exists on one or more of the objects.";
      IDS_STATIC1  "Group";
      IDS_STATIC2  "Click 'Overwrite' to overwrite the existing cache, 'New Cache' to create a new cache,";
      IDS_STATIC3  "";
      IDS_STATIC4  "or 'Cancel' to cancel the operation.";
      IDS_STATIC5  "Group";
    }
    

    And found the res file here:

    // C4D-DialogResource
    DIALOG IDD_CACHEBUILD
    {
      NAME IDS_DIALOG; CENTER_V; CENTER_H; 
      
      GROUP IDC_STATIC
      {
        NAME IDS_STATIC1; ALIGN_TOP; SCALE_H; 
        BORDERSTYLE BORDER_NONE; BORDERSIZE 4, 4, 4, 0; 
        COLUMNS 1;
        
        STATICTEXT IDC_STATIC { NAME IDS_STATIC; CENTER_V; ALIGN_LEFT; }
        STATICTEXT IDC_STATIC { NAME IDS_STATIC3; CENTER_V; ALIGN_LEFT; }
        STATICTEXT IDC_STATIC { NAME IDS_STATIC2; CENTER_V; ALIGN_LEFT; }
        STATICTEXT IDC_STATIC { NAME IDS_STATIC4; CENTER_V; ALIGN_LEFT; }
        GROUP IDC_STATIC
        {
          NAME IDS_STATIC5; ALIGN_TOP; CENTER_H; 
          BORDERSTYLE BORDER_NONE; BORDERSIZE 0, 16, 0, 0; 
          COLUMNS 3;
          
          BUTTON IDC_OVERWRITECACHE { NAME IDS_BUTTON; ALIGN_TOP; ALIGN_LEFT; }
          BUTTON IDC_NEWCACHE { NAME IDS_BUTTON1; ALIGN_TOP; ALIGN_LEFT; }
          BUTTON IDC_CANCELCACHE { NAME IDS_BUTTON2; ALIGN_TOP; ALIGN_LEFT; }
        }
      }
    }
    

    But I am not sure how to test for and access the dialog IDD_CACHEBUILD (or if it is even possible due to threading or some other issue) and how to use this information.

    Thanks for any help and comments.



  • On 18/09/2015 at 01:50, xxxxxxxx wrote:

    Hi,

    unfortunately it is not possible to press buttons in GeDialogs from code. Sorry.
    For questions on 3rd party products I'd suggest to contact the 3rd party developers directly.


Log in to reply