Fix #121233: GPv3: Primitives: Add missing confirm action and ability to pan viewport.

This adds `MMB+shift`/`MMB+Alt` for panning, while keeping `MMB` to confirm.

Pull Request: https://projects.blender.org/blender/blender/pulls/122813
This commit is contained in:
casey bianco-davis
2024-11-07 11:57:56 +01:00
committed by Falk David
parent ffd80047ee
commit a114534295
2 changed files with 25 additions and 2 deletions
@@ -7820,6 +7820,7 @@ def km_grease_pencil_primitive_tool_modal_map(params):
("PANNING", {"type": 'MIDDLEMOUSE', "value": 'ANY', "any": True}, None),
("CONFIRM", {"type": 'RET', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'MIDDLEMOUSE', "value": 'PRESS'}, None),
("EXTRUDE", {"type": 'E', "value": 'PRESS'}, None),
("GRAB", {"type": 'G', "value": 'PRESS'}, None),
("ROTATE", {"type": 'R', "value": 'PRESS'}, None),
@@ -609,9 +609,10 @@ static void grease_pencil_primitive_status_indicators(bContext *C,
return WM_modalkeymap_operator_items_to_string(op->type, int(id), true).value_or("");
};
header += fmt::format(IFACE_("{}: confirm, {}: cancel, Shift: align"),
header += fmt::format(IFACE_("{}: confirm, {}: cancel, {}: panning, Shift: align"),
get_modal_key_str(ModalKeyMode::Confirm),
get_modal_key_str(ModalKeyMode::Cancel));
get_modal_key_str(ModalKeyMode::Cancel),
get_modal_key_str(ModalKeyMode::Panning));
header += fmt::format(IFACE_(", {}/{}: adjust subdivisions: {}"),
get_modal_key_str(ModalKeyMode::IncreaseSubdivision),
@@ -1273,6 +1274,27 @@ static int grease_pencil_primitive_modal(bContext *C, wmOperator *op, const wmEv
{
PrimitiveToolOperation &ptd = *reinterpret_cast<PrimitiveToolOperation *>(op->customdata);
/* Check for confirm before navigation. */
if (event->type == EVT_MODAL_MAP) {
if (event->val == int(ModalKeyMode::Confirm)) {
grease_pencil_primitive_exit(C, op);
return OPERATOR_FINISHED;
}
}
const float3 pos = ptd.control_points.first();
if (ED_view3d_navigation_do(C, ptd.vod, event, pos)) {
if (ptd.vc.rv3d->rflag & RV3D_NAVIGATING) {
ptd.projection = ED_view3d_ob_project_mat_get(ptd.vc.rv3d, ptd.vc.obact);
grease_pencil_primitive_update_curves(ptd);
grease_pencil_primitive_update_view(C, ptd);
return OPERATOR_RUNNING_MODAL;
}
}
ptd.projection = ED_view3d_ob_project_mat_get(ptd.vc.rv3d, ptd.vc.obact);
grease_pencil_primitive_cursor_update(C, ptd, event);