From b6a0027de3a5ee039442f10cf7f9bc1bf3116733 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 27 May 2019 23:58:12 +1000 Subject: Gizmo: add event argument to invoke_prepare callback --- source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c | 3 ++- source/blender/editors/transform/transform_gizmo_3d.c | 5 ++++- source/blender/editors/transform/transform_gizmo_extrude_3d.c | 3 ++- source/blender/makesrna/intern/rna_wm_gizmo.c | 6 +++++- source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c | 2 +- source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | 2 +- source/blender/windowmanager/gizmo/wm_gizmo_fn.h | 3 ++- 7 files changed, 17 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c index 269ead7b23f..74700e59e99 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c @@ -295,7 +295,8 @@ static void gizmo_mesh_spin_init_draw_prepare(const bContext *C, wmGizmoGroup *g static void gizmo_mesh_spin_init_invoke_prepare(const bContext *UNUSED(C), wmGizmoGroup *gzgroup, - wmGizmo *gz) + wmGizmo *gz, + const wmEvent *UNUSED(event)) { /* Set the initial ortho axis. */ GizmoGroupData_SpinInit *ggd = gzgroup->customdata; diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index ef3abe96f46..68885a72092 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -1857,7 +1857,10 @@ static void WIDGETGROUP_gizmo_draw_prepare(const bContext *C, wmGizmoGroup *gzgr } } -static void WIDGETGROUP_gizmo_invoke_prepare(const bContext *C, wmGizmoGroup *gzgroup, wmGizmo *gz) +static void WIDGETGROUP_gizmo_invoke_prepare(const bContext *C, + wmGizmoGroup *gzgroup, + wmGizmo *gz, + const wmEvent *UNUSED(event)) { GizmoGroup *ggd = gzgroup->customdata; diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c index 47a584561f9..24ef92b3153 100644 --- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c +++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c @@ -385,7 +385,8 @@ static void gizmo_mesh_extrude_draw_prepare(const bContext *C, wmGizmoGroup *gzg static void gizmo_mesh_extrude_invoke_prepare(const bContext *UNUSED(C), wmGizmoGroup *gzgroup, - wmGizmo *gz) + wmGizmo *gz, + const wmEvent *UNUSED(event)) { GizmoExtrudeGroup *ggd = gzgroup->customdata; if (ELEM(gz, ggd->adjust[0], ggd->adjust[1])) { diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c index 22162aa017b..b13c5da7002 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo.c +++ b/source/blender/makesrna/intern/rna_wm_gizmo.c @@ -744,7 +744,10 @@ static void rna_gizmogroup_draw_prepare_cb(const bContext *C, wmGizmoGroup *gzgr RNA_parameter_list_free(&list); } -static void rna_gizmogroup_invoke_prepare_cb(const bContext *C, wmGizmoGroup *gzgroup, wmGizmo *gz) +static void rna_gizmogroup_invoke_prepare_cb(const bContext *C, + wmGizmoGroup *gzgroup, + wmGizmo *gz, + const wmEvent *event) { extern FunctionRNA rna_GizmoGroup_invoke_prepare_func; @@ -759,6 +762,7 @@ static void rna_gizmogroup_invoke_prepare_cb(const bContext *C, wmGizmoGroup *gz RNA_parameter_list_create(&list, &gzgroup_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); RNA_parameter_set_lookup(&list, "gizmo", &gz); + RNA_parameter_set_lookup(&list, "event", &event); gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list); RNA_parameter_list_free(&list); diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c index 95cb86ef3cb..ded308f4b7b 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c @@ -411,7 +411,7 @@ static bool gizmo_tweak_start_and_finish( } else { if (gz->parent_gzgroup->type->invoke_prepare) { - gz->parent_gzgroup->type->invoke_prepare(C, gz->parent_gzgroup, gz); + gz->parent_gzgroup->type->invoke_prepare(C, gz->parent_gzgroup, gz, event); } /* Allow for 'button' gizmos, single click to run an action. */ WM_gizmo_operator_invoke(C, gz, gzop); diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c index 1f29ffd5669..9c18406b84d 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c @@ -1010,7 +1010,7 @@ void wm_gizmomap_modal_set( /* Use even if we don't have invoke, so we can setup data before an operator runs. */ if (gz->parent_gzgroup->type->invoke_prepare) { - gz->parent_gzgroup->type->invoke_prepare(C, gz->parent_gzgroup, gz); + gz->parent_gzgroup->type->invoke_prepare(C, gz->parent_gzgroup, gz, event); } if (gz->type->invoke && (gz->type->modal || gz->custom_modal)) { diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h index 2aada0f202a..242b0f6de80 100644 --- a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h +++ b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h @@ -33,7 +33,8 @@ typedef void (*wmGizmoGroupFnRefresh)(const struct bContext *, struct wmGizmoGro typedef void (*wmGizmoGroupFnDrawPrepare)(const struct bContext *, struct wmGizmoGroup *); typedef void (*wmGizmoGroupFnInvokePrepare)(const struct bContext *, struct wmGizmoGroup *, - struct wmGizmo *); + struct wmGizmo *, + const struct wmEvent *); typedef struct wmKeyMap *(*wmGizmoGroupFnSetupKeymap)(const struct wmGizmoGroupType *, struct wmKeyConfig *)ATTR_WARN_UNUSED_RESULT; typedef void (*wmGizmoGroupFnMsgBusSubscribe)(const struct bContext *, -- cgit v1.2.3