diff options
57 files changed, 137 insertions, 112 deletions
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 6ae82a754aa..e1e974ff119 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -979,7 +979,7 @@ static int add_driver_button_menu_exec(bContext *C, wmOperator *op) /* XXX: We assume that it's fine to use the same set of properties, * since they're actually the same. */ - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, op->ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, op->ptr, NULL); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc index 1d484f9ce85..f0768ebc907 100644 --- a/source/blender/editors/asset/intern/asset_ops.cc +++ b/source/blender/editors/asset/intern/asset_ops.cc @@ -754,7 +754,7 @@ static int asset_bundle_install_exec(bContext *C, wmOperator *op) cat_service->prepare_to_merge_on_write(); const int operator_result = WM_operator_name_call( - C, "WM_OT_save_mainfile", WM_OP_EXEC_DEFAULT, op->ptr); + C, "WM_OT_save_mainfile", WM_OP_EXEC_DEFAULT, op->ptr, nullptr); WM_cursor_wait(false); if (operator_result != OPERATOR_FINISHED) { diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index b33b676c078..338f6be4c89 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -2484,7 +2484,7 @@ static int annotation_draw_modal(bContext *C, wmOperator *op, const wmEvent *eve * - Since this operator is non-modal, we can just call it here, and keep going... * - This operator is especially useful when animating */ - WM_operator_name_call(C, "GPENCIL_OT_blank_frame_add", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, "GPENCIL_OT_blank_frame_add", WM_OP_EXEC_DEFAULT, NULL, event); estate = OPERATOR_RUNNING_MODAL; } else { diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index d734fb2678e..52ce7a7b8e1 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1928,7 +1928,7 @@ static int gpencil_blank_frame_add_exec(bContext *C, wmOperator *op) if (ELEM(NULL, gpd, active_gpl)) { /* Let's just be lazy, and call the "Add New Layer" operator, * which sets everything up as required. */ - WM_operator_name_call(C, "GPENCIL_OT_layer_add", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, "GPENCIL_OT_layer_add", WM_OP_EXEC_DEFAULT, NULL, NULL); } /* Go through each layer, adding a frame after the active one diff --git a/source/blender/editors/gpencil/gpencil_vertex_ops.c b/source/blender/editors/gpencil/gpencil_vertex_ops.c index f49523925bc..c0888968a2d 100644 --- a/source/blender/editors/gpencil/gpencil_vertex_ops.c +++ b/source/blender/editors/gpencil/gpencil_vertex_ops.c @@ -959,7 +959,7 @@ static int gpencil_material_to_vertex_exec(bContext *C, wmOperator *op) /* Clean unused materials. */ if (remove) { WM_operator_name_call( - C, "OBJECT_OT_material_slot_remove_unused", WM_OP_INVOKE_REGION_WIN, NULL); + C, "OBJECT_OT_material_slot_remove_unused", WM_OP_INVOKE_REGION_WIN, NULL, NULL); } return OPERATOR_FINISHED; diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 46baf3033ff..e838ce37d8e 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -299,13 +299,13 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) void ui_but_anim_copy_driver(bContext *C) { /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_copy_driver_button", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "ANIM_OT_copy_driver_button", WM_OP_INVOKE_DEFAULT, NULL, NULL); } void ui_but_anim_paste_driver(bContext *C) { /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_paste_driver_button", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "ANIM_OT_paste_driver_button", WM_OP_INVOKE_DEFAULT, NULL, NULL); } void ui_but_anim_decorate_cb(bContext *C, void *arg_but, void *UNUSED(arg_dummy)) @@ -331,7 +331,7 @@ void ui_but_anim_decorate_cb(bContext *C, void *arg_but, void *UNUSED(arg_dummy) wmOperatorType *ot = WM_operatortype_find("ANIM_OT_keyframe_delete_button", false); WM_operator_properties_create_ptr(&props_ptr, ot); RNA_boolean_set(&props_ptr, "all", but_anim->rnaindex == -1); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, NULL); WM_operator_properties_free(&props_ptr); } else { @@ -339,7 +339,7 @@ void ui_but_anim_decorate_cb(bContext *C, void *arg_but, void *UNUSED(arg_dummy) wmOperatorType *ot = WM_operatortype_find("ANIM_OT_keyframe_insert_button", false); WM_operator_properties_create_ptr(&props_ptr, ot); RNA_boolean_set(&props_ptr, "all", but_anim->rnaindex == -1); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, NULL); WM_operator_properties_free(&props_ptr); } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 2386b388a41..a8b21bebb2b 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1007,7 +1007,7 @@ static void ui_apply_but_funcs_after(bContext *C) if (after.optype) { WM_operator_name_call_ptr_with_depends_on_cursor( - C, after.optype, after.opcontext, (after.opptr) ? &opptr : NULL, after.drawstr); + C, after.optype, after.opcontext, (after.opptr) ? &opptr : NULL, NULL, after.drawstr); } if (after.opptr) { @@ -4190,6 +4190,7 @@ static void ui_but_extra_operator_icon_apply(bContext *C, uiBut *but, uiButExtra op_icon->optype_params->optype, op_icon->optype_params->opcontext, op_icon->optype_params->opptr, + NULL, NULL); /* Force recreation of extra operator icons (pseudo update). */ diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 0722584c7d8..1d1bb85bd36 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1673,7 +1673,7 @@ static int edittranslation_exec(bContext *C, wmOperator *op) RNA_string_set(&ptr, "rna_prop", rna_prop.strinfo); RNA_string_set(&ptr, "rna_enum", rna_enum.strinfo); RNA_string_set(&ptr, "rna_ctxt", rna_ctxt.strinfo); - const int ret = WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr); + const int ret = WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr, NULL); /* Clean up */ if (but_label.strinfo) { diff --git a/source/blender/editors/interface/interface_template_search_menu.cc b/source/blender/editors/interface/interface_template_search_menu.cc index 160cc909036..8e4b2baed53 100644 --- a/source/blender/editors/interface/interface_template_search_menu.cc +++ b/source/blender/editors/interface/interface_template_search_menu.cc @@ -951,7 +951,7 @@ static void menu_search_exec_fn(bContext *C, void *UNUSED(arg1), void *arg2) case MenuSearch_Item::Type::Operator: { CTX_store_set(C, item->op.context); WM_operator_name_call_ptr_with_depends_on_cursor( - C, item->op.type, item->op.opcontext, item->op.opptr, item->drawstr); + C, item->op.type, item->op.opcontext, item->op.opptr, nullptr, item->drawstr); CTX_store_set(C, nullptr); break; } diff --git a/source/blender/editors/interface/interface_template_search_operator.c b/source/blender/editors/interface/interface_template_search_operator.c index 4783a3f2ac6..41de2ab197d 100644 --- a/source/blender/editors/interface/interface_template_search_operator.c +++ b/source/blender/editors/interface/interface_template_search_operator.c @@ -38,7 +38,7 @@ static void operator_search_exec_fn(bContext *C, void *UNUSED(arg1), void *arg2) wmOperatorType *ot = arg2; if (ot) { - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, NULL, NULL); } } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 43968e2c986..09cccbd6b4b 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2013,7 +2013,7 @@ static void constraint_reorder(bContext *C, Panel *panel, int new_index) RNA_int_set(&props_ptr, "index", new_index); /* Set owner to #EDIT_CONSTRAINT_OWNER_OBJECT or #EDIT_CONSTRAINT_OWNER_BONE. */ RNA_enum_set(&props_ptr, "owner", constraint_from_bone ? 1 : 0); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, NULL); WM_operator_properties_free(&props_ptr); } @@ -5653,7 +5653,7 @@ static void do_running_jobs(bContext *C, void *UNUSED(arg), int event) WM_jobs_stop(CTX_wm_manager(C), CTX_wm_screen(C), NULL); break; case B_STOPANIM: - WM_operator_name_call(C, "SCREEN_OT_animation_play", WM_OP_INVOKE_SCREEN, NULL); + WM_operator_name_call(C, "SCREEN_OT_animation_play", WM_OP_INVOKE_SCREEN, NULL, NULL); break; case B_STOPCOMPO: WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL); diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 28a025ee581..0b4d00a7def 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -270,7 +270,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event) view_pan_exit(op); WM_cursor_modal_restore(CTX_wm_window(C)); - WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL, event); return OPERATOR_FINISHED; } #endif diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index a8d62d90698..6b4edea498e 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -1017,7 +1017,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (bm->totfacesel) { /* highly nifty but hard to support since the operator can fail and we're left * with modified selection */ - // WM_operator_name_call(C, "MESH_OT_region_to_loop", WM_OP_INVOKE_DEFAULT, NULL); + // WM_operator_name_call(C, "MESH_OT_region_to_loop", WM_OP_INVOKE_DEFAULT, NULL, event); continue; } error_face_selected = false; diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c index 8e9e8558016..cc6aa34d39d 100644 --- a/source/blender/editors/object/object_modes.c +++ b/source/blender/editors/object/object_modes.c @@ -158,7 +158,7 @@ bool ED_object_mode_compat_set(bContext *C, Object *ob, eObjectMode mode, Report if (!ELEM(ob->mode, mode, OB_MODE_OBJECT)) { const char *opstring = object_mode_op_string(ob->mode); - WM_operator_name_call(C, opstring, WM_OP_EXEC_REGION_WIN, NULL); + WM_operator_name_call(C, opstring, WM_OP_EXEC_REGION_WIN, NULL, NULL); ok = ELEM(ob->mode, mode, OB_MODE_OBJECT); if (!ok) { wmOperatorType *ot = WM_operatortype_find(opstring, false); @@ -209,7 +209,7 @@ bool ED_object_mode_set_ex(bContext *C, eObjectMode mode, bool use_undo, ReportL if (!use_undo) { wm->op_undo_depth++; } - WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_REGION_WIN, NULL); + WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_REGION_WIN, NULL, NULL); if (!use_undo) { wm->op_undo_depth--; } diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c index 57c8bd58549..22d6626ab16 100644 --- a/source/blender/editors/sculpt_paint/paint_curve.c +++ b/source/blender/editors/sculpt_paint/paint_curve.c @@ -680,7 +680,7 @@ static int paintcurve_draw_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_PASS_THROUGH; } - return WM_operator_name_call(C, name, WM_OP_INVOKE_DEFAULT, NULL); + return WM_operator_name_call(C, name, WM_OP_INVOKE_DEFAULT, NULL, NULL); } void PAINTCURVE_OT_draw(wmOperatorType *ot) diff --git a/source/blender/editors/sculpt_paint/sculpt_detail.c b/source/blender/editors/sculpt_paint/sculpt_detail.c index 0f1f7c57287..dd8921d575f 100644 --- a/source/blender/editors/sculpt_paint/sculpt_detail.c +++ b/source/blender/editors/sculpt_paint/sculpt_detail.c @@ -408,7 +408,7 @@ static void sculpt_detail_size_set_radial_control(bContext *C) RNA_string_set(&props_ptr, "data_path_primary", "tool_settings.sculpt.detail_size"); } - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, NULL); WM_operator_properties_free(&props_ptr); } diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index e215b7c7992..3de181fa540 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -295,7 +295,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event) WM_operator_properties_create_ptr(&props_ptr, ot); RNA_string_set(&props_ptr, "filepath", str); - WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &props_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &props_ptr, NULL); WM_operator_properties_free(&props_ptr); MEM_freeN(str); diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index a24eae6a0ce..17fbef23eac 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -469,10 +469,10 @@ static int console_indent_or_autocomplete_exec(bContext *C, wmOperator *UNUSED(o } if (text_before_cursor) { - WM_operator_name_call(C, "CONSOLE_OT_autocomplete", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "CONSOLE_OT_autocomplete", WM_OP_INVOKE_DEFAULT, NULL, NULL); } else { - WM_operator_name_call(C, "CONSOLE_OT_indent", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, "CONSOLE_OT_indent", WM_OP_EXEC_DEFAULT, NULL, NULL); } return OPERATOR_FINISHED; } @@ -1070,7 +1070,7 @@ static int console_paste_exec(bContext *C, wmOperator *UNUSED(op)) } if (buf_next != buf_str) { - WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL, NULL); ci = console_history_verify(C); } diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index d051f14d264..8e33f7fa97f 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -189,7 +189,7 @@ static void console_main_region_draw(const bContext *C, ARegion *region) View2D *v2d = ®ion->v2d; if (BLI_listbase_is_empty(&sc->scrollback)) { - WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL, NULL); } /* clear and setup matrix */ diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index c859cad1c27..578288ca289 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -2221,7 +2221,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w RNA_int_set(&op_ptr, "deltax", deltax); RNA_int_set(&op_ptr, "deltay", deltay); - WM_operator_name_call(C, "VIEW2D_OT_pan", WM_OP_EXEC_DEFAULT, &op_ptr); + WM_operator_name_call(C, "VIEW2D_OT_pan", WM_OP_EXEC_DEFAULT, &op_ptr, event); WM_operator_properties_free(&op_ptr); ED_region_tag_redraw(region); @@ -2580,7 +2580,7 @@ void file_directory_enter_handle(bContext *C, void *UNUSED(arg_unused), void *UN BLI_strncpy(params->dir, lastdir, sizeof(params->dir)); } - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr, NULL); WM_operator_properties_free(&ptr); } } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index aed4a2ccabd..6a16efdb413 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2155,7 +2155,7 @@ static int image_save_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int image_save_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +static int image_save_invoke(bContext *C, wmOperator *op, const wmEvent *event) { Image *ima = image_from_context(C); ImageUser *iuser = image_user_from_context(C); @@ -2163,7 +2163,7 @@ static int image_save_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( /* Not writable formats or images without a file-path will go to "Save As". */ if (!BKE_image_has_packedfile(ima) && (!BKE_image_has_filepath(ima) || !image_file_format_writable(ima, iuser))) { - WM_operator_name_call(C, "IMAGE_OT_save_as", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "IMAGE_OT_save_as", WM_OP_INVOKE_DEFAULT, NULL, event); return OPERATOR_CANCELLED; } return image_save_exec(C, op); diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 603c7c9ad37..ba11c5b2958 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -101,7 +101,7 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op)) if ((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL | RPT_PROPERTY_ALL) && (report->flag & SELECT)) { console_history_add_str(sc, report->message, 0); - WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL, NULL); ED_area_tag_redraw(CTX_wm_area(C)); } diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index e94221fab04..eeeadb6e60a 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1192,12 +1192,12 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *event) { nlaedit_duplicate_exec(C, op); RNA_enum_set(op->ptr, "mode", TFM_TRANSLATION); - WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr); + WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr, event); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 3000b4a1109..1efb91bc99f 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -439,7 +439,7 @@ static void nlaedit_select_leftright(bContext *C, /* if currently in tweak-mode, exit tweak-mode first */ if (scene->flag & SCE_NLA_EDIT_ON) { - WM_operator_name_call(C, "NLA_OT_tweakmode_exit", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, "NLA_OT_tweakmode_exit", WM_OP_EXEC_DEFAULT, NULL, NULL); } /* if select mode is replace, deselect all keyframes (and channels) first */ @@ -600,7 +600,7 @@ static int mouse_nla_strips(bContext *C, * now that we've found our target... */ if (scene->flag & SCE_NLA_EDIT_ON) { - WM_operator_name_call(C, "NLA_OT_tweakmode_exit", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, "NLA_OT_tweakmode_exit", WM_OP_EXEC_DEFAULT, NULL, NULL); } if (select_mode != SELECT_REPLACE) { diff --git a/source/blender/editors/space_node/link_drag_search.cc b/source/blender/editors/space_node/link_drag_search.cc index 2484318e612..ccd3333fcc5 100644 --- a/source/blender/editors/space_node/link_drag_search.cc +++ b/source/blender/editors/space_node/link_drag_search.cc @@ -235,7 +235,7 @@ static void link_drag_search_exec_fn(bContext *C, void *arg1, void *arg2) PointerRNA ptr; WM_operator_properties_create_ptr(&ptr, ot); RNA_boolean_set(&ptr, "view2d_edge_pan", true); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr, nullptr); WM_operator_properties_free(&ptr); } diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 410572159bf..9976ecf7700 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -1193,7 +1193,7 @@ static void node_toggle_button_cb(struct bContext *C, void *node_argv, void *op_ /* Select & activate only the button's node. */ node_select_single(*C, *node); - WM_operator_name_call(C, opname, WM_OP_INVOKE_DEFAULT, nullptr); + WM_operator_name_call(C, opname, WM_OP_INVOKE_DEFAULT, nullptr, nullptr); } static void node_draw_shadow(const SpaceNode &snode, diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index ab1f509af47..974e4c2e1cf 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -1507,7 +1507,7 @@ int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op)) /* To keep keyframe positions. */ sce->r.scemode |= R_NO_FRAME_UPDATE; - WM_operator_name_call(C, "RENDER_OT_render", WM_OP_INVOKE_DEFAULT, &op_ptr); + WM_operator_name_call(C, "RENDER_OT_render", WM_OP_INVOKE_DEFAULT, &op_ptr, nullptr); WM_operator_properties_free(&op_ptr); diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.cc b/source/blender/editors/space_outliner/outliner_dragdrop.cc index ba4c3b0e595..30b81b2ecb2 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.cc +++ b/source/blender/editors/space_outliner/outliner_dragdrop.cc @@ -1434,7 +1434,7 @@ static int outliner_item_drag_drop_invoke(bContext *C, PointerRNA op_ptr; WM_operator_properties_create_ptr(&op_ptr, ot); RNA_float_set(&op_ptr, "outside_padding", OUTLINER_DRAG_SCOLL_OUTSIDE_PAD); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr, event); WM_operator_properties_free(&op_ptr); } diff --git a/source/blender/editors/space_outliner/outliner_edit.cc b/source/blender/editors/space_outliner/outliner_edit.cc index 8a02c3b64f2..a60e082f6a5 100644 --- a/source/blender/editors/space_outliner/outliner_edit.cc +++ b/source/blender/editors/space_outliner/outliner_edit.cc @@ -729,7 +729,7 @@ void id_remap_fn(bContext *C, RNA_enum_set(&op_props, "id_type", GS(tselem->id->name)); RNA_enum_set_identifier(C, &op_props, "old_id", tselem->id->name + 2); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_props); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_props, nullptr); WM_operator_properties_free(&op_props); } @@ -875,10 +875,10 @@ static int lib_relocate( RNA_string_set(&op_props, "directory", dir); RNA_string_set(&op_props, "filename", filename); - ret = WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &op_props); + ret = WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &op_props, nullptr); } else { - ret = WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_props); + ret = WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_props, nullptr); } WM_operator_properties_free(&op_props); diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index c58c13b2fb7..3b14c8542bd 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -2225,14 +2225,14 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) } case OUTLINER_IDOP_COPY: { wm->op_undo_depth++; - WM_operator_name_call(C, "OUTLINER_OT_id_copy", WM_OP_INVOKE_DEFAULT, nullptr); + WM_operator_name_call(C, "OUTLINER_OT_id_copy", WM_OP_INVOKE_DEFAULT, nullptr, nullptr); wm->op_undo_depth--; /* No need for undo, this operation does not change anything... */ break; } case OUTLINER_IDOP_PASTE: { wm->op_undo_depth++; - WM_operator_name_call(C, "OUTLINER_OT_id_paste", WM_OP_INVOKE_DEFAULT, nullptr); + WM_operator_name_call(C, "OUTLINER_OT_id_paste", WM_OP_INVOKE_DEFAULT, nullptr, nullptr); wm->op_undo_depth--; ED_outliner_select_sync_from_all_tag(C); ED_undo_push(C, "Paste"); @@ -2604,7 +2604,8 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op) case OUTLINER_ANIMOP_SET_ACT: /* delegate once again... */ wm->op_undo_depth++; - WM_operator_name_call(C, "OUTLINER_OT_action_set", WM_OP_INVOKE_REGION_WIN, nullptr); + WM_operator_name_call( + C, "OUTLINER_OT_action_set", WM_OP_INVOKE_REGION_WIN, nullptr, nullptr); wm->op_undo_depth--; ED_undo_push(C, "Set active action"); break; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 3c29b32c2fa..15fea301b1c 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -649,13 +649,13 @@ static int text_save_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int text_save_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +static int text_save_invoke(bContext *C, wmOperator *op, const wmEvent *event) { Text *text = CTX_data_edit_text(C); /* Internal and texts without a filepath will go to "Save As". */ if (text->filepath == NULL || (text->flags & TXT_ISMEM)) { - WM_operator_name_call(C, "TEXT_OT_save_as", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "TEXT_OT_save_as", WM_OP_INVOKE_DEFAULT, NULL, event); return OPERATOR_CANCELLED; } return text_save_exec(C, op); @@ -1098,10 +1098,10 @@ static int text_indent_or_autocomplete_exec(bContext *C, wmOperator *UNUSED(op)) TextLine *line = text->curl; bool text_before_cursor = text->curc != 0 && !ELEM(line->line[text->curc - 1], ' ', '\t'); if (text_before_cursor && (txt_has_sel(text) == false)) { - WM_operator_name_call(C, "TEXT_OT_autocomplete", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "TEXT_OT_autocomplete", WM_OP_INVOKE_DEFAULT, NULL, NULL); } else { - WM_operator_name_call(C, "TEXT_OT_indent", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, "TEXT_OT_indent", WM_OP_EXEC_DEFAULT, NULL, NULL); } return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 4656540c19b..e2a027837a7 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -801,7 +801,7 @@ static void view3d_lightcache_update(bContext *C) RNA_int_set(&op_ptr, "delay", 200); RNA_enum_set_identifier(C, &op_ptr, "subset", "DIRTY"); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr, NULL); WM_operator_properties_free(&op_ptr); } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index b4cf08f69fe..e52ff062302 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -507,19 +507,17 @@ void VIEW3D_OT_view_persportho(wmOperatorType *ot) * Wraps walk/fly modes. * \{ */ -static int view3d_navigate_invoke(bContext *C, - wmOperator *UNUSED(op), - const wmEvent *UNUSED(event)) +static int view3d_navigate_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { eViewNavigation_Method mode = U.navigation_mode; switch (mode) { case VIEW_NAVIGATION_FLY: - WM_operator_name_call(C, "VIEW3D_OT_fly", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_fly", WM_OP_INVOKE_DEFAULT, NULL, event); break; case VIEW_NAVIGATION_WALK: default: - WM_operator_name_call(C, "VIEW3D_OT_walk", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_walk", WM_OP_INVOKE_DEFAULT, NULL, event); break; } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index 224c80bdd48..3a8a28dc2a1 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -1321,7 +1321,8 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *op, const wmEvent *e /* This is a little weak, but there is no real good way to tweak directly. */ WM_gizmo_highlight_set(gzmap, &ruler_item->gz); - if (WM_operator_name_call(C, "GIZMOGROUP_OT_gizmo_tweak", WM_OP_INVOKE_REGION_WIN, NULL) == + if (WM_operator_name_call( + C, "GIZMOGROUP_OT_gizmo_tweak", WM_OP_INVOKE_REGION_WIN, NULL, event) == OPERATOR_RUNNING_MODAL) { RulerInfo *ruler_info = gzgroup->customdata; RulerInteraction *inter = ruler_item->gz.interaction_data; diff --git a/source/blender/editors/space_view3d/view3d_navigate_dolly.c b/source/blender/editors/space_view3d/view3d_navigate_dolly.c index 7b6b119294d..29ccc352950 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_dolly.c +++ b/source/blender/editors/space_view3d/view3d_navigate_dolly.c @@ -134,11 +134,11 @@ static int viewdolly_modal(bContext *C, wmOperator *op, const wmEvent *event) event_code = VIEW_CONFIRM; break; case VIEWROT_MODAL_SWITCH_MOVE: - WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL, event); event_code = VIEW_CONFIRM; break; case VIEWROT_MODAL_SWITCH_ROTATE: - WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL, event); event_code = VIEW_CONFIRM; break; } diff --git a/source/blender/editors/space_view3d/view3d_navigate_move.c b/source/blender/editors/space_view3d/view3d_navigate_move.c index 071643e9314..af8419894b1 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_move.c +++ b/source/blender/editors/space_view3d/view3d_navigate_move.c @@ -76,11 +76,11 @@ static int viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event) event_code = VIEW_CONFIRM; break; case VIEWROT_MODAL_SWITCH_ZOOM: - WM_operator_name_call(C, "VIEW3D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL, event); event_code = VIEW_CONFIRM; break; case VIEWROT_MODAL_SWITCH_ROTATE: - WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL, event); event_code = VIEW_CONFIRM; break; } diff --git a/source/blender/editors/space_view3d/view3d_navigate_roll.c b/source/blender/editors/space_view3d/view3d_navigate_roll.c index 9c070fb0341..ea21eed6445 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_roll.c +++ b/source/blender/editors/space_view3d/view3d_navigate_roll.c @@ -99,11 +99,11 @@ static int viewroll_modal(bContext *C, wmOperator *op, const wmEvent *event) event_code = VIEW_CONFIRM; break; case VIEWROT_MODAL_SWITCH_MOVE: - WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL, event); event_code = VIEW_CONFIRM; break; case VIEWROT_MODAL_SWITCH_ROTATE: - WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL, event); event_code = VIEW_CONFIRM; break; } diff --git a/source/blender/editors/space_view3d/view3d_navigate_rotate.c b/source/blender/editors/space_view3d/view3d_navigate_rotate.c index 11de5463cdb..a53c71bd823 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_rotate.c +++ b/source/blender/editors/space_view3d/view3d_navigate_rotate.c @@ -327,11 +327,11 @@ static int viewrotate_modal(bContext *C, wmOperator *op, const wmEvent *event) event_code = VIEW_APPLY; break; case VIEWROT_MODAL_SWITCH_ZOOM: - WM_operator_name_call(C, "VIEW3D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL, event); event_code = VIEW_CONFIRM; break; case VIEWROT_MODAL_SWITCH_MOVE: - WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL, event); event_code = VIEW_CONFIRM; break; } diff --git a/source/blender/editors/space_view3d/view3d_navigate_zoom.c b/source/blender/editors/space_view3d/view3d_navigate_zoom.c index 5f6f9fde324..c744ef85236 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_zoom.c +++ b/source/blender/editors/space_view3d/view3d_navigate_zoom.c @@ -370,11 +370,11 @@ static int viewzoom_modal(bContext *C, wmOperator *op, const wmEvent *event) event_code = VIEW_CONFIRM; break; case VIEWROT_MODAL_SWITCH_MOVE: - WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL, event); event_code = VIEW_CONFIRM; break; case VIEWROT_MODAL_SWITCH_ROTATE: - WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL, event); event_code = VIEW_CONFIRM; break; } diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c index 1603539cf94..05d4372723b 100644 --- a/source/blender/editors/space_view3d/view3d_placement.c +++ b/source/blender/editors/space_view3d/view3d_placement.c @@ -1153,7 +1153,7 @@ static int view3d_interactive_add_modal(bContext *C, wmOperator *op, const wmEve RNA_float_set(&op_props, "radius2", 0.0f); } - WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &op_props); + WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &op_props, NULL); WM_operator_properties_free(&op_props); } else { diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index e380a08dcc7..5d3168908d6 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1628,7 +1628,7 @@ static Base *object_mouse_select_menu(bContext *C, RNA_boolean_set(&ptr, "extend", extend); RNA_boolean_set(&ptr, "deselect", deselect); RNA_boolean_set(&ptr, "toggle", toggle); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr, NULL); WM_operator_properties_free(&ptr); BLI_linklist_free(linklist.list, NULL); @@ -1851,7 +1851,7 @@ static bool bone_mouse_select_menu(bContext *C, RNA_boolean_set(&ptr, "extend", extend); RNA_boolean_set(&ptr, "deselect", deselect); RNA_boolean_set(&ptr, "toggle", toggle); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr, NULL); WM_operator_properties_free(&ptr); BLI_linklist_free(base_list.list, NULL); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 936aca7d2e0..efbb7375af4 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -1311,9 +1311,7 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot) P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER); } -static int transform_from_gizmo_invoke(bContext *C, - wmOperator *UNUSED(op), - const wmEvent *UNUSED(event)) +static int transform_from_gizmo_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { bToolRef *tref = WM_toolsystem_ref_from_context(C); if (tref) { @@ -1343,7 +1341,7 @@ static int transform_from_gizmo_invoke(bContext *C, PointerRNA op_ptr; WM_operator_properties_create_ptr(&op_ptr, ot); RNA_boolean_set(&op_ptr, "release_confirm", true); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr, event); WM_operator_properties_free(&op_ptr); return OPERATOR_FINISHED; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c index 45c7bd5b4e0..288ae9c0c5f 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c @@ -59,7 +59,7 @@ static void gpencil_modifier_reorder(bContext *C, Panel *panel, int new_index) WM_operator_properties_create_ptr(&props_ptr, ot); RNA_string_set(&props_ptr, "modifier", md->name); RNA_int_set(&props_ptr, "index", new_index); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, NULL); WM_operator_properties_free(&props_ptr); } diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c index 90652c180c6..eddf4bd03e1 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.c +++ b/source/blender/modifiers/intern/MOD_ui_common.c @@ -63,7 +63,7 @@ static void modifier_reorder(bContext *C, Panel *panel, int new_index) WM_operator_properties_create_ptr(&props_ptr, ot); RNA_string_set(&props_ptr, "modifier", md->name); RNA_int_set(&props_ptr, "index", new_index); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, NULL); WM_operator_properties_free(&props_ptr); } diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 61de15b07f5..159ac23bf95 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -313,7 +313,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) return NULL; } - WM_operator_name_call(C, opname, WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, opname, WM_OP_EXEC_DEFAULT, NULL, NULL); } #endif } diff --git a/source/blender/shader_fx/intern/FX_ui_common.c b/source/blender/shader_fx/intern/FX_ui_common.c index 3770b796c4d..4c9eaa11ab6 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.c +++ b/source/blender/shader_fx/intern/FX_ui_common.c @@ -50,7 +50,7 @@ static void shaderfx_reorder(bContext *C, Panel *panel, int new_index) WM_operator_properties_create_ptr(&props_ptr, ot); RNA_string_set(&props_ptr, "shaderfx", fx->name); RNA_int_set(&props_ptr, "index", new_index); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, NULL); WM_operator_properties_free(&props_ptr); } diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 2f9062959c7..7959c3d6f0b 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -646,19 +646,29 @@ bool WM_operator_is_repeat(const struct bContext *C, const struct wmOperator *op bool WM_operator_name_poll(struct bContext *C, const char *opstring); /** * Invokes operator in context. + * + * \param event: Optionally pass in an event to use when context uses one of the + * `WM_OP_INVOKE_*` values. When left unset the #wmWindow.eventstate will be used, + * this can cause problems for operators that read the events type - for example, + * storing the key that was pressed so as to be able to detect it's release. + * In these cases it's necessary to forward the current event being handled. */ int WM_operator_name_call_ptr(struct bContext *C, struct wmOperatorType *ot, wmOperatorCallContext context, - struct PointerRNA *properties); + struct PointerRNA *properties, + const wmEvent *event); +/** See #WM_operator_name_call_ptr */ int WM_operator_name_call(struct bContext *C, const char *opstring, wmOperatorCallContext context, - struct PointerRNA *properties); + struct PointerRNA *properties, + const wmEvent *event); int WM_operator_name_call_with_properties(struct bContext *C, const char *opstring, wmOperatorCallContext context, - struct IDProperty *properties); + struct IDProperty *properties, + const wmEvent *event); /** * Similar to #WM_operator_name_call called with #WM_OP_EXEC_DEFAULT context. * @@ -677,6 +687,7 @@ void WM_operator_name_call_ptr_with_depends_on_cursor(struct bContext *C, wmOperatorType *ot, wmOperatorCallContext opcontext, PointerRNA *properties, + const wmEvent *event, const char *drawstr); /** diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h b/source/blender/windowmanager/gizmo/WM_gizmo_api.h index 6b497c7462a..fe73daeed29 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h @@ -92,7 +92,10 @@ struct PointerRNA *WM_gizmo_operator_set(struct wmGizmo *gz, int part_index, struct wmOperatorType *ot, struct IDProperty *properties); -int WM_gizmo_operator_invoke(struct bContext *C, struct wmGizmo *gz, struct wmGizmoOpElem *gzop); +int WM_gizmo_operator_invoke(struct bContext *C, + struct wmGizmo *gz, + struct wmGizmoOpElem *gzop, + const struct wmEvent *event); /* Callbacks. */ diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c index 05564f3bd0a..db4926f3430 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c @@ -225,7 +225,7 @@ PointerRNA *WM_gizmo_operator_set(wmGizmo *gz, return &gzop->ptr; } -int WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop) +int WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop, const wmEvent *event) { if (gz->flag & WM_GIZMO_OPERATOR_TOOL_INIT) { /* Merge toolsettings into the gizmo properties. */ @@ -239,7 +239,7 @@ int WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop) IDP_MergeGroup(gzop->ptr.data, tref_ptr.data, false); } } - return WM_operator_name_call_ptr(C, gzop->type, WM_OP_INVOKE_DEFAULT, &gzop->ptr); + return WM_operator_name_call_ptr(C, gzop->type, WM_OP_INVOKE_DEFAULT, &gzop->ptr, event); } static void wm_gizmo_set_matrix_rotation_from_z_axis__internal(float matrix[4][4], @@ -425,7 +425,7 @@ void WM_gizmo_modal_set_from_setup(struct wmGizmoMap *gzmap, } else { /* WEAK: but it works. */ - WM_operator_name_call(C, "GIZMOGROUP_OT_gizmo_tweak", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "GIZMOGROUP_OT_gizmo_tweak", WM_OP_INVOKE_DEFAULT, NULL, event); } } diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c index beef74ce2e2..00615d9d662 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c @@ -441,7 +441,7 @@ static bool gizmo_tweak_start_and_finish( 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); + WM_gizmo_operator_invoke(C, gz, gzop, event); } return true; } diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c index 44b7001e054..d9f4050c8f1 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c @@ -1157,7 +1157,7 @@ void wm_gizmomap_modal_set( struct wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, gz->highlight_part); if (gzop && gzop->type) { - const int retval = WM_gizmo_operator_invoke(C, gz, gzop); + const int retval = WM_gizmo_operator_invoke(C, gz, gzop, event); if ((retval & OPERATOR_RUNNING_MODAL) == 0) { wm_gizmomap_modal_set(gzmap, C, gz, event, false); } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 3fe8e6cd1b0..44c9ffab92c 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -97,7 +97,7 @@ static int wm_operator_call_internal(bContext *C, ReportList *reports, const wmOperatorCallContext context, const bool poll_only, - wmEvent *event); + const wmEvent *event); static bool wm_operator_check_locked_interface(bContext *C, wmOperatorType *ot); static wmEvent *wm_event_add_mousemove_to_head(wmWindow *win); @@ -1313,7 +1313,7 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event) */ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, - wmEvent *event, + const wmEvent *event, PointerRNA *properties, ReportList *reports, const bool poll_only, @@ -1354,7 +1354,9 @@ static int wm_operator_invoke(bContext *C, } if (op->type->invoke && event) { - wm_region_mouse_co(C, event); + /* Temporarily write into `mval` (not technically `const` correct) but this is restored. */ + int mval_prev[2] = {UNPACK2(event->mval)}; + wm_region_mouse_co(C, (wmEvent *)event); if (op->type->flag & OPTYPE_UNDO) { wm->op_undo_depth++; @@ -1366,6 +1368,8 @@ static int wm_operator_invoke(bContext *C, if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) { wm->op_undo_depth--; } + + copy_v2_v2_int(((wmEvent *)event)->mval, mval_prev); } else if (op->type->exec) { if (op->type->flag & OPTYPE_UNDO) { @@ -1477,7 +1481,7 @@ static int wm_operator_call_internal(bContext *C, ReportList *reports, const wmOperatorCallContext context, const bool poll_only, - wmEvent *event) + const wmEvent *event) { int retval; @@ -1609,19 +1613,21 @@ static int wm_operator_call_internal(bContext *C, int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, - PointerRNA *properties) + PointerRNA *properties, + const wmEvent *event) { BLI_assert(ot == WM_operatortype_find(ot->idname, true)); - return wm_operator_call_internal(C, ot, properties, NULL, context, false, NULL); + return wm_operator_call_internal(C, ot, properties, NULL, context, false, event); } int WM_operator_name_call(bContext *C, const char *opstring, wmOperatorCallContext context, - PointerRNA *properties) + PointerRNA *properties, + const wmEvent *event) { wmOperatorType *ot = WM_operatortype_find(opstring, 0); if (ot) { - return WM_operator_name_call_ptr(C, ot, context, properties); + return WM_operator_name_call_ptr(C, ot, context, properties, event); } return 0; @@ -1640,12 +1646,13 @@ bool WM_operator_name_poll(bContext *C, const char *opstring) int WM_operator_name_call_with_properties(struct bContext *C, const char *opstring, wmOperatorCallContext context, - struct IDProperty *properties) + struct IDProperty *properties, + const wmEvent *event) { PointerRNA props_ptr; wmOperatorType *ot = WM_operatortype_find(opstring, false); RNA_pointer_create(G_MAIN->wm.first, ot->srna, properties, &props_ptr); - return WM_operator_name_call_ptr(C, ot, context, &props_ptr); + return WM_operator_name_call_ptr(C, ot, context, &props_ptr, event); } void WM_menu_name_call(bContext *C, const char *menu_name, short context) @@ -1654,7 +1661,7 @@ void WM_menu_name_call(bContext *C, const char *menu_name, short context) PointerRNA ptr; WM_operator_properties_create_ptr(&ptr, ot); RNA_string_set(&ptr, "name", menu_name); - WM_operator_name_call_ptr(C, ot, context, &ptr); + WM_operator_name_call_ptr(C, ot, context, &ptr, NULL); WM_operator_properties_free(&ptr); } @@ -1766,7 +1773,8 @@ static int ui_handler_wait_for_input(bContext *C, const wmEvent *event, void *us WM_operator_name_call_ptr(C, opwait->optype_params.optype, opwait->optype_params.opcontext, - opwait->optype_params.opptr); + opwait->optype_params.opptr, + event); CTX_store_set(C, NULL); } @@ -1788,6 +1796,7 @@ void WM_operator_name_call_ptr_with_depends_on_cursor(bContext *C, wmOperatorType *ot, wmOperatorCallContext opcontext, PointerRNA *properties, + const wmEvent *event, const char *drawstr) { int flag = ot->flag; @@ -1800,7 +1809,7 @@ void WM_operator_name_call_ptr_with_depends_on_cursor(bContext *C, } if ((flag & OPTYPE_DEPENDS_ON_CURSOR) == 0) { - WM_operator_name_call_ptr(C, ot, opcontext, properties); + WM_operator_name_call_ptr(C, ot, opcontext, properties, event); return; } diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 4ff96b82fd2..04ce7bcb520 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -2424,7 +2424,7 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op) static void wm_homefile_read_after_dialog_callback(bContext *C, void *user_data) { WM_operator_name_call_with_properties( - C, "WM_OT_read_homefile", WM_OP_EXEC_DEFAULT, (IDProperty *)user_data); + C, "WM_OT_read_homefile", WM_OP_EXEC_DEFAULT, (IDProperty *)user_data, NULL); } static int wm_homefile_read_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) @@ -2577,7 +2577,7 @@ static int wm_open_mainfile_dispatch(bContext *C, wmOperator *op); static void wm_open_mainfile_after_dialog_callback(bContext *C, void *user_data) { WM_operator_name_call_with_properties( - C, "WM_OT_open_mainfile", WM_OP_INVOKE_DEFAULT, (IDProperty *)user_data); + C, "WM_OT_open_mainfile", WM_OP_INVOKE_DEFAULT, (IDProperty *)user_data, NULL); } static int wm_open_mainfile__discard_changes(bContext *C, wmOperator *op) @@ -2892,7 +2892,7 @@ static int wm_recover_last_session_exec(bContext *C, wmOperator *op) static void wm_recover_last_session_after_dialog_callback(bContext *C, void *user_data) { WM_operator_name_call_with_properties( - C, "WM_OT_recover_last_session", WM_OP_EXEC_DEFAULT, (IDProperty *)user_data); + C, "WM_OT_recover_last_session", WM_OP_EXEC_DEFAULT, (IDProperty *)user_data, NULL); } static int wm_recover_last_session_invoke(bContext *C, @@ -3290,7 +3290,7 @@ static void wm_block_autorun_warning_reload_with_scripts(bContext *C, /* Save user preferences for permanent execution. */ if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) { - WM_operator_name_call(C, "WM_OT_save_userpref", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, "WM_OT_save_userpref", WM_OP_EXEC_DEFAULT, NULL, NULL); } /* Load file again with scripts enabled. @@ -3309,7 +3309,7 @@ static void wm_block_autorun_warning_enable_scripts(bContext *C, /* Save user preferences for permanent execution. */ if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) { - WM_operator_name_call(C, "WM_OT_save_userpref", WM_OP_EXEC_DEFAULT, NULL); + WM_operator_name_call(C, "WM_OT_save_userpref", WM_OP_EXEC_DEFAULT, NULL, NULL); } /* Force a full refresh, but without reloading the file. */ @@ -3478,7 +3478,7 @@ void wm_test_autorun_revert_action_exec(bContext *C) wm_test_autorun_revert_action_set(ot, ptr); } - WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, ptr, NULL); wm_test_autorun_revert_action_set(NULL, NULL); } @@ -3559,13 +3559,13 @@ static void wm_block_file_close_save(bContext *C, void *arg_block, void *arg_dat bool file_has_been_saved_before = BKE_main_blendfile_path(bmain)[0] != '\0'; if (file_has_been_saved_before) { - if (WM_operator_name_call(C, "WM_OT_save_mainfile", WM_OP_EXEC_DEFAULT, NULL) & + if (WM_operator_name_call(C, "WM_OT_save_mainfile", WM_OP_EXEC_DEFAULT, NULL, NULL) & OPERATOR_CANCELLED) { execute_callback = false; } } else { - WM_operator_name_call(C, "WM_OT_save_mainfile", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "WM_OT_save_mainfile", WM_OP_INVOKE_DEFAULT, NULL, NULL); execute_callback = false; } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 70e54e3e69d..6a9776c6933 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -365,7 +365,7 @@ void WM_init_splash(bContext *C) if (wm->windows.first) { CTX_wm_window_set(C, wm->windows.first); - WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL, NULL); CTX_wm_window_set(C, prevwin); } } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 2f5eef652f2..84cd8dce6cf 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3597,8 +3597,11 @@ static int doc_view_manual_ui_context_exec(bContext *C, wmOperator *UNUSED(op)) WM_operator_properties_create(&ptr_props, "WM_OT_doc_view_manual"); RNA_string_set(&ptr_props, "doc_id", buf); - retval = WM_operator_name_call_ptr( - C, WM_operatortype_find("WM_OT_doc_view_manual", false), WM_OP_EXEC_DEFAULT, &ptr_props); + retval = WM_operator_name_call_ptr(C, + WM_operatortype_find("WM_OT_doc_view_manual", false), + WM_OP_EXEC_DEFAULT, + &ptr_props, + NULL); WM_operator_properties_free(&ptr_props); } diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index ae1024eafbc..bc4bbc86367 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -611,7 +611,7 @@ bToolRef *WM_toolsystem_ref_set_by_id_ex( RNA_enum_set(&op_props, "space_type", tkey->space_type); RNA_boolean_set(&op_props, "cycle", cycle); - WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &op_props); + WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &op_props, NULL); WM_operator_properties_free(&op_props); bToolRef *tref = WM_toolsystem_ref_find(workspace, tkey); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index d6f85e3795e..cbebb856660 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1328,7 +1328,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr WM_operator_properties_create_ptr(&props_ptr, ot); RNA_string_set(&props_ptr, "filepath", path); RNA_boolean_set(&props_ptr, "display_file_selector", false); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, NULL); WM_operator_properties_free(&props_ptr); CTX_wm_window_set(C, NULL); |