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

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

    Scheduled Pinned Locked Moved Cinema 4D SDK
    2 Posts 2 Posters 9 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic was forked from Managing render settings and getting list of expected output files. ferdinand
    This topic has been deleted. Only users with topic management privileges can see it.
    • BigRoyB Offline
      BigRoy
      last edited by BigRoy

      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?

      1 Reply Last reply Reply Quote 0
      • ferdinandF Offline
        ferdinand
        last edited by ferdinand

        Hey @BigRoy,

        Thank you for reaching out to us and your question. We do not allow for topics that are a collection of questions from one user. New questions mandate new topics, unless they are clear follow up questions on an existing topic. The reason for this is so that this forum remains a searchable database.

        Please create new topics on your own in the future. I have forked your topic.

        Your topic is also lacking an actual question. Here I can infer your question, but for more complex subjects I might not be able to. It is important to have a literal question close to the start of your topic. See Support Procedures: How to Ask Questions and the examples below for what makes a good technical question.

        From the context I am assuming here the question is:

        Is there an API function that returns the full physical file path of a rendered file for a given render setting and in particular the Save > Name format?

        34d82dba-bf2f-411a-8489-a8dccc5d9f77-image.png

        The answer is unfortunately that no such function exists. When you need this feature, you have to hard code it yourself.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

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