[Bf-extensions-cvs] [f418b293] master: Fix T89812: 'Snap_Utilities_Line' - Projection error in orthographic view

Germano Cavalcante noreply at git.blender.org
Thu Jul 22 15:19:23 CEST 2021


Commit: f418b293879f948f39cab8aef4c3ab47b2c1258b
Author: Germano Cavalcante
Date:   Thu Jul 22 10:17:46 2021 -0300
Branches: master
https://developer.blender.org/rBAf418b293879f948f39cab8aef4c3ab47b2c1258b

Fix T89812: 'Snap_Utilities_Line' - Projection error in orthographic view

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

M	mesh_snap_utilities_line/__init__.py
M	mesh_snap_utilities_line/snap_context_l/mesh_drawing.py

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

diff --git a/mesh_snap_utilities_line/__init__.py b/mesh_snap_utilities_line/__init__.py
index c22c5b02..98f88e76 100644
--- a/mesh_snap_utilities_line/__init__.py
+++ b/mesh_snap_utilities_line/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "Snap_Utilities_Line",
     "author": "Germano Cavalcante",
-    "version": (6, 9, 22),
+    "version": (6, 9, 23),
     "blender": (2, 93, 0),
     "location": "View3D > TOOLS > Line Tool",
     "description": "Extends Blender Snap controls",
diff --git a/mesh_snap_utilities_line/snap_context_l/mesh_drawing.py b/mesh_snap_utilities_line/snap_context_l/mesh_drawing.py
index 219d7311..d05becec 100644
--- a/mesh_snap_utilities_line/snap_context_l/mesh_drawing.py
+++ b/mesh_snap_utilities_line/snap_context_l/mesh_drawing.py
@@ -349,9 +349,13 @@ class GPU_Indices_Mesh():
 
             far_ += depth_offset
             near += depth_offset
-            fn = (far_ - near)
-            winmat[2][2] = -(far_ + near) / fn
-            winmat[2][3] = (-2 * far_ * near) / fn
+            range = (far_ - near)
+            if is_persp:
+                winmat[2][2] = -(far_ + near) / range
+                winmat[2][3] = (-2 * far_ * near) / range
+            else:
+                winmat[2][3] = -(far_ + near) / range
+
             gpu.matrix.load_projection_matrix(winmat)
 
         if self.draw_edges:



More information about the Bf-extensions-cvs mailing list