[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33779] trunk/blender/release/scripts/op/ io_scene_x3d/export_x3d.py: correction to last commit, returned normalized direction.

Campbell Barton ideasman42 at gmail.com
Sun Dec 19 08:43:01 CET 2010


Revision: 33779
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33779
Author:   campbellbarton
Date:     2010-12-19 08:43:01 +0100 (Sun, 19 Dec 2010)

Log Message:
-----------
correction to last commit, returned normalized direction.

Modified Paths:
--------------
    trunk/blender/release/scripts/op/io_scene_x3d/export_x3d.py

Modified: trunk/blender/release/scripts/op/io_scene_x3d/export_x3d.py
===================================================================
--- trunk/blender/release/scripts/op/io_scene_x3d/export_x3d.py	2010-12-19 07:40:08 UTC (rev 33778)
+++ trunk/blender/release/scripts/op/io_scene_x3d/export_x3d.py	2010-12-19 07:43:01 UTC (rev 33779)
@@ -234,10 +234,7 @@
         # beamWidth=((lamp.spotSize*math.pi)/180.0)*.37;
         cutOffAngle=beamWidth*1.3
 
-        dx,dy,dz=self.computeDirection(mtx)
-        # note -dx seems to equal om[3][0]
-        # note -dz seems to equal om[3][1]
-        # note  dy seems to equal om[3][2]
+        dx, dy, dz = self.computeDirection(mtx)
 
         #location=(ob.matrix_world*MATWORLD).translation_part() # now passed
         location=(MATWORLD * mtx).translation_part()
@@ -266,7 +263,7 @@
             ambientIntensity = 0
 
         intensity=min(lamp.energy/1.75,1.0)
-        (dx,dy,dz)=self.computeDirection(mtx)
+        dx, dy, dz = self.computeDirection(mtx)
         self.file.write("<DirectionalLight DEF=\"%s\" " % safeName)
         self.file.write("ambientIntensity=\"%s\" " % (round(ambientIntensity,self.cp)))
         self.file.write("color=\"%s %s %s\" " % (round(lamp.color[0],self.cp), round(lamp.color[1],self.cp), round(lamp.color[2],self.cp)))
@@ -924,7 +921,7 @@
         return s
 
     def computeDirection(self, mtx):
-        return (mathutils.Vector((0.0, 0.0, -1.0)) * (MATWORLD * mtx).rotation_part())[:]
+        return (mathutils.Vector((0.0, 0.0, -1.0)) * (MATWORLD * mtx).rotation_part()).normalize()[:]
 
     # swap Y and Z to handle axis difference between Blender and VRML
     #------------------------------------------------------------------------





More information about the Bf-blender-cvs mailing list