From: Antonio Ospite Date: Sat, 24 Feb 2007 09:18:14 +0000 (+0100) Subject: Fix camera type selection for blender > 2.43 X-Git-Tag: vrm-0.3~10 X-Git-Url: https://git.ao2.it/vrm.git/commitdiff_plain/20db3c0178285331d20f3111393ce9ecb601e612?hp=aa602f68ddbdd0dd7dacedb0efaf6430361789aa Fix camera type selection for blender > 2.43 Reported-by: Thomas Lachmann Signed-off-by: Antonio Ospite --- diff --git a/vrm.py b/vrm.py index 67bcf3a..7324efc 100755 --- a/vrm.py +++ b/vrm.py @@ -83,6 +83,7 @@ __bpydoc__ = """\ # * Remove the real file opening in the abstract VectorWriter # * View frustum clipping # * Scene clipping done using bounding box instead of object center +# * Fix camera type selection for blender>2.43 (Thanks to Thomas Lachmann) # # --------------------------------------------------------------------- @@ -887,13 +888,22 @@ class Projector: fovy = atan(0.5/aspect/(camera.lens/32)) fovy = fovy * 360.0/pi - + + + if Blender.Get('version') < 243: + camPersp = 0 + camOrtho = 1 + else: + camPersp = 'persp' + camOrtho = 'ortho' + # What projection do we want? - if camera.type == 0: + if camera.type == camPersp: mP = self._calcPerspectiveMatrix(fovy, aspect, near, far) - elif camera.type == 1: - mP = self._calcOrthoMatrix(fovy, aspect, near, far, scale) + elif camera.type == camOrtho: + mP = self._calcOrthoMatrix(fovy, aspect, near, far, scale) + # View transformation cam = Matrix(cameraObj.getInverseMatrix()) cam.transpose()