Render Token Questions
-
Hello,
I'm looking into implementing 4 to 6 digit frame padding depending on the project an artist is currently assigned to. We would need to have it work both locally on a workstation and on our render farm machines. If I'm understanding the previous posts correctly we would have to override the default $frame token handler since that is what I assume is being used by c4d's output render settings.
Some questions I had are assuming that's true are:
- Do the token registrations get stored within the project files themselves or do they get stored in local machine or user settings for c4d. Meaning that if we wanted to implement this for our render farm we'd have to register the token on each one of the machines.
- Depending on how 1 is answered is it possible to support multiple $frame padding configurations?
- Also depending on how 1 is answered, are the token registrations permanent or are we going to have to register the custom token every time we launch c4d or whenever we want to change it.
-
Hello @tommyf,
Welcome to the Maxon developers forum and its community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.
- Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
- Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
- Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.
It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: How to Ask Questions.
About your First Question
Thank you for reaching out to us. Please do not hijack other threads with your questions and split up multiple questions into multiple topics in the future. Please read our support procedures, I have forked your questions.
Do the token registrations get stored within the project files themselves or do they get stored in local machine or user settings for c4d. Meaning that if we wanted to implement this for our render farm we'd have to register the token on each one of the machines.
Implementing a custom render token can be done with our C++ or Python API (here is an example for Python). So, you will need such plugin on each machine where you want to use that token. Not quite sure how the rest of your question is meant, 'registering a token (or any other plugin)' just means that the plugin is present when Cinema 4D is booting.
Depending on how 1 is answered is it possible to support multiple $frame padding configurations?
Since you do not explain what you would consider '4 to 6 digit frame padding', I can only speculate. My guess would be that you want to replace the frame counter provided by Cinema 4D in file names, e.g., transform
my_render_001.tif,my_render_002.tif, etc. intomy_render_0001.tif,my_render_0002.tif, etc.If that is what you mean, then no, that is not possible with tokens. The frame counter is something added by Cinema 4D you cannot influence as a user (as it depends on the render settings).
You could either implement a token which adds your own frame counter to a file name (
my_render_frame-0001_001.tif,my_render_frame-0002_002.tif, etc.) or you could write a postprocessor which hooks intoMSG_MULTI_RENDERNOTIFICATIONto catch a finished rendering and then post-process the files it created on disk. But the latter could get complicated.Also depending on how 1 is answered, are the token registrations permanent or are we going to have to register the custom token every time we launch c4d or whenever we want to change it.
As explained above, I do not really understand what you are asking for. A registration is not something you do manually as a human, but rather some code that runs.
Cheers,
Ferdinand -
Hi @ferdinand ,
Thanks for the clarifications. I had originally asked maxon support and referenced the original post as a source and they recommended I just post on the forum my questions. I'll take a look at the guidelines for future postings.The frame padding I was referring to are in regards to the frame numbering that is written out when selecting a render pattern in the output settings that you would find under Render Settings > Save > Name where the one we typically use is Name.0000.TIF.
Based on how you answered my questions it sounds like as long as I load the plugin script that contains the registration code that I could create custom tokens that way. I can also therefore create my own $frame token with my own frame padding (python str.zfill method) for frame numbers however there is no way to override the 4 digit frame padding that comes from the render settings name field. Best case where we use that custom token is we'd have duplicate frame numbers in the final output filename where our custom $frame token will have our custom frame padding numbers and the frame counter that's only 4 digit padding since there doesn't appear to be any setting under Render Settings > Save > Name that doesn't include the frame counter.
Based on your example you gave I would end up with (my_render_frame-000001_001.tif, my_render_frame-000002_002.tif, etc.) if I used the Name000.TIF template and had my own custom $frame token I used in the output filepath.
I've got a script that can address the frame padding for when our shots cross the 10000 frame mark after the renders complete which I suppose I can look into the postprocessor hook you mentioned but was hoping there might've been some way to avoid having to do any post processing.
Thanks again for all the information.
-
@tommyf said in Render Token Questions:
The frame padding I was referring to are in regards to the frame numbering that is written out when selecting a render pattern in the output settings that you would find under Render Settings > Save > Name where the one we typically use is Name.0000.TIF.
Yes, that was already my hunch, as described above, and you cannot alter this numbering with render tokens, you can only add your own. When you want to change this numbering, you would have to write yourself a post processor as lined out above. Technically, you could also just run this outside of Cinema 4D, e.g.,
commandline.exe -someScene.c4d ... c4dpy.exe renameScript.py -someScene.c4d # Or just even just a CPython instance (or any other scripting language), the problem here is # that you could not access the the render settings of the scene and would have to rely on conventions. python renameScript.py -someScene.c4dBased on how you answered my questions it sounds like as long as I load the plugin script that contains the registration code that I could create custom tokens that way. I can also therefore create my own $frame token with my own frame padding (python str.zfill method) for frame numbers however there is no way to override the 4 digit frame padding that comes from the render settings name field.
Yes. But you could not name it
$frame, because that would collide with the builtin token of the same name.When the pattern
my_render_frame-000001_001.tifworks for you, I would definitely go for the render token. When you absolutely have to change the postfix set by Cinema 4D, that is possible too, but much more work. The work lies there not in actually renaming the files, that is somewhat trivial. The work lies in supporting all the ways a rendering can happen. When you are locked into using thecommandlineon your farm only, that would simplify things and drive down the costs of doing this (i.e., you would not support picture viewer, teams, editor, etc. renderings).Cheers,
Ferdinand