[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1383] trunk/py/scripts/addons/ render_povray/render.py: rotate entire scene -90d X, so povray' s up axis matches blenders.

Campbell Barton ideasman42 at gmail.com
Mon Jan 10 13:31:05 CET 2011


Revision: 1383
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1383
Author:   campbellbarton
Date:     2011-01-10 12:31:04 +0000 (Mon, 10 Jan 2011)
Log Message:
-----------
rotate entire scene -90d X, so povray's up axis matches blenders.

Modified Paths:
--------------
    trunk/py/scripts/addons/render_povray/render.py

Modified: trunk/py/scripts/addons/render_povray/render.py
===================================================================
--- trunk/py/scripts/addons/render_povray/render.py	2011-01-10 12:23:00 UTC (rev 1382)
+++ trunk/py/scripts/addons/render_povray/render.py	2011-01-10 12:31:04 UTC (rev 1383)
@@ -153,6 +153,7 @@
 ##############################EndSF###########################
 
 def write_pov(filename, scene=None, info_callback=None):
+    import mathutils
     file = open(filename, 'w')
 
     # Only for testing
@@ -161,6 +162,7 @@
 
     render = scene.render
     world = scene.world
+    global_matrix = mathutils.Matrix.Rotation(-pi / 2.0, 4, 'X')
 
     def uniqueName(name, nameSeq):
 
@@ -400,7 +402,7 @@
         
         # DH disabled for now, this isn't the correct context
         active_object = None #bpy.context.active_object # does not always work  MR
-        matrix = camera.matrix_world
+        matrix = global_matrix * camera.matrix_world
         focal_point = camera.data.dof_distance
 
         # compute resolution
@@ -437,7 +439,7 @@
         for ob in lamps:
             lamp = ob.data
 
-            matrix = ob.matrix_world
+            matrix = global_matrix * ob.matrix_world
 
             color = tuple([c * lamp.energy *2 for c in lamp.color]) # Colour is modified by energy #muiltiplie by 2 for a better match --Maurice
 
@@ -594,7 +596,7 @@
 
             writeObjectMaterial(material)
 
-            writeMatrix(ob.matrix_world)
+            writeMatrix(global_matrix * ob.matrix_world)
 
             file.write('}\n')
 
@@ -632,7 +634,7 @@
             #	continue
             # me = ob.data
 
-            matrix = ob.matrix_world
+            matrix = global_matrix * ob.matrix_world
             try:
                 uv_layer = me.uv_textures.active.data
             except AttributeError:
@@ -1079,7 +1081,7 @@
     def exportWorld(world):
         render = scene.render
         camera = scene.camera
-        matrix = camera.matrix_world
+        matrix = global_matrix * camera.matrix_world
         if not world:
             return
         #############Maurice#################################### 



More information about the Bf-extensions-cvs mailing list