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

    threading with GeUserArea

    SDK Help
    0
    3
    337
    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
      Helper
      last edited by

      On 29/12/2015 at 06:15, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   15+ 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      I got a GeUserArea with heavy calculations, what I want is to put these calculations in a thread.
      now the main questions:
      1- is it safe to use a thread inside GeUserArea::InputEvent() function? this thread will call functions like GetInputState() , etc...

      2- is it safe to call SendParentMessage(action) from a thread?

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

        On 29/12/2015 at 08:06, xxxxxxxx wrote:

        1. Yes, you can start a thread in InputEvent(). But that thread can not call GetInputState().
        2. No, all GUI related functions are restricted to the main thread. I think it would be possible
        to use SendParentMessage() to send custom messages to a dialog even from a thread, but you
        probably want to trigger a GUI message (eg. BFM_ACTION).

        You should implement synchronized data exchange between your User Area and your thread (and
        of course the User Area should also synchronize it when reading the data). You can use EventAdd()
        or SpecialEventAdd() from a thread to queue a message and eventually receive it very soon in the
        main thread to update your GUI.

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

          On 30/12/2015 at 10:22, xxxxxxxx wrote:

          thanks Niklas, I will handle it.

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