[Bf-blender-cvs] [0349a6e6e05] master: Fix disappearing snap indication in Measure tool

Germano Cavalcante noreply at git.blender.org
Thu Jan 12 03:02:48 CET 2023


Commit: 0349a6e6e05ee5f3c941890a8ce4062615ecf5cc
Author: Germano Cavalcante
Date:   Wed Jan 11 23:00:51 2023 -0300
Branches: master
https://developer.blender.org/rB0349a6e6e05ee5f3c941890a8ce4062615ecf5cc

Fix disappearing snap indication in Measure tool

Snap cursor disappeared while dragging.

Regression in 2b32a2c3b

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

M	source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
M	source/blender/editors/space_view3d/view3d_gizmo_ruler.c

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

diff --git a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
index 4a5bad575e7..571a2b6ef61 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
@@ -242,7 +242,8 @@ static void snap_cursor_free(SnapGizmo3D *snap_gizmo)
 static bool snap_cursor_poll(ARegion *region, void *data)
 {
   SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)data;
-  if (!(snap_gizmo->gizmo.state & WM_GIZMO_STATE_HIGHLIGHT)) {
+  if (!(snap_gizmo->gizmo.state & WM_GIZMO_STATE_HIGHLIGHT) &&
+      !(snap_gizmo->gizmo.flag & WM_GIZMO_DRAW_VALUE)) {
     return false;
   }
 
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index c94043f2397..b9a30eac3c6 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -301,10 +301,13 @@ static void ruler_state_set(RulerInfo *ruler_info, int state)
   }
 
   if (state == RULER_STATE_NORMAL) {
-    /* pass */
+    WM_gizmo_set_flag(ruler_info->snap_data.gizmo, WM_GIZMO_DRAW_VALUE, false);
   }
   else if (state == RULER_STATE_DRAG) {
     memset(&ruler_info->drag_state_prev, 0x0, sizeof(ruler_info->drag_state_prev));
+
+    /* Force the snap cursor to appear even though it is not highlighted. */
+    WM_gizmo_set_flag(ruler_info->snap_data.gizmo, WM_GIZMO_DRAW_VALUE, true);
   }
   else {
     BLI_assert(0);



More information about the Bf-blender-cvs mailing list