#!BPY """ Name: 'SkipRenderedFrames' Blender: 244 Group: 'Render' Tooltip: 'Renders an animation, skipping already rendered frames' """ __author__ = ["Yorik van Havre"] __url__ = ("blender", "http://yorik.orgfree.com") __version__ = "1.0" __bpydoc__ = """\ This script renders the current scene, from start frame to end frame, skipping images that already exist in the rendering path. (Works with the extensions specified here below. If you render to files with some other extension, you must add it manually to the list. The most useful use (yes...) of this script is when you leave a rendering task unattended, typically a week-end giant-animation-rendering. You make a command-line rendering using the script (in a shellscript, a .bat file, whatever) You configure your OS to start the job again in case of problem, power shortage, etc... (At or Cron in linux, Scheduled Tasks in Windows), and the rendering job will resume, skipping everything that got rendered already. usage: blender -b file.blend -s 1 -e 100 -o .\render\ -P skiprenderedframes.py (you can change parameters, but their order is important) changelog: 24.12.2006 - version 0.0 05.06.2007 - version 1.0 updated to blender 2.44 - there were a few changes in python API... """ # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # ***** END GPL LICENCE BLOCK ***** import os, string from Blender import Scene from Blender.Scene import Render scn = Scene.GetCurrent() rnd = scn.getRenderingContext() for j in range(rnd.startFrame(),rnd.endFrame()+1): rnd.currentFrame(j) rnd.startFrame(j) TestFile = rnd.renderPath + string.zfill(rnd.currentFrame(),4) + ".jpg" if os.path.isfile(TestFile): print TestFile, " already exists, skipping." else: print "rendering frame ", rnd.currentFrame() rnd.render()