Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    pop-up dialog windows and c4dpy : the problem

    Cinema 4D SDK
    3
    3
    716
    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.
    • W
      wob
      last edited by m_adam

      hello, i try to open any type of cinema 4d dialog window with my script via c4dpy (open file, save file dialogs etc) and get nothing. it seems like c4dpy ignores any type of pop-up windows. how can i use usual dialog windows or pop-up dialogs with c4dpy? is there any way to do this?

      thanks!

      1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand
        last edited by

        Hi,

        I always wondered about that too, but from what I understand (this isn't documented anywhere), all Cinema GUI-functionality is off limits in c4dpy. You would have to use one of the gui-frameworks to open a dialog. You could either use Python's native tkinter (Cinema's Python does not include it) or something like qt. In tkinter opening file dialogs is quite straight forward (this is Python 3 code).

        import tkinter
        from tkinter import filedialog
        
        file_names = filedialog.askopenfiles()
        file_object = filedialog.asksaveasfile()
        
        print (file_names)
        print (file_object)
        

        Cheers,
        zipit

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 2
        • M
          m_adam
          last edited by

          Hi @wob unfortunately this is not possible, c4dpy is a regular Cinema 4D executed as command line with the NoGui, and as all NoGui Cinema 4D execution, GeDialog is disabled.

          So its a limitation, and as said by zipit there is no Tkinter shipped with Cinema 4D in order to force people to use Cinema 4D dialog.

          So possible workarounds are:

          • Install pip and install any 3rd party GUI module (but this is not officially supported by Cinema 4D so you may have some odd issues, but it should work).
          • Execute a python script before from a system python installation that will create the Dialog and later execute c4dpy to do the Cinema 4D work.

          Cheers,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

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