[Bf-blender-cvs] [00a0f062410] master: Fix T66802: Edge Slide: Unpredictable direction of the edge loop when it is fully occluded

mano-wii noreply at git.blender.org
Wed Feb 5 18:42:42 CET 2020


Commit: 00a0f062410a864e5592ed318ea4228c9dd2b589
Author: mano-wii
Date:   Wed Feb 5 14:42:22 2020 -0300
Branches: master
https://developer.blender.org/rB00a0f062410a864e5592ed318ea4228c9dd2b589

Fix T66802: Edge Slide: Unpredictable direction of the edge loop when it is fully occluded

When an edge loop is fully occluded the direction of movement
is not calculated resulting in unpredictable behavior.

So always calculate the direction of the groups of edge loops
but continue preventing occluded edges from affecting `mval_dir`
(global) value.

Differential Revision: https://developer.blender.org/D5247

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

M	source/blender/editors/transform/transform.c

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

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index c12821b321b..24efa33bdfa 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -6456,8 +6456,10 @@ static void calcEdgeSlide_mval_range(TransInfo *t,
       }
 
       /* This test is only relevant if object is not wire-drawn! See [#32068]. */
-      if (use_occlude_geometry &&
-          !BMBVH_EdgeVisible(bmbvh, e, t->depsgraph, ar, v3d, tc->obedit)) {
+      bool is_visible = !use_occlude_geometry ||
+                        BMBVH_EdgeVisible(bmbvh, e, t->depsgraph, ar, v3d, tc->obedit);
+
+      if (!is_visible && !use_calc_direction) {
         continue;
       }
 
@@ -6479,11 +6481,13 @@ static void calcEdgeSlide_mval_range(TransInfo *t,
 
       /* global direction */
       dist_sq = dist_squared_to_line_segment_v2(mval, sco_b, sco_a);
-      if ((dist_best_sq == -1.0f) ||
-          /* intentionally use 2d size on 3d vector */
-          (dist_sq < dist_best_sq && (len_squared_v2v2(sco_b, sco_a) > 0.1f))) {
-        dist_best_sq = dist_sq;
-        sub_v3_v3v3(mval_dir, sco_b, sco_a);
+      if (is_visible) {
+        if ((dist_best_sq == -1.0f) ||
+            /* intentionally use 2d size on 3d vector */
+            (dist_sq < dist_best_sq && (len_squared_v2v2(sco_b, sco_a) > 0.1f))) {
+          dist_best_sq = dist_sq;
+          sub_v3_v3v3(mval_dir, sco_b, sco_a);
+        }
       }
 
       if (use_calc_direction) {



More information about the Bf-blender-cvs mailing list