diff options
Diffstat (limited to 'editor/editor_file_dialog.cpp')
-rw-r--r-- | editor/editor_file_dialog.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index c2e829e312..25fade46d6 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -95,11 +95,13 @@ void EditorFileDialog::_notification(int p_what) { } } -void EditorFileDialog::_unhandled_input(const InputEvent &p_event) { +void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { - if (p_event.type == InputEvent::KEY && is_window_modal_on_top()) { + Ref<InputEventKey> k = p_event; - if (p_event.key.pressed) { + if (k.is_valid() && is_window_modal_on_top()) { + + if (k->is_pressed()) { bool handled = false; @@ -488,8 +490,9 @@ void EditorFileDialog::update_file_list() { if (!has_icon("ResizedFolder", "EditorIcons")) { Ref<ImageTexture> folder = get_icon("FolderBig", "EditorIcons"); - Image img = folder->get_data(); - img.resize(thumbnail_size, thumbnail_size); + Ref<Image> img = folder->get_data(); + img = img->duplicate(); + img->resize(thumbnail_size, thumbnail_size); Ref<ImageTexture> resized_folder = Ref<ImageTexture>(memnew(ImageTexture)); resized_folder->create_from_image(img, 0); Theme::get_default()->set_icon("ResizedFolder", "EditorIcons", resized_folder); @@ -499,8 +502,9 @@ void EditorFileDialog::update_file_list() { if (!has_icon("ResizedFile", "EditorIcons")) { Ref<ImageTexture> file = get_icon("FileBig", "EditorIcons"); - Image img = file->get_data(); - img.resize(thumbnail_size, thumbnail_size); + Ref<Image> img = file->get_data(); + img = img->duplicate(); + img->resize(thumbnail_size, thumbnail_size); Ref<ImageTexture> resized_file = Ref<ImageTexture>(memnew(ImageTexture)); resized_file->create_from_image(img, 0); Theme::get_default()->set_icon("ResizedFile", "EditorIcons", resized_file); |