Page 1 of 1

Blender automatic render python script for 32-bit graphics

Posted: 06 Feb 2007 09:11
by brupje
I created a python script that will render from different angles with different sizes automaticly.

It will create a directory for each file you render and puts the png files there. For example if you set as rootpath "C:\\myrenders\\" and your file is called "myfile.blend" you will have a directory
c:\myrenders\myfile
containing
myfile_1_25.png (frame 1, 25%)
myfile_1_50.png (frame 1, 50%)
myfile_1_100.png (frame 1, 100%)
myfile_2_25.png (frame 2, 25%)
...
myfile_4_100.png (frame 4, 25%)


How to use:

1. Open the file to be rendered
2. Download the script, or copy this text into Blender
3. Change "RootPath = "c:\\ottdrenders\\"" into a directory of your own choice. Note the "\\" instead of "\"!!
4. Press alt-p (or run script)
5. Wait for a certain amount of time depending on what is rendered, your computer specs and the position of mars relative to the earth
6. Upload your work ;)

Code: Select all

import Blender
from Blender import *
from Blender.Scene import Render

# change this!
RootPath = "c:\\ottdrenders\\"

zoomLevels = [100,50,25]
myBlend = Blender.Object.Get();

print "Init success, continue"

curScene = Scene.GetCurrent()
myContext = curScene.getRenderingContext()
myContext.imageType = Render.PNG

curFile = sys.makename( Blender.Get('filename'),strip=1)
curPath = RootPath + curFile +"\\"
print "Output to: ", curPath
myContext.setRenderPath(curPath);

# assuming 4 frames, each frame will be rendered at 3 zoom levels
for i in range(1,5,1):
	print "Frame #" , i
	myContext.currentFrame(i)
		
	for d in zoomLevels:
		print "Zoom level ", d ,"%"
		myContext.setRenderWinSize(d)
		myContext.render()
		myContext.saveRenderedImage(curFile + "_" + str(i) + "_" + str(d) +".png")
[/code]

Posted: 07 Feb 2007 07:15
by athanasios
Even I don't use Blender yet, I suppose this will help a lot. BRAVO.