[Bf-extensions-cvs] [73c7e3ff] master: module snap_context: F8 constrain should not intersect outlocation

Germano noreply at git.blender.org
Sat Sep 23 00:41:11 CEST 2017


Commit: 73c7e3ff1491914a5a6b713950deb1ec758455dc
Author: Germano
Date:   Fri Sep 22 19:40:58 2017 -0300
Branches: master
https://developer.blender.org/rBA73c7e3ff1491914a5a6b713950deb1ec758455dc

module snap_context: F8 constrain should not intersect outlocation

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

M	mesh_snap_utilities_line.py

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

diff --git a/mesh_snap_utilities_line.py b/mesh_snap_utilities_line.py
index a74c7479..36280911 100644
--- a/mesh_snap_utilities_line.py
+++ b/mesh_snap_utilities_line.py
@@ -204,12 +204,15 @@ def snap_utilities(
 
     if not snp_obj:
         is_increment = True
-        r_type = 'OUT'
-        r_loc = out_Location(rv3d, region, orig, view_vector)
         if constrain:
-            t_loc = intersect_point_line(r_loc, constrain[0], constrain[1])[0]
-            if t_loc:
-                r_loc = t_loc
+            end = orig + view_vector
+            t_loc = intersect_line_line(constrain[0], constrain[1], orig, end)
+            if t_loc is None:
+                t_loc = constrain
+            r_loc = t_loc[0]
+        else:
+            r_type = 'OUT'
+            r_loc = out_Location(rv3d, region, orig, view_vector)
 
     elif snp_obj.data[0] != obj: #OUT
         r_loc = loc
@@ -239,9 +242,7 @@ def snap_utilities(
             #cache.v2d = location_3d_to_region_2d(region, rv3d, cache.vco)
 
         if constrain:
-            location = intersect_point_line(cache.vco, constrain[0], constrain[1])
-            #factor = location[1]
-            r_loc = location[0]
+            r_loc = intersect_point_line(cache.vco, constrain[0], constrain[1])[0]
         else:
             r_loc = cache.vco
 
@@ -269,12 +270,12 @@ def snap_utilities(
             #else: cache.v2dperp = None
 
         if constrain:
-            location = intersect_line_line(constrain[0], constrain[1], cache.v0, cache.v1)
-            if location == None:
+            t_loc = intersect_line_line(constrain[0], constrain[1], cache.v0, cache.v1)
+            if t_loc is None:
                 is_increment = True
                 end = orig + view_vector
-                location = intersect_line_line(constrain[0], constrain[1], orig, end)
-            r_loc = location[0]
+                t_loc = intersect_line_line(constrain[0], constrain[1], orig, end)
+            r_loc = t_loc[0]
 
         elif cache.v2dperp and\
             abs(cache.v2dperp[0] - mcursor[0]) < 10 and abs(cache.v2dperp[1] - mcursor[1]) < 10:



More information about the Bf-extensions-cvs mailing list