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

@ -580,7 +580,7 @@ void EditorAssetLibrary::_notification(int p_what) {
}
}
void EditorAssetLibrary::_unhandled_input(const Ref<InputEvent> &p_event) {
void EditorAssetLibrary::_unhandled_key_input(const Ref<InputEvent> &p_event) {
const Ref<InputEventKey> key = p_event;
if (key.is_valid() && key->is_pressed()) {
@ -1281,7 +1281,7 @@ void EditorAssetLibrary::disable_community_support() {
}
void EditorAssetLibrary::_bind_methods() {
ClassDB::bind_method("_unhandled_input", &EditorAssetLibrary::_unhandled_input);
ClassDB::bind_method("_unhandled_key_input", &EditorAssetLibrary::_unhandled_key_input);
ADD_SIGNAL(MethodInfo("install_asset", PropertyInfo(Variant::STRING, "zip_path"), PropertyInfo(Variant::STRING, "name")));
}
@ -1454,7 +1454,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
description = nullptr;
set_process(true);
set_process_unhandled_input(true);
set_process_unhandled_key_input(true); // Global shortcuts since there is no main element to be focused.
downloads_scroll = memnew(ScrollContainer);
downloads_scroll->set_enable_h_scroll(true);