diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-04-17 22:38:57 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-04-17 22:51:19 +0300 |
commit | 1544bcfc37b8ac777e747c3584bd6736149d9442 (patch) | |
tree | 2751abced127e43374945a26b0a3c1836735373f /source/blender/editors/space_view3d | |
parent | 4e1507bd3b9f28746d4c207391020a5eae8f77ad (diff) |
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.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_gizmo_ruler.c | 7 |
1 files changed, 4 insertions, 3 deletions
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); |