[Bf-blender-cvs] [bc6965cb981] blender-v3.2-release: Fix T98230: Automatic Constraint doesn't work if cursor is not moving

Germano Cavalcante noreply at git.blender.org
Thu May 19 17:23:06 CEST 2022


Commit: bc6965cb981e12855354bbdcf5dcdd5edff3ff4a
Author: Germano Cavalcante
Date:   Thu May 19 12:21:03 2022 -0300
Branches: blender-v3.2-release
https://developer.blender.org/rBbc6965cb981e12855354bbdcf5dcdd5edff3ff4a

Fix T98230: Automatic Constraint doesn't work if cursor is not moving

The change was kind of intentional on {rB21e72496a629}.

That commit made mouse movement to "select" the contraint in Auto
Constraint a requirement.

This deduplicated the code a bit, but this requirement is not
comfortable for the first "selection" of the contraint.

So the constraint "selection" is now done in two ways:
- If there is no contraint, the "selection" is done immediately;
- If there is already a constraint, the "selection" is delayed by 1 event to simulate a constraint cancellation if there is no mouse movement.

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

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

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

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 7a2a2a8a5e8..7ae041f2b2f 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1172,12 +1172,20 @@ int transformEvent(TransInfo *t, const wmEvent *event)
                                   MOD_CONSTRAINT_SELECT_PLANE;
               if (t->con.mode & CON_APPLY) {
                 stopConstraint(t);
+                initSelectConstraint(t);
+
+                /* In this case we might just want to remove the contraint,
+                 * so set #TREDRAW_SOFT to only select the constraint on the next mouse move event.
+                 * This way we can kind of "cancel" due to confirmation without constraint. */
+                t->redraw = TREDRAW_SOFT;
               }
+              else {
+                initSelectConstraint(t);
 
-              initSelectConstraint(t);
-              /* Use #TREDRAW_SOFT so that #selectConstraint is only called on the next event.
-               * This allows us to "deselect" the constraint. */
-              t->redraw = TREDRAW_SOFT;
+                /* When first called, set #TREDRAW_HARD to select constraint immediately in
+                 * #selectConstraint. */
+                BLI_assert(t->redraw == TREDRAW_HARD);
+              }
             }
           }
           handled = true;



More information about the Bf-blender-cvs mailing list