Permalink
Browse files

Don't invert blender view matrix. And fix order of multiply.

  • Loading branch information...
1 parent 59be401 commit a2842844acc2e1c9656b217a56e10048a2efe5ca @rectalogic committed Mar 5, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 tools/blender/addons/space_view3d_camera_anim_webvfx.py
@@ -186,12 +186,12 @@ def fitViewToFace(self, context):
return
# Get views up vector
- up = mathutils.Vector(getUpVector(region_3d.view_matrix.copy().inverted()))
+ up = mathutils.Vector(getUpVector(region_3d.view_matrix))
# Get transformed face vertices
vertices = []
for v in face.vertices:
- vertices.append(mesh.vertices[v].co * obj.matrix_world)
+ vertices.append(obj.matrix_world * mesh.vertices[v].co)
# Check the first two edges in the face, pick the one that is
# parallel to the view up vector (angle is 0 or 180).
@@ -208,7 +208,7 @@ def fitViewToFace(self, context):
elif a2 <= angleEpsilon or (abs(a2 - math.pi) <= angleEpsilon):
height = e2.length / 2
else:
- reportError(self, "Could not find vertical edge in face")
+ reportError(self, "Could not find vertical edge in face (angles are %f and %f)" % (a1, a2))
return
# Angle from eye, halve for triangle.

0 comments on commit a284284

Please sign in to comment.