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

    Python - Set Take render state

    Cinema 4D SDK
    python
    2
    4
    548
    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.
    • J
      j_vogel
      last edited by

      Just wondering if/how I could set the render state of a take which I create with python:
      571b4880-6f3d-47a8-b931-35e47db628de-image.png

      Is it possible to set it to enabled somehow? Did not find anything in the documentation.

      1 Reply Last reply Reply Quote 0
      • J
        j_vogel
        last edited by j_vogel

        Okay I searched for the wrong terms I think. I found it:

        TakeName.SetChecked(True)
        
        ferdinandF 1 Reply Last reply Reply Quote 0
        • ferdinandF
          ferdinand @j_vogel
          last edited by

          Hey @j_vogel,

          thank you for reaching out to us. Yes, that is how you do it. Please remember to consolidate your posting in the future (you should edit your initial posting until we have answered).

          Cheers,
          Ferdinand

          Result

          Code

          """Demonstrates how to iterate over takes and toggle their state.
          
          This example requires Cinema 4D 2025.0 or higher.
          """
          import c4d
          import mxutils
          
          from c4d.modules.takesystem import TakeData, BaseTake
          
          doc: c4d.documents.BaseDocument  # The currently active document.
          op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.
          
          def main() -> None:
              """Called by Cinema 4D when the script is being executed.
              """
              data: TakeData = mxutils.CheckType(doc.GetTakeData())
              root: BaseTake = data.GetMainTake()
              take: BaseTake
          
              for take in mxutils.IterateTree(root):
                  old: bool = take.IsChecked()
                  take.SetChecked(not old)
                  print(f"Take: {take.GetName()}, Old State: {old}, New State: {not old}")
          
              c4d.EventAdd()
          
          if __name__ == '__main__':
              main()
          

          MAXON SDK Specialist
          developers.maxon.net

          J 1 Reply Last reply Reply Quote 1
          • J
            j_vogel @ferdinand
            last edited by

            @ferdinand Okay I will do it in the future. Thanks for the code snippet, always helps to learn!

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