[Bf-blender-cvs] [49368c734bc] blender-v3.2-release: Fix (unreported): cyclic snap of curve handles

Germano Cavalcante noreply at git.blender.org
Sun May 29 03:24:50 CEST 2022


Commit: 49368c734bcf16640ec3992c44a7e44009876628
Author: Germano Cavalcante
Date:   Sat May 28 22:12:00 2022 -0300
Branches: blender-v3.2-release
https://developer.blender.org/rB49368c734bcf16640ec3992c44a7e44009876628

Fix (unreported): cyclic snap of curve handles

The logic of skipping selected handles was inverted
and confusing.

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

M	source/blender/editors/transform/transform_snap_object.cc

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

diff --git a/source/blender/editors/transform/transform_snap_object.cc b/source/blender/editors/transform/transform_snap_object.cc
index 0505772c668..6beae690b12 100644
--- a/source/blender/editors/transform/transform_snap_object.cc
+++ b/source/blender/editors/transform/transform_snap_object.cc
@@ -2077,11 +2077,14 @@ static short snapCurve(SnapObjectContext *sctx,
                                                  nu->bezt[u].vec[1],
                                                  &dist_px_sq,
                                                  r_loc);
+
             /* Don't snap if handle is selected (moving),
              * or if it is aligning to a moving handle. */
-            is_selected = (!(nu->bezt[u].f1 & SELECT) &&
-                           !(nu->bezt[u].h1 & HD_ALIGN && nu->bezt[u].f3 & SELECT)) != 0;
-            if (!(is_selected && skip_selected)) {
+            bool is_selected_h1 = (nu->bezt[u].f1 & SELECT) != 0;
+            bool is_selected_h2 = (nu->bezt[u].f3 & SELECT) != 0;
+            bool is_autoalign_h1 = (nu->bezt[u].h1 & HD_ALIGN) != 0;
+            bool is_autoalign_h2 = (nu->bezt[u].h2 & HD_ALIGN) != 0;
+            if (!skip_selected || !(is_selected_h1 || (is_autoalign_h1 && is_selected_h2))) {
               has_snap |= test_projected_vert_dist(&neasrest_precalc,
                                                    clip_planes_local,
                                                    clip_plane_len,
@@ -2091,9 +2094,7 @@ static short snapCurve(SnapObjectContext *sctx,
                                                    r_loc);
             }
 
-            is_selected = (!(nu->bezt[u].f3 & SELECT) &&
-                           !(nu->bezt[u].h2 & HD_ALIGN && nu->bezt[u].f1 & SELECT)) != 0;
-            if (!(is_selected && skip_selected)) {
+            if (!skip_selected || !(is_selected_h2 || (is_autoalign_h2 && is_selected_h1))) {
               has_snap |= test_projected_vert_dist(&neasrest_precalc,
                                                    clip_planes_local,
                                                    clip_plane_len,



More information about the Bf-blender-cvs mailing list