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

    Non blocking modal

    Cinema 4D SDK
    c++
    2
    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.
    • rsodreR
      rsodre
      last edited by

      Hi,

      I need to make a modal dialog with progress bar to keep the user waiting while I skip some frames to do some calculations and go back to the starting frame.

      Modal dialogs will block C4D's main thread, so I cannot change the document.
      Async dialogs allows the user to interact with the document, potentially ruining the process.

      What can be done here?
      Can I prevent the user from altering the document with an async modal?

      Thanks,
      Roger

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

        Hi @rsodre this is the purpose of modal dialogs and should be the only way to go if you want to prevent any interactions from the user.

        Now regarding your issue, note, when a modal dialog is displayed some refresh mechanics in C4D are paused, like the update of the UI (viewport, OM).
        So you can directly do the logic within your dialog which is within the main thread.
        Then add a timer to check when the Dialog is closed and then add an Event. To do so in the Timer check if the dialog is not open with IsOpen and then call EventAdd.

        Another solution if you don't want to have the whole logic within your Dialog. Is to either add a SpecialEventAdd from your Dialog and catch this Core Message into another plugin and do the stuff in this plugin or call ExecuteOnMainThread.

        If you have any question, please let me know.
        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        rsodreR 1 Reply Last reply Reply Quote 0
        • rsodreR
          rsodre @m_adam
          last edited by

          @m_adam I think that will not be possible for what I want to do.

          I ended up catching BFM_LOSTFOCUS in the dialog, canceling the process.

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