From 33a4639de59f64175ac1225b218a868e21c6aa5e Mon Sep 17 00:00:00 2001 From: DesertSpringsCivil Date: Mon, 2 Feb 2026 20:46:19 -0700 Subject: [PATCH] Add Space key as alternative to Enter for PI Edit Mode apply When using G key to move PIs, Blender's transform modal consumes the Enter key. Adding Space as an alternative lets users apply changes more easily. Also adds Numpad Enter support. Co-Authored-By: Claude Opus 4.5 --- src/bonsai/bonsai/bim/module/alignment/decorator.py | 2 +- src/bonsai/bonsai/bim/module/alignment/operator.py | 10 +++++++--- src/bonsai/bonsai/bim/module/alignment/ui.py | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/alignment/decorator.py b/src/bonsai/bonsai/bim/module/alignment/decorator.py index 4db56c7be7..fab51216dc 100644 --- a/src/bonsai/bonsai/bim/module/alignment/decorator.py +++ b/src/bonsai/bonsai/bim/module/alignment/decorator.py @@ -392,7 +392,7 @@ class PIEditDecorator: f"PIs: {valid_count}", "", "G: Move selected PI", - "ENTER: Apply changes", + "ENTER/SPACE: Apply changes", "ESC: Cancel", ] diff --git a/src/bonsai/bonsai/bim/module/alignment/operator.py b/src/bonsai/bonsai/bim/module/alignment/operator.py index 66cb09815d..ed5259efe8 100644 --- a/src/bonsai/bonsai/bim/module/alignment/operator.py +++ b/src/bonsai/bonsai/bim/module/alignment/operator.py @@ -1453,7 +1453,7 @@ class SAIKEI_OT_enter_pi_edit_mode(Operator): # Start modal loop context.window_manager.modal_handler_add(self) - self.report({"INFO"}, "PI Edit Mode: Move PIs with G. Press Enter to apply, Escape to cancel.") + self.report({"INFO"}, "PI Edit Mode: Move PIs with G. Press Enter/Space to apply, Escape to cancel.") return {"RUNNING_MODAL"} def modal(self, context, event): @@ -1477,8 +1477,12 @@ class SAIKEI_OT_enter_pi_edit_mode(Operator): if self._area: self._area.tag_redraw() - # Handle keyboard input - if event.type == "RET" and event.value == "PRESS": + # Handle keyboard input for apply/cancel + # Support both regular Enter and Numpad Enter, plus Space as alternative + if event.type in {"RET", "NUMPAD_ENTER", "SPACE"} and event.value == "PRESS": + # Don't consume Space if user is typing in a field + if event.type == "SPACE" and context.area.type != "VIEW_3D": + return {"PASS_THROUGH"} return self._cleanup_and_finish(context, apply=True) if event.type == "ESC" and event.value == "PRESS": diff --git a/src/bonsai/bonsai/bim/module/alignment/ui.py b/src/bonsai/bonsai/bim/module/alignment/ui.py index a8d3dade30..78e783b041 100644 --- a/src/bonsai/bonsai/bim/module/alignment/ui.py +++ b/src/bonsai/bonsai/bim/module/alignment/ui.py @@ -238,7 +238,7 @@ class SAIKEI_PT_pi_editor(Panel): box.label(text="PI Edit Mode Active", icon="EDITMODE_HLT") col = box.column(align=True) col.label(text="Move PIs with G key") - col.label(text="Press Enter to apply") + col.label(text="Press Enter or Space to apply") col.label(text="Press Escape to cancel") layout.separator() return # Don't show normal UI while in edit mode