@@ -2267,27 +2267,36 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
22672267 if (_edit.instant ) {
22682268 // In a Blender-style transform, numbers set the magnitude of the transform.
22692269 // E.g. pressing g4.5x means "translate 4.5 units along the X axis".
2270- // Use the Unicode value because we care about the text, not the actual keycode.
2271- // This ensures numbers work consistently across different keyboard language layouts.
22722270 bool processed = true ;
2273- Key key = k->get_physical_keycode ();
2274- char32_t unicode = k->get_unicode ();
2275- if (unicode >= ' 0' && unicode <= ' 9' ) {
2276- uint32_t value = uint32_t (unicode - Key::KEY_0);
2271+ Key keycode = k->get_keycode ();
2272+ Key physical_keycode = k->get_physical_keycode ();
2273+
2274+ // Use physical keycode for main keyboard numbers (for non-QWERTY layouts like AZERTY)
2275+ // but regular keycode for numpad numbers.
2276+ if ((physical_keycode >= Key::KEY_0 && physical_keycode <= Key::KEY_9) || (keycode >= Key::KP_0 && keycode <= Key::KP_9)) {
2277+ uint32_t value;
2278+ if (physical_keycode >= Key::KEY_0 && physical_keycode <= Key::KEY_9) {
2279+ value = uint32_t (physical_keycode - Key::KEY_0);
2280+ } else {
2281+ value = uint32_t (keycode - Key::KP_0);
2282+ }
2283+
22772284 if (_edit.numeric_next_decimal < 0 ) {
22782285 _edit.numeric_input = _edit.numeric_input + value * Math::pow (10.0 , _edit.numeric_next_decimal --);
22792286 } else {
22802287 _edit.numeric_input = _edit.numeric_input * 10 + value;
22812288 }
22822289 update_transform_numeric ();
2283- } else if (unicode == ' - ' ) {
2290+ } else if (keycode == Key::MINUS || keycode == Key::KP_SUBTRACT ) {
22842291 _edit.numeric_negate = !_edit.numeric_negate ;
22852292 update_transform_numeric ();
2286- } else if (unicode == ' .' ) {
2293+ } else if (keycode == Key::PERIOD || physical_keycode == Key::KP_PERIOD) {
2294+ // Use physical keycode for KP_PERIOD to ensure numpad period works consistently
2295+ // across different keyboard layouts (like nordic keyboards).
22872296 if (_edit.numeric_next_decimal == 0 ) {
22882297 _edit.numeric_next_decimal = -1 ;
22892298 }
2290- } else if (key == Key::ENTER || key == Key::KP_ENTER || key == Key::SPACE) {
2299+ } else if (keycode == Key::ENTER || keycode == Key::KP_ENTER || keycode == Key::SPACE) {
22912300 commit_transform ();
22922301 } else {
22932302 processed = false ;
0 commit comments