7
$\begingroup$

Two questions:

  1. How to use the name of the currently opened blendfile automatically in the File Path field of the File Output Node without entering it manually?

  2. How to remove the frame number which is automatically appended at the end of output file (especially for static images)?

$\endgroup$
10
$\begingroup$

AFAIK the answer to both is No.

The frame number padding zeros can be configured by adding # to the filename:

From the wiki page on CLI rendering:

 -o or --render-output <path>
     Set the render path and file name.
     Use // at the start of the path to
         render relative to the blend file.
     The # characters are replaced by the frame number, and used to define zero padding.
         ani_##_test.png becomes ani_01_test.png
         test-######.png becomes test-000001.png
         When the filename does not contain #, The suffix #### is added to the filename
     The frame number will be added at the end of the filename.
         eg: blender -b foobar.blend -o //render_ -F PNG -x 1 -a
         //render_ becomes //render_####, writing frames as //render_0001.png//

This works in the GUI too:

enter image description here

So the above becomes render01.png, render02.png etc.
A single # = no padding. (i.e. render1.png)

However, I don't think there is a way to completely remove the frame number from the file name through blender, though it's really not hard to remove it later.


As for the blendfile name in the Base Path:
You could write a python script to set the Base Path of all File Output nodes to the blendfile name:

import bpy
import os

# Get file name:
filename = bpy.path.basename(bpy.context.blend_data.filepath)

# Remove .blend extension:
filename = os.path.splitext(filename)[0]

# set the base path for all file output nodes to filename:
for scene in bpy.data.scenes:
    for node in scene.node_tree.nodes:
        if node.type == 'OUTPUT_FILE':
            node.base_path = "//" + filename
$\endgroup$
3
  • $\begingroup$ We can also put the # placeholder within the File Output node's file path. e.g. specifying Image#.png will create Image1.png, Image2.png, etc. $\endgroup$ – Adhi Dec 4 '13 at 6:47
  • $\begingroup$ For anyone that stumbles on this old post as I did. The wiki link noted above for CLI rendering has been changed to: docs.blender.org/manual/en/latest/render/workflows/… $\endgroup$ – crazycourier Apr 18 '19 at 14:43
  • $\begingroup$ @crazycourier Thanks, I've edited the new link in. $\endgroup$ – gandalf3 Apr 19 '19 at 6:25
1
$\begingroup$

I have not tried to see if it works the same with other render formats, but when I render videos from blender, I prevent it putting frame numbers in the render by specifying the full filename, with extension.

For example, if I specify //output in the Output field in the GUI, it will generate a file that starts with output in the project directory but will have the start and end frames in the name. If, however, I specify //output.avi in the Output field then that's exactly the name I'll get.

Unfortunately, I too have not found a way to have it just use the blend file name.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.