Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Allow Backspace to delete GraphNodes on macOS in the default input map

Hugo Locurcio60723db8a08d
diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp
index 99f61a21bae..a226de83a74 100644
--- a/core/input/input_map.cpp
+++ b/core/input/input_map.cpp
@@ -822,6 +822,11 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE));
default_builtin_cache.insert("ui_graph_delete", inputs);
+ inputs = List<Ref<InputEvent>>();
+ inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE));
+ inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE));
+ default_builtin_cache.insert("ui_graph_delete.macos", inputs);
+
inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::LEFT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_graph_follow_left", inputs);
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml
index 60d2a4ec3e1..77acce192c0 100644
--- a/doc/classes/GraphEdit.xml
+++ b/doc/classes/GraphEdit.xml
@@ -483,7 +483,7 @@
<signal name="delete_nodes_request">
<param index="0" name="nodes" type="StringName[]" />
<description>
- Emitted when this [GraphEdit] captures a [code]ui_graph_delete[/code] action ([kbd]Delete[/kbd] by default).
+ Emitted when this [GraphEdit] captures a [code]ui_graph_delete[/code] action ([kbd]Delete[/kbd] by default, or [kbd]Backspace[/kbd]/[kbd]Delete[/kbd] on macOS).
[param nodes] is an array of node names that should be removed. These usually include all selected nodes.
</description>
</signal>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 38ed7dbb3c6..a3d34c4a7b6 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -1412,6 +1412,9 @@
Default [InputEventAction] to delete a [GraphNode] in a [GraphEdit].
[b]Note:[/b] Default [code]ui_*[/code] actions cannot be removed as they are necessary for the internal logic of several [Control]s. The events assigned to the action can however be modified.
</member>
+ <member name="input/ui_graph_delete.macos" type="Dictionary" setter="" getter="">
+ macOS specific override for the shortcut to delete a [GraphNode] in a [GraphEdit].
+ </member>
<member name="input/ui_graph_duplicate" type="Dictionary" setter="" getter="">
Default [InputEventAction] to duplicate a [GraphNode] in a [GraphEdit].
[b]Note:[/b] Default [code]ui_*[/code] actions cannot be removed as they are necessary for the internal logic of several [Control]s. The events assigned to the action can however be modified.