Speedup, do only one global matrix grab per obj
authorDaniel Salazar <zanqdo@gmail.com>
Tue, 19 Jul 2011 15:30:19 +0000 (15:30 +0000)
committerDaniel Salazar <zanqdo@gmail.com>
Tue, 19 Jul 2011 15:30:19 +0000 (15:30 +0000)
release/scripts/startup/bl_operators/object_align.py

index aefc12ed8df4e747b38842533b9bb98fb73a252c..d215f3476cf5679f045a8c46bc6d8a9498bf010c 100644 (file)
@@ -63,11 +63,13 @@ def GlobalBB_LQ(bb_world):
 
 def GlobalBB_HQ(obj):
     
+    matrix_world = obj.matrix_world.copy()
+    
     # Initialize the variables with the last vertex
     
     verts = obj.data.vertices
     
-    val = verts[-1].co * obj.matrix_world
+    val = verts[-1].co * matrix_world
     
     left, right, front, back, down, up =\
     val[0],\
@@ -80,7 +82,7 @@ def GlobalBB_HQ(obj):
     # Test against all other verts
     for i in range (len(verts)-1):
         
-        vco = verts[i].co * obj.matrix_world
+        vco = verts[i].co * matrix_world
         
         # X Range
         val = vco[0]