[Bf-blender-cvs] [1544bcfc37b] master: Measure Tool: Snap to Cage Geometry

Germano Cavalcante noreply at git.blender.org
Sat Apr 17 21:52:18 CEST 2021


Commit: 1544bcfc37b8ac777e747c3584bd6736149d9442
Author: Germano Cavalcante
Date:   Sat Apr 17 16:38:57 2021 -0300
Branches: master
https://developer.blender.org/rB1544bcfc37b8ac777e747c3584bd6736149d9442

Measure Tool: Snap to Cage Geometry

For Measure tool, it is more useful to snap to what is really visible.

So use the cage instead of the geometry that may be hidden with Bmesh.

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

M	source/blender/editors/space_view3d/view3d_gizmo_ruler.c

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

diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index 0d8382d8cdd..3134553c159 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -338,7 +338,7 @@ static bool view3d_ruler_item_mousemove(struct Depsgraph *depsgraph,
                                                   SCE_SNAP_MODE_FACE,
                                                   &(const struct SnapObjectParams){
                                                       .snap_select = SNAP_ALL,
-                                                      .edit_mode_type = SNAP_GEOM_EDIT,
+                                                      .edit_mode_type = SNAP_GEOM_CAGE,
                                                   },
                                                   mval_fl,
                                                   NULL,
@@ -352,7 +352,7 @@ static bool view3d_ruler_item_mousemove(struct Depsgraph *depsgraph,
                                              depsgraph,
                                              &(const struct SnapObjectParams){
                                                  .snap_select = SNAP_ALL,
-                                                 .edit_mode_type = SNAP_GEOM_EDIT,
+                                                 .edit_mode_type = SNAP_GEOM_CAGE,
                                              },
                                              ray_start,
                                              ray_normal,
@@ -1124,12 +1124,13 @@ static void WIDGETGROUP_ruler_setup(const bContext *C, wmGizmoGroup *gzgroup)
     const wmGizmoType *gzt_snap;
     gzt_snap = WM_gizmotype_find("GIZMO_GT_snap_3d", true);
     gizmo = WM_gizmo_new_ptr(gzt_snap, gzgroup, NULL);
+
     RNA_enum_set(gizmo->ptr,
                  "snap_elements_force",
                  (SCE_SNAP_MODE_VERTEX | SCE_SNAP_MODE_EDGE | SCE_SNAP_MODE_FACE |
                   /* SCE_SNAP_MODE_VOLUME | SCE_SNAP_MODE_GRID | SCE_SNAP_MODE_INCREMENT | */
                   SCE_SNAP_MODE_EDGE_PERPENDICULAR | SCE_SNAP_MODE_EDGE_MIDPOINT));
-
+    ED_gizmotypes_snap_3d_flag_set(gizmo, ED_SNAPGIZMO_SNAP_EDIT_GEOM_CAGE);
     WM_gizmo_set_color(gizmo, (float[4]){1.0f, 1.0f, 1.0f, 1.0f});
 
     wmOperatorType *ot = WM_operatortype_find("VIEW3D_OT_ruler_add", true);



More information about the Bf-blender-cvs mailing list