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?
-
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 > Nameformat?
The answer is unfortunately that no such function exists. When you need this feature, you have to hard code it yourself.
Cheers,
Ferdinand