# Changing filename format based on current animation frame?

I'm currently working on an animation for a character in which I need the animation for in 8 directions (Up, Down, Left, Right, Diagonals). I can keyframe up the camera so it moves to these directions just fine every 12 frames and then just repeat the animation 8 times but I'd like the output for each filename for each direction to be different. Something like WalkingAnimation_00_01.png, where 00 is the direction and then 01 is the frame number for that direction. To clarify, something like... WalkingAnimation_08_(0-7 depending on the direction)_(01-12 depending on the frame for this direction)

I know some programming but I havent learned much of Python but I figure I'll need a double loop for this, but I'm not too sure how to interact with the Blender scripts yet. Any help is appreciated.

To make the output direct to specific directories dependent on frame you could add a handler to automatically set the scene.render.filepath before rendering the frame.

As an example, open a Text Editor window, click 'New' and enter the following code :

import bpy
def handler_set_filepath_based_on_frame(scene):
scene.render.filepath = '//WalkingAnimation/%i_%i' % (scene.frame_current // 12, scene.frame_current % 12)
bpy.app.handlers.frame_change_pre.append(handler_set_filepath_based_on_frame)


Click the 'Run Script' button to run it and every time the frame changes the File Path should be automatically updated. Check the 'Register' checkbox to make it automatically run each time the .blend is opened.

If you then manually skip through the frames you should see the render output filepath automatically updating.

The calculation 'scene.frame_current // 12' is for the prefix and will increment by 1 for each 12 frames while the 'scene.frame_current % 12' will count the individual frame within each 12.

Well, one easy thing to do is to open many blender windows and in the first window adjust the options so you render frame 1-x to output folder a.In the 2nd blender window frame x-y to folder b.In the 3rd window.....

• Using a few lines of Python script seems like a much preferred approach to me. – dr. Sybren Jul 3 '17 at 6:25