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
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. BigRoy
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 8
    • Posts 15
    • Groups 0

    BigRoy

    @BigRoy

    Technical Director at Colorbleed animation studios.

    0
    Reputation
    39
    Profile views
    15
    Posts
    1
    Followers
    0
    Following
    Joined
    Last Online
    Age 36
    Website www.colorbleed.nl
    Location Utrecht, The Netherlands

    BigRoy Unfollow Follow

    Latest posts made by BigRoy

    • How to get the fully resolved file path of an upcoming rendering?

      I'm looking at this again, and overall I am able to retrieve the path values and the redshift AOVs accordingly.

      However, I'm still wondering if there's any built-in methods to resolve the tokenized paths. I'm using e.g.

      c4d.modules.tokensystem.FilenameConvertTokens(token_path, rpd)
      

      Or

      c4d.modules.tokensystem.StringConvertTokens(token_path, rpd)
      

      And it works fine, but it e.g. doesn't handle the output files "Name Format" of the render data where it always appends a frame number in a specific way and/or extension.
      Is there any means where I can say use the Name Format to apply it to a filepath to see what it becomes? I'm essentially looking to do something similar as getting the Effective Path (per frame) as Redshift's AOV manager shows per AOV, but then also for the Single Image path and Multi-Pass image paths.

      I'd rather not have to do things like this:

          resolved = c4d.modules.tokensystem.FilenameConvertTokens(token_path, rpd)
      
          # Apply the render data name format to the filepath
          if name_format is not None and frame is not None:
              head, tail = os.path.splitext(resolved)
              # RDATA_NAMEFORMAT_0 = Name0000.TIF
              # RDATA_NAMEFORMAT_1 = Name0000
              # RDATA_NAMEFORMAT_2 = Name.0000
              # RDATA_NAMEFORMAT_3 = Name000.TIF
              # RDATA_NAMEFORMAT_4 = Name000
              # RDATA_NAMEFORMAT_5 = Name.000
              # RDATA_NAMEFORMAT_6 = Name.0000.TIF
              padding = {
                  c4d.RDATA_NAMEFORMAT_0: 4,
                  c4d.RDATA_NAMEFORMAT_1: 4,
                  c4d.RDATA_NAMEFORMAT_2: 4,
                  c4d.RDATA_NAMEFORMAT_3: 3,
                  c4d.RDATA_NAMEFORMAT_4: 3,
                  c4d.RDATA_NAMEFORMAT_5: 3,
                  c4d.RDATA_NAMEFORMAT_6: 4,
              }[name_format]
              frame_str = str(frame).zfill(padding)
      
              # Prefix frame number with a dot for specific name formats
              if name_format in {
                  c4d.RDATA_NAMEFORMAT_2,
                  c4d.RDATA_NAMEFORMAT_5,
                  c4d.RDATA_NAMEFORMAT_6,
              }:
                  frame_str = "." + frame_str
              # Whenever the frame number directly follows the name and the name ends
              # with a digit then C4D adds an underscore before the frame number.
              elif head and head[-1].isdigit():
                  frame_str = "_" + frame_str
      
              resolved = f"{head}{frame_str}{tail}"
      

      And this does not even handle the exact extensions cases.

      Any ideas?

      posted in Cinema 4D SDK
      BigRoyB
      BigRoy
    • Managing render settings and getting list of expected output files.

      Hi everyone,

      Consider me a newbie, so these might be stupid beginner questions but I'm hoping all of you can point me into the right direction. My Cinema4D knowledge is rather limited but I'm looking to get more knowledge on how to manage render settings from Cinema4D with Python.

      I need to query each file that would be written out if a render completes. E.g. each render pass, render take, camera, etc. that would get written out to a separate file on disk, including knowing their colorspace. In my case, knowing what a render on Deadline would spit out at the end.
      I assume that'd essentially be just all 'enabled' takes and the output filenames specified with the tokens. Does Cinema4D provide any good API to get access to this? How renderer-specific are those save filepaths? e.g. does the same logic share between Redshift and other renderers, or would it quickly become e.g. renderer specific?

      For example I think I can do:

      import c4d
      import redshift
      
      doc = c4d.documents.GetActiveDocument()
      renderdata = doc.GetActiveRenderData()
      
      # Get the Redshift videoPost and render settings
      vprs = redshift.FindAddVideoPost(renderdata, redshift.VPrsrenderer)
      existing_aovs = redshift.RendererGetAOVs(vpRS)
      

      But I'd essentially be writing logic that seems related to Redshift alone, and I'd need to then write similar code for each renderer down the line. E.g. each redshift AOV can have color processing enabled/disabled on its own in Redshift. So getting the colorspace of the AOV images for example would easily get very specific to Redshift too? Any ideas?

      Just to compare, the USD API for example has "Render Products" with "Render Vars" logic that is all shared between each renderer, and thus from the USD data alone I can detect all the output files that would be written. Preferably I can get to similar single API from a C4D scene alone.

      What I need:

      • I need to know the expected output files that would be rendered from the current scene. What's the best way to get that?
      • How do I query the takes that would be rendered?
      • Preferably I can also set the render output filepath in a managed way in the pipeline too.
      • Get the output colorspace of each image.

      Preferably all of this, without actually needing render things - so I can validate certain outputs in advance, etc.


      Just adding these links for my own future reference:

      • Getting takes data from a plug-in, do not use get active document
      posted in Cinema 4D SDK python 2025 windows
      BigRoyB
      BigRoy
    • RE: Cinema4D 2025 get user data value parameter not accessible?

      Just to confirm - skipping the unwanted entries worked absolutely fine for my needs. And I was able to reproduce the behavior in Cinema4D 2023 too if I created such user data manually and tried to access it. So - no bug or regression, just my limited knowledge.

      posted in Cinema 4D SDK
      BigRoyB
      BigRoy
    • RE: Cinema4D 2025 get user data value parameter not accessible?

      Thanks so much - of course, it may very well be that something in Cinema4D may just be generating more user data than I expected to live there. As such, I'll just perfectly ignore any values that couldn't be parsed since in my case I only care about those that I put there from Python to begin with.

      Thanks for the quick and thorough reply.

      posted in Cinema 4D SDK
      BigRoyB
      BigRoy
    • Cinema4D 2025 get user data value parameter not accessible?

      It seems that triggering this logic in Cinema4D 2025 fails:

          for description_id, base_container in obj.GetUserDataContainer():
              key = base_container[c4d.DESC_NAME]
              value = obj[description_id]
      

      Which did not error in Cinema4D 2023 and 2024.
      With an error along the lines of:

          value = obj[description_id]
                  ~~~^^^^^^^^^^^^^^^^
      AttributeError: Parameter value not accessible (object unknown in Python)
      

      Source issue reported here
      Even though this same logic worked in Cinema4D 2023 and 2024.
      Is this a regression, or does my code need updating?

      Could it be failing on trying to get a value from a Group, e.g. as one created here:

                  # Create the group
                  group_bc = c4d.GetCustomDatatypeDefault(c4d.DTYPE_GROUP)
                  group_bc[c4d.DESC_NAME] = group
                  group_bc[c4d.DESC_SHORT_NAME] = group
                  group_bc[c4d.DESC_TITLEBAR] = True
                  group_bc[c4d.DESC_GUIOPEN] = False
                  group_id = node.AddUserData(group_bc)
      

      If so, how would I detect correctly which user data should be allowed to retrieve the values from?

      posted in Cinema 4D SDK 2025 python
      BigRoyB
      BigRoy
    • RE: Alembic Export Options Not Working

      Just want to confirm here that I'm facing this same issue - only setting the negative state first and then the positive state after seems to make this work. So, thanks for the workaround.

      Here's the reported bug on our pipeline: https://github.com/ynput/ayon-cinema4d/issues/6
      And this is what fixed it: https://github.com/ynput/ayon-cinema4d/pull/8

      Looking at 'what' fixes it this most definitely sounds like a bug.
      (I tested in Cinema4D 2023.2.2 on Windows 10)

      posted in Cinema 4D SDK
      BigRoyB
      BigRoy
    • RE: Import and managing 'merged' Alembic

      Hi Ilia, this is great - thanks so much. I was able to get what I needed using the LoadDocument it seems. Am I correct in understand that the document it 'opens' is only temporary and I do not have to ensure proper deletion (in memory) of the loaded document once I'm done with it?

      Other than that - part of my code is currently here. It's more of a "spare time" open-source pipeline development because I don't use Cinema4D myself but am hoping it can become useful for others - so thanks for the details!

      posted in Cinema 4D SDK
      BigRoyB
      BigRoy
    • Merged Alembic Generator object, how to check if it is a camera?

      When importing an Alembic it turns the objects into Alembic Generators. How can I, without making the objects editable detect whether the object is a camera or not?

      print(op.GetTypeName())
      

      Prints: Alembic Generator.

      posted in Cinema 4D SDK python
      BigRoyB
      BigRoy
    • RE: Register event callbacks for "new file", "open file", "save file" (hooks?)

      @m_adam said in Register event callbacks for "new file", "open file", "save file" (hooks?):

      Regarding new document, sadly there is no way to hook into that and the best way would be to have a MessageData, list all doc by calling c4d.documents.GetFirstDocument and then iterating them by calling BaseList2D.GetNext(). Since a document is a BaseList2D you can hash them and therefor know if there is a new document.

      So that would just be running on a timer then, with the hope that I 'trigger' on it swiftly enough? Doesn't fit my needs so dedicated SceneHooks I can register application wide would be a mad helper for this!


      Aside of that - was there still a way to 'add' the python generator object into the scene without it maybe serializing into the saved file? Like have a flag that says "Do not serialize"? (Also, Scene Hooks would still be better)

      posted in Cinema 4D SDK
      BigRoyB
      BigRoy
    • Update Xref filepath without user interaction

      I'm looking to update filepath of an Xref via Python without user interaction requiring the "Yes" on a popup dialog.

      This works:

      xref.SetParameter(
          c4d.ID_CA_XREF_FILE,
          filepath,
          c4d.DESCFLAGS_SET_USERINTERACTION,
      )
      

      But that basically means I will get this pop-up dialog:
      c0a78c0f-923a-4b74-87fc-d4536cfac6f5-image.png

      However I want to do this without any user interaction in-between. How can I force the update without requiring the c4d.DESCFLAGS_SET_USERINTERACTION flag.

      How can I update the filepath without the pop-up dialog?


      This has come up often before, see here:

      • http://developers.maxon.net/forum//post/63608
      • https://developers.maxon.net/forum/topic/14319/does-xref-or-xref-simple-are-now-accessible-with-python
      • http://developers.maxon.net/forum//post/63554

      But from back in 2020 through 2022 these remained lingering with "impossible". But hey, the future is bright and now. How do we do this? (From Python)

      posted in Cinema 4D SDK python 2023 windows
      BigRoyB
      BigRoy