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

Implement new shortcuts system.

unhandled_key_input changed to unhandled_button_input. Controls can set a 'shortcut_context' which they can then use to determine if their shortcuts should be triggered or not, based on if the viewport's focused GUI control is a child of their 'shortcut context'.
This commit is contained in:
Eric M
2020-09-17 11:40:00 +10:00
parent fc806409f4
commit efe5c250d5
26 changed files with 154 additions and 54 deletions

View File

@@ -581,6 +581,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
HBoxContainer *hbc = memnew(HBoxContainer);
edit_menu = memnew(MenuButton);
edit_menu->set_shortcut_context(this);
edit_menu->set_text(TTR("Edit"));
edit_menu->set_switch_on_hover(true);
@@ -605,6 +606,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
edit_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option));
search_menu = memnew(MenuButton);
search_menu->set_shortcut_context(this);
search_menu->set_text(TTR("Search"));
search_menu->set_switch_on_hover(true);
@@ -615,6 +617,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option));
MenuButton *goto_menu = memnew(MenuButton);
goto_menu->set_shortcut_context(this);
goto_menu->set_text(TTR("Go To"));
goto_menu->set_switch_on_hover(true);
goto_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option));