9

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.

AkBKukU
  • 197
  • 1
  • 8

1 Answers1

17

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
ideasman42
  • 47,387
  • 10
  • 141
  • 223
gandalf3
  • 157,169
  • 58
  • 601
  • 1,133