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
    • Register
    • Login
    1. Home
    2. GordOrb
    G
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    GordOrb

    @GordOrb

    0
    Reputation
    1
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    GordOrb Unfollow Follow

    Latest posts made by GordOrb

    • RE: How can I use a render token to indicate the render type?

      Hi @ferdinand,

      Thank you for the introduction and for welcoming me to this forum. Glad to be part of the community.

      In my testing, I found that data[5], data[6], and data[7] were all set at the same time (around the 6th or 7th evaluation), so I don't think I can use that to determine the type of render. This makes me wonder, how is an api user supposed to use those data values in any meaningful way when the render token evaluated before the data is populated?

      I appreciate the code you provided, but I don't think that solves my question either. Please correct me if I'm wrong, but my understanding is that you can kick off a render job that outputs BOTH a regular image and multi-pass images in the same job. The example you gave indicates if multipass is enabled in the render settings, but this will also be true during the job's regular image render (so the regular image filename will incorrectly indicate a multipass render). Please see the attached image for how I expect this to be used.
      Screenshot 2024-02-07 at 12.22.18 PM.png
      Thanks again,
      -G

      posted in Cinema 4D SDK
      G
      GordOrb
    • How can I use a render token to indicate the render type?

      Hi there,
      I've been having trouble with c4d's render tokens. I'm trying to make a token that will change based on the render type (multipass or regular), but the tokens always evaluate to a regular image render, even when I'm not rendering a regular image. See my code here for a further breakdown:

      """Multipass token problem.
      
      Goal is to have a render token that can dynamically change based on the
      current render type (multipass or regular image). What's confusing is that
      tokens are evaluated about 3 times when the project is added to the render
      queue, then an additional 11-14 times during the actual render. The token used
      for multipass renders is the second token that is evaluated during the actual
      render, which occurs before multipass is active. Around the 6th or 7th
      evaluation, multipass becomes active (and this evaluates correctly), but the
      correct multipass token is never used in the file name.
      
      """
      import c4d
      from datetime import datetime
      
      
      # A hypothetical dict with info specific to the render type.
      dynamic_token_dict = {"multipass": "multi", "regular": "reg"}
      
      
      def get_render_type(data) -> str:
          """Supposed to return the render type. Multipass or Regular image.
      
          Returns:
              The render type + the time the token was made.
      
          """
          print("Getting token...")
          print(data[7])  # Pass id for multipass renders or NOTOK if not multipass
          dynamic_token = dynamic_token_dict[
              "regular" if data[7] == c4d.NOTOK else "multipass"
          ]
          now = str(datetime.now())
          print(dynamic_token + now)
          return dynamic_token + now
      
      
      if __name__ == "__main__":
          token_set = set(
              token_dict["_token"]
              for token_dict in c4d.modules.tokensystem.GetAllTokenEntries()
          )
          if "r_type" not in token_set:
              c4d.plugins.RegisterToken(
                  "r_type", "[Render] Type", "reg/multi", get_render_type
              )
      
      

      Is this possible? Also, why do tokens evaluate so many times? Thanks in advance.
      -G

      posted in Cinema 4D SDK r25 python windows
      G
      GordOrb