[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3147] trunk/py/scripts/addons/ space_view3d_panel_measure.py: * Measure Panel - Version 0.8.8

Martin Buerbaum martin.buerbaum at gmx.at
Wed Mar 21 12:11:32 CET 2012


Revision: 3147
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3147
Author:   pontiac
Date:     2012-03-21 11:11:31 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
* Measure Panel - Version 0.8.8
* Fixed normal calculation (again) for global mode.

Modified Paths:
--------------
    trunk/py/scripts/addons/space_view3d_panel_measure.py

Modified: trunk/py/scripts/addons/space_view3d_panel_measure.py
===================================================================
--- trunk/py/scripts/addons/space_view3d_panel_measure.py	2012-03-21 11:10:53 UTC (rev 3146)
+++ trunk/py/scripts/addons/space_view3d_panel_measure.py	2012-03-21 11:11:31 UTC (rev 3147)
@@ -27,7 +27,7 @@
     "author": "Buerbaum Martin (Pontiac), TNae (Normal patch)," \
         " Benjamin Lauritzen (Loonsbury; Volume code)," \
         " Alessandro Sala (patch: Units in 3D View)",
-    "version": (0, 8, 7),
+    "version": (0, 8, 8),
     "blender": (2, 6, 0),
     "location": "View3D > Properties > Measure Panel",
     "description": "Measure distances between objects",
@@ -387,8 +387,14 @@
 
         area = n.length / 2.0
 
-    # Apply world matrix to normal as well.
-    norm = mat * norm
+    # Apply rotation and scale to the normal as well.
+    rot_mat = obj.matrix_world.to_quaternion()
+    scale = obj.matrix_world.to_scale()
+    norm = rot_mat * norm
+    norm = Vector((
+        norm.x * scale.x,
+        norm.y * scale.y,
+        norm.z * scale.z)).normalized()
 
     return area, norm
 



More information about the Bf-extensions-cvs mailing list