9
$\begingroup$

I'm new to blender scripting and with the api change in 2.56 I'm having difficulty finding relevant information. I'm trying to render 8 non-consecutive single frames to pngs. They are the same scene and camera, I'm just trying to get different angles of an object for creating sprites for a game. I found this tutorial but it's out of date.

I hate to ask for code because it's almost going to be the whole script, but it would be apreciated. I would be just as happy with a some direction on getting started though.

$\endgroup$

1 Answer 1

17
$\begingroup$

Try setting the frame and then rendering it.

Here is a simple example:

import bpy

scene = bpy.context.scene
fp = scene.render.filepath # get existing output path
scene.render.image_settings.file_format = 'PNG' # set output format to .png

frames = 5, 9, 17

for frame_nr in frames:

    # set current frame to frame 5
    scene.frame_set(frame_nr)

    # set output path so render won't get overwritten
    scene.render.filepath = fp + str(frame_nr)
    bpy.ops.render.render(write_still=True) # render still

# restore the filepath
scene.render.filepath = fp
$\endgroup$
1
  • $\begingroup$ I always forget how - nice to be able to find that perfect, concise answer! $\endgroup$
    – uhoh
    Apr 28, 2016 at 8:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .