[Bf-blender-cvs] [1ad11355a35] master: Transform: fix use of "snap_point" property

Germano Cavalcante noreply at git.blender.org
Tue Jan 24 21:11:38 CET 2023


Commit: 1ad11355a3578dc24496417a517d3ce2faebb248
Author: Germano Cavalcante
Date:   Tue Jan 24 17:06:53 2023 -0300
Branches: master
https://developer.blender.org/rB1ad11355a3578dc24496417a517d3ce2faebb248

Transform: fix use of "snap_point" property

There is not much documentation on the "snap_point" property, but by
code it is possible to note that it serves to set a target snap point
and is of internal use as it is hidden from the Redo panel.

However, this property was still very dependent on Tools settings and
if set to an operator's call, it changes the scene configurations
inadequately.

Therefore,
- remove this dependency from UI for rotation and resize operators,
- do not change the state of the snap in the scene and
- cleanup the code.

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

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

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

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index c9cf572e9ad..3cff4c11cad 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1586,7 +1586,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
     /* Update `ToolSettings` for properties that change during modal. */
     if (t->flag & T_MODAL) {
       /* Do we check for parameter? */
-      if (transformModeUseSnap(t)) {
+      if (transformModeUseSnap(t) && !(t->tsnap.status & SNAP_FORCED)) {
         if (!(t->modifiers & MOD_SNAP) != !(t->tsnap.flag & SCE_SNAP)) {
           /* Type is #eSnapFlag, but type must match various snap attributes in #ToolSettings. */
           short *snap_flag_ptr;
diff --git a/source/blender/editors/transform/transform_snap.cc b/source/blender/editors/transform/transform_snap.cc
index 2f5e1974d0b..8a1cb2d9788 100644
--- a/source/blender/editors/transform/transform_snap.cc
+++ b/source/blender/editors/transform/transform_snap.cc
@@ -147,6 +147,10 @@ bool transformModeUseSnap(const TransInfo *t)
 
 static bool doForceIncrementSnap(const TransInfo *t)
 {
+  if (t->tsnap.status & SNAP_FORCED) {
+    return false;
+  }
+
   return !transformModeUseSnap(t);
 }
 
@@ -525,13 +529,7 @@ void transform_snap_mixed_apply(TransInfo *t, float *vec)
     return;
   }
 
-  if (t->tsnap.status & SNAP_FORCED) {
-    t->tsnap.snap_source_fn(t);
-
-    t->tsnap.snap_mode_apply_fn(t, vec);
-  }
-  else if (((t->tsnap.mode & ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID)) != 0) &&
-           transform_snap_is_active(t)) {
+  if (t->tsnap.mode & ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID)) {
     double current = PIL_check_seconds_timer();
 
     /* Time base quirky code to go around find-nearest slowness. */



More information about the Bf-blender-cvs mailing list