From 4bec9d0d7162b0ca321cee5987c086c10319d65f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 31 Oct 2023 14:45:36 +1100 Subject: [PATCH] Fix #114282: Extrude to Cursor tool no longer tweaks on drag Regression in [0] which only ran drag events if the press event passed through. Resolve using the same logic as select picking (see: WM_operator_flag_only_pass_through_on_press). [0]: 4d0f846b936c9101ecb76a6db962aac2d74a460a --- .../keyconfig/keymap_data/blender_default.py | 15 +++++++++++++++ source/blender/editors/armature/armature_add.cc | 9 ++++++--- source/blender/editors/curve/editcurve.cc | 7 ++++++- source/blender/editors/mesh/editmesh_extrude.cc | 4 +++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/scripts/presets/keyconfig/keymap_data/blender_default.py b/scripts/presets/keyconfig/keymap_data/blender_default.py index d1419ed584d..f76f79d8e1e 100644 --- a/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -7354,6 +7354,11 @@ def km_3d_view_tool_edit_armature_extrude_to_cursor(params): {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ ("armature.click_extrude", {"type": params.tool_mouse, "value": 'PRESS', **params.tool_modifier}, None), + # Support LMB click-drag for RMB key-map. + *(([] if (params.select_mouse == 'LEFTMOUSE') else [ + ("transform.translate", {"type": params.tool_mouse, "value": 'CLICK_DRAG'}, + {"properties": [("release_confirm", True)]}) + ])), ]}, ) @@ -7439,6 +7444,11 @@ def km_3d_view_tool_edit_mesh_extrude_to_cursor(params): {"items": [ # No need for `tool_modifier` since this takes all input. ("mesh.dupli_extrude_cursor", {"type": params.tool_mouse, "value": 'PRESS'}, None), + # Support LMB click-drag for RMB key-map. + *(([] if (params.select_mouse == 'LEFTMOUSE') else [ + ("transform.translate", {"type": params.tool_mouse, "value": 'CLICK_DRAG'}, + {"properties": [("release_confirm", True)]}) + ])), ]}, ) @@ -7733,6 +7743,11 @@ def km_3d_view_tool_edit_curve_extrude_to_cursor(params): {"items": [ # No need for `tool_modifier` since this takes all input. ("curve.vertex_add", {"type": params.tool_mouse, "value": 'PRESS'}, None), + # Support LMB click-drag for RMB key-map. + *(([] if (params.select_mouse == 'LEFTMOUSE') else [ + ("transform.translate", {"type": params.tool_mouse, "value": 'CLICK_DRAG'}, + {"properties": [("release_confirm", True)]}) + ])), ]}, ) diff --git a/source/blender/editors/armature/armature_add.cc b/source/blender/editors/armature/armature_add.cc index da2eba48157..6d0c2b1a8db 100644 --- a/source/blender/editors/armature/armature_add.cc +++ b/source/blender/editors/armature/armature_add.cc @@ -225,7 +225,6 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, const wmEv ARegion *region; View3D *v3d; float tvec[3], oldcurs[3], mval_f[2]; - int retv; scene = CTX_data_scene(C); region = CTX_wm_region(C); @@ -240,12 +239,16 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, const wmEv copy_v3_v3(cursor->location, tvec); /* extrude to the where new cursor is and store the operation result */ - retv = armature_click_extrude_exec(C, op); + int retval = armature_click_extrude_exec(C, op); /* restore previous 3d cursor position */ copy_v3_v3(cursor->location, oldcurs); - return retv; + /* Support dragging to move after extrude, see: #114282. */ + if (retval & OPERATOR_FINISHED) { + retval |= OPERATOR_PASS_THROUGH; + } + return WM_operator_flag_only_pass_through_on_press(retval, event); } void ARMATURE_OT_click_extrude(wmOperatorType *ot) diff --git a/source/blender/editors/curve/editcurve.cc b/source/blender/editors/curve/editcurve.cc index 8e698ffd752..a9ff1ee8573 100644 --- a/source/blender/editors/curve/editcurve.cc +++ b/source/blender/editors/curve/editcurve.cc @@ -5706,7 +5706,12 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event) RNA_float_set_array(op->ptr, "location", location); } - return add_vertex_exec(C, op); + /* Support dragging to move after extrude, see: #114282. */ + int retval = add_vertex_exec(C, op); + if (retval & OPERATOR_FINISHED) { + retval |= OPERATOR_PASS_THROUGH; + } + return WM_operator_flag_only_pass_through_on_press(retval, event); } void CURVE_OT_vertex_add(wmOperatorType *ot) diff --git a/source/blender/editors/mesh/editmesh_extrude.cc b/source/blender/editors/mesh/editmesh_extrude.cc index f5d374c4cb9..3c29dafff86 100644 --- a/source/blender/editors/mesh/editmesh_extrude.cc +++ b/source/blender/editors/mesh/editmesh_extrude.cc @@ -915,7 +915,9 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w } MEM_freeN(objects); - return OPERATOR_FINISHED; + /* Support dragging to move after extrude, see: #114282. */ + const int retval = OPERATOR_FINISHED | OPERATOR_PASS_THROUGH; + return WM_operator_flag_only_pass_through_on_press(retval, event); } void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)