diff options
Diffstat (limited to 'source')
4 files changed, 26 insertions, 19 deletions
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 f9b9afc4feb..c21535de4d5 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c @@ -319,9 +319,7 @@ short ED_gizmotypes_snap_3d_update(wmGizmo *gz, const ARegion *region, const View3D *v3d, const wmWindowManager *wm, - const float mval_fl[2], - float r_loc[3], - float r_nor[3]) + const float mval_fl[2]) { SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)gz; snap_gizmo->is_enabled = false; @@ -410,15 +408,25 @@ short ED_gizmotypes_snap_3d_update(wmGizmo *gz, copy_v3_v3(snap_gizmo->nor, no); copy_v3_v3_int(snap_gizmo->elem_index, snap_elem_index); + return snap_elem; +} + +void ED_gizmotypes_snap_3d_data_get( + wmGizmo *gz, float r_loc[3], float r_nor[3], int r_elem_index[3], int *r_snap_elem) +{ + SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)gz; if (r_loc) { - copy_v3_v3(r_loc, co); + copy_v3_v3(r_loc, snap_gizmo->loc); } - if (r_nor) { - copy_v3_v3(r_nor, no); + copy_v3_v3(r_nor, snap_gizmo->nor); + } + if (r_elem_index) { + copy_v3_v3_int(r_elem_index, snap_gizmo->elem_index); + } + if (r_snap_elem) { + *r_snap_elem = snap_gizmo->snap_elem; } - - return snap_elem; } /** \} */ @@ -608,7 +616,7 @@ static int snap_gizmo_test_select(bContext *C, wmGizmo *gz, const int mval[2]) View3D *v3d = CTX_wm_view3d(C); const float mval_fl[2] = {UNPACK2(mval)}; short snap_elem = ED_gizmotypes_snap_3d_update( - gz, CTX_data_ensure_evaluated_depsgraph(C), region, v3d, wm, mval_fl, NULL, NULL); + gz, CTX_data_ensure_evaluated_depsgraph(C), region, v3d, wm, mval_fl); if (snap_elem) { ED_region_tag_redraw_editor_overlays(region); diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h index dfc8cfea5ce..1c795896f86 100644 --- a/source/blender/editors/include/ED_gizmo_library.h +++ b/source/blender/editors/include/ED_gizmo_library.h @@ -271,9 +271,9 @@ short ED_gizmotypes_snap_3d_update(struct wmGizmo *gz, const struct ARegion *region, const struct View3D *v3d, const struct wmWindowManager *wm, - const float mval_fl[2], - float r_loc[3], - float r_nor[3]); + const float mval_fl[2]); +void ED_gizmotypes_snap_3d_data_get( + struct wmGizmo *gz, float r_loc[3], float r_nor[3], int r_elem_index[3], int *r_snap_elem); #ifdef __cplusplus } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index 870996ddefa..833901b6770 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -387,7 +387,9 @@ static bool view3d_ruler_item_mousemove(struct Depsgraph *depsgraph, } ED_gizmotypes_snap_3d_update( - snap_gizmo, depsgraph, ruler_info->region, v3d, ruler_info->wm, mval_fl, co, NULL); + snap_gizmo, depsgraph, ruler_info->region, v3d, ruler_info->wm, mval_fl); + + ED_gizmotypes_snap_3d_data_get(snap_gizmo, co, NULL, NULL, NULL); } return true; } diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c index 48f274ca71b..b0dfd4af7c5 100644 --- a/source/blender/editors/space_view3d/view3d_placement.c +++ b/source/blender/editors/space_view3d/view3d_placement.c @@ -1058,9 +1058,7 @@ static void view3d_interactive_add_begin(bContext *C, wmOperator *op, const wmEv ipd->region, ipd->v3d, G_MAIN->wm.first, - mval_fl, - NULL, - NULL); + mval_fl); } } @@ -1507,9 +1505,8 @@ static int view3d_interactive_add_modal(bContext *C, wmOperator *op, const wmEve ipd->region, ipd->v3d, G_MAIN->wm.first, - mval_fl, - ipd->snap_co, - NULL)) { + mval_fl)) { + ED_gizmotypes_snap_3d_data_get(ipd->snap_gizmo, ipd->snap_co, NULL, NULL, NULL); ipd->is_snap_found = true; } ED_gizmotypes_snap_3d_toggle_clear(ipd->snap_gizmo); |