1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Merge pull request #73651 from hakro/editor-freelook-physical-shortcuts

Use physical shortcuts for freelook navigation in the editor
This commit is contained in:
Rémi Verschelde
2023-03-03 11:02:53 +01:00
6 changed files with 29 additions and 24 deletions

View File

@@ -1468,7 +1468,7 @@ Ref<Shortcut> ED_GET_SHORTCUT(const String &p_path) {
return sc;
}
void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_keycode) {
void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_keycode, bool p_physical) {
ERR_FAIL_NULL_MSG(EditorSettings::get_singleton(), "EditorSettings not instantiated yet.");
Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
@@ -1477,10 +1477,10 @@ void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_k
PackedInt32Array arr;
arr.push_back((int32_t)p_keycode);
ED_SHORTCUT_OVERRIDE_ARRAY(p_path, p_feature, arr);
ED_SHORTCUT_OVERRIDE_ARRAY(p_path, p_feature, arr, p_physical);
}
void ED_SHORTCUT_OVERRIDE_ARRAY(const String &p_path, const String &p_feature, const PackedInt32Array &p_keycodes) {
void ED_SHORTCUT_OVERRIDE_ARRAY(const String &p_path, const String &p_feature, const PackedInt32Array &p_keycodes, bool p_physical) {
ERR_FAIL_NULL_MSG(EditorSettings::get_singleton(), "EditorSettings not instantiated yet.");
Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
@@ -1505,7 +1505,7 @@ void ED_SHORTCUT_OVERRIDE_ARRAY(const String &p_path, const String &p_feature, c
Ref<InputEventKey> ie;
if (keycode != Key::NONE) {
ie = InputEventKey::create_reference(keycode);
ie = InputEventKey::create_reference(keycode, p_physical);
events.push_back(ie);
}
}
@@ -1518,13 +1518,13 @@ void ED_SHORTCUT_OVERRIDE_ARRAY(const String &p_path, const String &p_feature, c
sc->set_meta("original", events.duplicate(true));
}
Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, Key p_keycode) {
Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, Key p_keycode, bool p_physical) {
PackedInt32Array arr;
arr.push_back((int32_t)p_keycode);
return ED_SHORTCUT_ARRAY(p_path, p_name, arr);
return ED_SHORTCUT_ARRAY(p_path, p_name, arr, p_physical);
}
Ref<Shortcut> ED_SHORTCUT_ARRAY(const String &p_path, const String &p_name, const PackedInt32Array &p_keycodes) {
Ref<Shortcut> ED_SHORTCUT_ARRAY(const String &p_path, const String &p_name, const PackedInt32Array &p_keycodes, bool p_physical) {
Array events;
for (int i = 0; i < p_keycodes.size(); i++) {
@@ -1539,7 +1539,7 @@ Ref<Shortcut> ED_SHORTCUT_ARRAY(const String &p_path, const String &p_name, cons
Ref<InputEventKey> ie;
if (keycode != Key::NONE) {
ie = InputEventKey::create_reference(keycode);
ie = InputEventKey::create_reference(keycode, p_physical);
events.push_back(ie);
}
}