[Bf-extensions-cvs] [6cc1ac1] master: Fix constrain matrix

Germano Cavalcante mano-wii noreply at git.blender.org
Mon Oct 5 17:19:34 CEST 2015


Commit: 6cc1ac1e7641ad46a8a463a6db536de612483413
Author: Germano Cavalcante (mano-wii)
Date:   Mon Oct 5 12:17:09 2015 -0300
Branches: master
https://developer.blender.org/rBAC6cc1ac1e7641ad46a8a463a6db536de612483413

Fix constrain matrix

The constraints were not correct when the object was rotated or moved

===================================================================

M	mesh_snap_utilities_line.py

===================================================================

diff --git a/mesh_snap_utilities_line.py b/mesh_snap_utilities_line.py
index edc4001..7a1b603 100644
--- a/mesh_snap_utilities_line.py
+++ b/mesh_snap_utilities_line.py
@@ -650,35 +650,20 @@ class SnapUtilitiesLine(bpy.types.Operator):
         elif event.value == 'PRESS':
             if event.type in self.constrain_keys:
                 self.bool_update = True
-                if not self.vector_constrain:
-                    if event.shift:
-                        if isinstance(self.geom, bmesh.types.BMEdge):
-                            if self.list_verts:
-                                loc = self.list_verts[-1].co
-                                self.vector_constrain = (loc, loc + self.geom.verts[1].co-self.geom.verts[0].co, event.type)
-                            else:
-                                self.vector_constrain = [v.co for v in self.geom.verts]+[event.type]
-                    else:
-                        if self.list_verts:
-                            loc = self.list_verts[-1].co
-                        else:
-                            loc = self.location
-                        self.vector_constrain = [loc, loc + self.constrain_keys[event.type]]+[event.type]
-                    
-                elif self.vector_constrain[2] == event.type:
+                if self.vector_constrain and self.vector_constrain[2] == event.type:
                     self.vector_constrain = ()
-                        
+
                 else:
                     if event.shift:
                         if isinstance(self.geom, bmesh.types.BMEdge):
                             if self.list_verts:
-                                loc = self.list_verts[-1].co
-                                self.vector_constrain = (loc, loc + self.geom.verts[1].co-self.geom.verts[0].co, event.type)
+                                loc = self.obj_matrix * self.list_verts[-1].co
+                                self.vector_constrain = (loc, loc + self.obj_matrix * self.geom.verts[1].co - self.obj_matrix * self.geom.verts[0].co, event.type)
                             else:
-                                self.vector_constrain = [v.co for v in self.geom.verts]+[event.type]
+                                self.vector_constrain = [self.obj_matrix * v.co for v in self.geom.verts]+[event.type]
                     else:
                         if self.list_verts:
-                            loc = self.list_verts[-1].co
+                            loc = self.obj_matrix * self.list_verts[-1].co
                         else:
                             loc = self.location
                         self.vector_constrain = [loc, loc + self.constrain_keys[event.type]]+[event.type]



More information about the Bf-extensions-cvs mailing list