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]: 4d0f846b93
This commit is contained in:
Campbell Barton
2023-10-31 14:45:36 +11:00
parent a15f9e49ec
commit 4bec9d0d71
4 changed files with 30 additions and 5 deletions

View File

@@ -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)]})
])),
]},
)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)