From 2bfb6873ab89019125b7e6602eac6ca8fef7940c Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 22 Mar 2006 18:25:16 +0100 Subject: [PATCH] Make it work with blender 2.37 Signed-off-by: Antonio Ospite --- vrm.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) mode change 100644 => 100755 vrm.py diff --git a/vrm.py b/vrm.py old mode 100644 new mode 100755 index 380a65b..bbff105 --- a/vrm.py +++ b/vrm.py @@ -2,7 +2,7 @@ """ Name: 'VRM' -Blender: 228 +Blender: 237 Group: 'Export' Tooltip: 'Vector Rendering Method Export Script' """ @@ -12,12 +12,14 @@ import Blender from Blender import Scene, Object, Lamp, Camera from math import * from Blender.Window import * +from Blender.Scene import Render def init(): print "Init\n" - renderDir = scena.getRenderdir() + renderDir = context.getRenderPath() + # distance from camera Z' def Distance(PX,PY,PZ): @@ -57,7 +59,7 @@ def flatern(vertx, verty, vertz): camTyp = cam[0].getType() - msize = scena.getWinSize() + msize = (context.imageSizeX(), context.imageSizeY()) xres = msize[0] # X res for output yres = msize[1] # Y res for output ratio = xres/yres @@ -87,14 +89,19 @@ def writesvg(ob): ######## scena = Scene.GetCurrent() +context = scena.getRenderingContext() + +#print dir(context) + init() tacka = [0,0,0] lice = [3,tacka,tacka,tacka,tacka] -msize = scena.getWinSize() +msize = (context.imageSizeX(), context.imageSizeY()) +print msize -file=open("d:\proba.svg","w") +file=open("proba.svg","w") file.write("\n") @@ -103,15 +110,16 @@ file.write("xmlns=\"http://www.w3.org/2000/svg\" version=\"1.2\" streamable=\"tr Objects = Blender.Object.Get() NUMobjects = len(Objects) -startFrm = scena.startFrame() -endFrm = scena.endFrame() +startFrm = context.startFrame() +endFrm = startFrm +#endFrm = context.endFrame() camera = scena.getCurrentCamera() # Get the current camera for f in range(startFrm, endFrm+1): #scena.currentFrame(f) Blender.Set('curframe', f) - DrawProgressBar (f/(endFrm+1-startFrm),"Rendering ..." + str(scena.currentFrame())) + DrawProgressBar (f/(endFrm+1-startFrm),"Rendering ..." + str(context.currentFrame())) print "Frame: ", f, "\n" if startFrm <> endFrm: file.write("\n") @@ -220,9 +228,6 @@ for f in range(startFrm, endFrm+1): # add/sorting in Z' direction #Dodaj(px,py,Distance(vertxyz[0], vertxyz[1], vertxyz[2])) file.write(`px` + ", " + `py`) -# svetla = Blender.Lamp.Get() -# svetlo = svetla[0] -# print svetlo.LocX ambient = -200 svetlo = [1,1,-1] vektori = (norm[0]*svetlo[0]+norm[1]*svetlo[1]+norm[2]*svetlo[2]) @@ -240,5 +245,6 @@ for f in range(startFrm, endFrm+1): #writesvg(objekat) file.write("") file.close() +print file DrawProgressBar (1.0,"Finished.") print "Finished\n" -- 2.1.4