[Bf-extensions-cvs] [38a7416a] master: mesh_snap_utilities_line: Fix failed object detection in orthographic view

mano-wii noreply at git.blender.org
Wed Feb 6 07:15:04 CET 2019


Commit: 38a7416a66433fe001b0a6ca2941141e691944d8
Author: mano-wii
Date:   Wed Feb 6 03:08:34 2019 -0200
Branches: master
https://developer.blender.org/rBA38a7416a66433fe001b0a6ca2941141e691944d8

mesh_snap_utilities_line: Fix failed object detection in orthographic view

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

M	mesh_snap_utilities_line/snap_context_l/utils_projection.py

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

diff --git a/mesh_snap_utilities_line/snap_context_l/utils_projection.py b/mesh_snap_utilities_line/snap_context_l/utils_projection.py
index cc17aa23..a9b0f021 100644
--- a/mesh_snap_utilities_line/snap_context_l/utils_projection.py
+++ b/mesh_snap_utilities_line/snap_context_l/utils_projection.py
@@ -97,19 +97,22 @@ def intersect_boundbox_threshold(sctx, MVP, ray_origin_local, ray_direction_loca
         tmin[0] = (local_bvmin[0] - ray_origin_local[0]) / ray_direction_local[0]
         tmax[0] = (local_bvmax[0] - ray_origin_local[0]) / ray_direction_local[0]
     else:
-        tmin[0] = tmax[0] = sctx.depth_range[1]
+        tmin[0] = sctx.depth_range[0]
+        tmax[0] = sctx.depth_range[1]
 
     if (ray_direction_local[1]):
         tmin[1] = (local_bvmin[1] - ray_origin_local[1]) / ray_direction_local[1]
         tmax[1] = (local_bvmax[1] - ray_origin_local[1]) / ray_direction_local[1]
     else:
-        tmin[1] = tmax[1] = sctx.depth_range[1]
+        tmin[1] = sctx.depth_range[0]
+        tmax[1] = sctx.depth_range[1]
 
     if (ray_direction_local[2]):
         tmin[2] = (local_bvmin[2] - ray_origin_local[2]) / ray_direction_local[2]
         tmax[2] = (local_bvmax[2] - ray_origin_local[2]) / ray_direction_local[2]
     else:
-        tmin[2] = tmax[2] = sctx.depth_range[1]
+        tmin[2] = sctx.depth_range[0]
+        tmax[2] = sctx.depth_range[1]
 
     # `va` and `vb` are the coordinates of the AABB edge closest to the ray #
     va = Vector()
@@ -133,12 +136,10 @@ def intersect_boundbox_threshold(sctx, MVP, ray_origin_local, ray_direction_loca
         rtmin = tmin[0]
         va[0] = vb[0] = local_bvmin[0]
         main_axis -= 3
-
     elif ((tmin[1] >= tmin[0]) and (tmin[1] >= tmin[2])):
         rtmin = tmin[1]
         va[1] = vb[1] = local_bvmin[1]
         main_axis -= 1
-
     else:
         rtmin = tmin[2]
         va[2] = vb[2] = local_bvmin[2]



More information about the Bf-extensions-cvs mailing list