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

    EventAdd() or how to update?

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 961 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 12/02/2018 at 02:50, xxxxxxxx wrote:

      Hi,
      i have developed a file manager tool in PySide that performs some c4d actions like create a new empty scene.
      When i click i call kill document, but the viewport and the object manager doesnt update until i close my PySide dialog.

      So reading the docs, i decided to call c4d.EventAdd(c4d.EVENT_FORCEREDRAW) to see if that solves the problem... turns out it doesnt.

      I understand my approach is not very orthodox since PySide is not supported natively in Cinema4d but for the moment this is the way i want to go but i presume this shouldnt make any difference to the problem posted.

      so how do i force cinema 4d to update?

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

        On 13/02/2018 at 05:10, xxxxxxxx wrote:

        Hi,

        EventAdd() just posts an event, which will be processed in main thread later on. As long as your seemingly modal dialog blocks the main thread, Cinema 4D can not update (nor do anything else).

        We strongly recommend to make use of Cinema 4D's own dialogs (GeDialog). Not only because we can not support PySide, but also to provide users with a consistent look and feel. And in this case a asynchronous dialog (DLG_TYPE_ASYNC) would probably more appropriate.

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

          On 18/02/2018 at 23:05, xxxxxxxx wrote:

          Hi Andreas,
          Im afraid using GeDialog or Cinema's own builtin GUI library is not an option for me right now.

          Isnt there an option to grab cinema's main thread from another process/app and send events?

          In PyQt we have the option the get a pointer to the main application  via QtWidgets.QApplication.instance(), im looking for something similar in Cinema's Python API..

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

            On 20/02/2018 at 04:48, xxxxxxxx wrote:

            Hi,

            remember your issue is not so much getting Cinema 4D's main thread, but more about blocking Cinema 4D's main thread with your dialog.

            Yes, there are custom events, you can make use of. These are created/sent by SpecialEventAdd() and received either in dialogs in GeDialog.CoreMessage() or MessageData.CoreMessage(). CoreMessage() is then running in the context of Cinema 4D's main thread.

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