diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-08-09 16:10:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-08-10 01:14:22 +0300 |
commit | 3daf5cc1ceb4854ba7ca481b9e2f1a5ed19bd2cb (patch) | |
tree | 5c1b49497d66ec2f6fb010e9ff60d29bdcde106f /source/blender/editors | |
parent | eb7b450c0c65388758fcec5764a759d3d347c314 (diff) |
Gizmo: 2d select now takes region coords
Was taking an event, when only the region coords are needed.
Diffstat (limited to 'source/blender/editors')
6 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c index cb8e2a90b07..953e763a33c 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c @@ -140,15 +140,15 @@ static int gizmo_arrow2d_invoke( } static int gizmo_arrow2d_test_select( - bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event) + bContext *UNUSED(C), wmGizmo *gz, const int mval[2]) { - const float mval[2] = {event->mval[0], event->mval[1]}; + const float mval_fl[2] = {UNPACK2(mval)}; const float arrow_length = RNA_float_get(gz->ptr, "length"); const float arrow_angle = RNA_float_get(gz->ptr, "angle"); const float line_len = arrow_length * gz->scale_final; float mval_local[2]; - copy_v2_v2(mval_local, mval); + copy_v2_v2(mval_local, mval_fl); sub_v2_v2(mval_local, gz->matrix_basis[3]); float line[2][2]; diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c index d976adc06bf..dfc0dcd791c 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c @@ -232,20 +232,20 @@ static void gizmo_button2d_draw(const bContext *C, wmGizmo *gz) } static int gizmo_button2d_test_select( - bContext *C, wmGizmo *gz, const wmEvent *event) + bContext *C, wmGizmo *gz, const int mval[2]) { float point_local[2]; if (0) { /* correct, but unnecessarily slow. */ if (gizmo_window_project_2d( - C, gz, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false) + C, gz, (const float[2]){UNPACK2(mval)}, 2, true, point_local) == false) { return -1; } } else { - copy_v2_v2(point_local, (float[2]){UNPACK2(event->mval)}); + copy_v2_v2(point_local, (float[2]){UNPACK2(mval)}); sub_v2_v2(point_local, gz->matrix_basis[3]); mul_v2_fl(point_local, 1.0f / (gz->scale_basis * UI_DPI_FAC)); } diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c index 2869b93a790..bb9cac595be 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c @@ -718,7 +718,7 @@ static int gizmo_cage2d_get_cursor(wmGizmo *gz) } static int gizmo_cage2d_test_select( - bContext *C, wmGizmo *gz, const wmEvent *event) + bContext *C, wmGizmo *gz, const int mval[2]) { float point_local[2]; float dims[2]; @@ -726,7 +726,7 @@ static int gizmo_cage2d_test_select( const float size_real[2] = {dims[0] / 2.0f, dims[1] / 2.0f}; if (gizmo_window_project_2d( - C, gz, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false) + C, gz, (const float[2]){UNPACK2(mval)}, 2, true, point_local) == false) { return -1; } diff --git a/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c index 8d4db81c11f..fcbd333078d 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c @@ -293,12 +293,12 @@ static int gizmo_grab_invoke( static int gizmo_grab_test_select( - bContext *C, wmGizmo *gz, const wmEvent *event) + bContext *C, wmGizmo *gz, const int mval[2]) { float point_local[2]; if (gizmo_window_project_2d( - C, gz, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false) + C, gz, (const float[2]){UNPACK2(mval)}, 2, true, point_local) == false) { return -1; } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index 93617f22490..5a4f910955e 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -343,9 +343,9 @@ static void gizmo_axis_draw(const bContext *C, wmGizmo *gz) } static int gizmo_axis_test_select( - bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event) + bContext *UNUSED(C), wmGizmo *gz, const int mval[2]) { - float point_local[2] = {UNPACK2(event->mval)}; + float point_local[2] = {UNPACK2(mval)}; sub_v2_v2(point_local, gz->matrix_basis[3]); mul_v2_fl(point_local, 1.0f / (gz->scale_basis * UI_DPI_FAC)); diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index fb335d5f922..5853fa6e3b3 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -799,10 +799,10 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) } static int gizmo_ruler_test_select( - bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event) + bContext *UNUSED(C), wmGizmo *gz, const int mval[2]) { RulerItem *ruler_item_pick = (RulerItem *)gz; - float mval_fl[2] = {UNPACK2(event->mval)}; + float mval_fl[2] = {UNPACK2(mval)}; int co_index; /* select and drag */ |