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
    • Recent
    • Tags
    • Users
    • Login

    Accessing buttons on a pop up dialog

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 206 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

      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.

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

        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.

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