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

    Blocking interaction like a modal dialog

    Cinema 4D SDK
    python r20 windows
    2
    4
    919
    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.
    • B
      Boony2000
      last edited by

      Hi everyone!

      I am trying to create a modal dialog with pyside. Is ist possible to lock the interface like a native C4D modal dialog does, so the user can't interact with Cinema until my window is closed?

      Thanks

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

        Hi @Boony2000, unfortunately, we could not provide any support regarding usage of 3rd party module, and I invite you to take a look to the pyside documentation or to ask how a modal dialog can be done in a specialized forum about PySide.

        Regarding about general way for doing a modal function. First of all call StopAllThread, and keep the main thread busy until your dialog which is executed into another thread is closed. See Threading with Python.

        Moreover, you seem to be already aware of but Cinema 4D offers the possibility to open a GeDialog as modal with the flag c4d.DLG_TYPE_MODAL or c4d.DLG_TYPE_MODAL_RESIZEABLE.

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 1
        • B
          Boony2000
          last edited by

          Hi Maxime,

          thank you for your answer. In the mean time as a workaround I built a tiny modal c4d dialog that is hidden behind my actual dialog, thus blocking the interface. I will look into building it with a seperate thread to have a cleaner approach.

          Thanks again

          1 Reply Last reply Reply Quote 0
          • B
            Boony2000
            last edited by

            Just to follow up, what Maxime suggested worked perfectly. No more cheating, basically just

            c4d.StopAllThreads()
            dialogThread.Start()
            dialogThread.Wait(True)
            
            1 Reply Last reply Reply Quote 1
            • First post
              Last post