Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-08-09 16:10:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-08-10 01:14:22 +0300
commit3daf5cc1ceb4854ba7ca481b9e2f1a5ed19bd2cb (patch)
tree5c1b49497d66ec2f6fb010e9ff60d29bdcde106f /source/blender
parenteb7b450c0c65388758fcec5764a759d3d347c314 (diff)
Gizmo: 2d select now takes region coords
Was taking an event, when only the region coords are needed.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c6
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c6
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c4
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c4
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo.c6
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c2
-rw-r--r--source/blender/windowmanager/gizmo/wm_gizmo_fn.h2
9 files changed, 19 insertions, 19 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 */
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 7a2460a7694..1eee5e5522f 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -111,7 +111,7 @@ static void rna_gizmo_draw_select_cb(
}
static int rna_gizmo_test_select_cb(
- struct bContext *C, struct wmGizmo *gz, const struct wmEvent *event)
+ struct bContext *C, struct wmGizmo *gz, const int location[2])
{
extern FunctionRNA rna_Gizmo_test_select_func;
wmGizmoGroup *gzgroup = gz->parent_gzgroup;
@@ -123,7 +123,7 @@ static int rna_gizmo_test_select_cb(
func = &rna_Gizmo_test_select_func;
RNA_parameter_list_create(&list, &gz_ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "event", &event);
+ RNA_parameter_set_lookup(&list, "location", location);
gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
void *ret;
@@ -966,7 +966,7 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
parm = RNA_def_pointer(func, "context", "Context", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "event", "Event", "", "");
+ parm = RNA_def_int_array(func, "location", 2, NULL, INT_MIN, INT_MAX, "Location", "Region coordinates", INT_MIN, INT_MAX);
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
parm = RNA_def_int(func, "intersect_id", 0, 0, INT_MAX, "", "", 0, INT_MAX);
RNA_def_function_return(func, parm);
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 204662b5713..5efc74b5bb8 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -153,7 +153,7 @@ wmGizmo *wm_gizmogroup_find_intersected_gizmo(
{
for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
if (gz->type->test_select && (gz->flag & WM_GIZMO_HIDDEN) == 0) {
- if ((*r_part = gz->type->test_select(C, gz, event)) != -1) {
+ if ((*r_part = gz->type->test_select(C, gz, event->mval)) != -1) {
return gz;
}
}
diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h
index a94f1e994e9..88065a0fcd5 100644
--- a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h
+++ b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h
@@ -51,7 +51,7 @@ typedef void (*wmGizmoGroupFnMsgBusSubscribe)(
typedef void (*wmGizmoFnSetup)(struct wmGizmo *);
typedef void (*wmGizmoFnDraw)(const struct bContext *, struct wmGizmo *);
typedef void (*wmGizmoFnDrawSelect)(const struct bContext *, struct wmGizmo *, int);
-typedef int (*wmGizmoFnTestSelect)(struct bContext *, struct wmGizmo *, const struct wmEvent *);
+typedef int (*wmGizmoFnTestSelect)(struct bContext *, struct wmGizmo *, const int mval[2]);
typedef int (*wmGizmoFnModal)(struct bContext *, struct wmGizmo *, const struct wmEvent *, eWM_GizmoFlagTweak);
typedef void (*wmGizmoFnPropertyUpdate)(struct wmGizmo *, struct wmGizmoProperty *);
typedef void (*wmGizmoFnMatrixBasisGet)(const struct wmGizmo *, float[4][4]);