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

    Get Main Thread [SOLVED]

    SDK Help
    0
    4
    439
    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 09/01/2017 at 00:33, xxxxxxxx wrote:

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

      ---------
      Hello.

      Is there any call that will allow me to get Active thread as I do with GetActiveDocument ?
      Is it safe to use it to process something  from a non-main thread?

      Example: Run BakeTexture(...) using the main thread from a non-main thread.

      Thank you.

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

        On 09/01/2017 at 04:27, xxxxxxxx wrote:

        Hi Peterakos, thanks for writing us.

        With reference to your first question, there are a few utility calls that might be worth looking to obtain certain threads:

        • GeGetCurrentThreadId(): returns the unique ID for the current thread;
        • GeGetCurrentThread(): returns the current BaseThread. This BaseThread can be passed to functions that require a BaseThread argument to check for stop conditions;
        • GeGetDummyThread(): returns a dummy thread. This may be used when a BaseThread argument must be set;
        • GeGetEscTestThread(): returns a thread for escape key testing. This may be used when a BaseThread argument must be set.

        With reference to your second question, well I'd say it strongly depends on what you expect to process so better circumstancing your question will be helpful. In BakeTexture, for example, passing the object returned by the GeGetEscTestThread() will provide you with some helpful means to interrupt the baking computation by pressing Esc.

        Best, Riccardo

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

          On 10/01/2017 at 07:27, xxxxxxxx wrote:

          Hello and thank you very much for this information.

          I assume it's safe to use GeGetCurrentThread() as thread parameter in BakeTexture, if we want the current thread to be blocked until the texture baking is done right ?

          Thank you very much.

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

            On 11/01/2017 at 07:55, xxxxxxxx wrote:

            Hi Peterakos,

            the BaseThread object to be passed as parameter in the BakeTexture() is used to test for a break and should be the returned from GeGetEscThread which actually helps quitting the texture baking process prematurely by pressing Esc button.

            Best, Riccardo

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