From f31466fb8062ca9fb5dc29fc733deebcd8755438 Mon Sep 17 00:00:00 2001 From: don-tnowe <67479453+don-tnowe@users.noreply.github.com> Date: Mon, 1 May 2023 11:20:12 +0300 Subject: [PATCH] Fix constant refresh on edit If not all files are of same resource type --- addons/resources_spreadsheet_view/editor_view.gd | 2 +- .../import_export/formats_edit/edit_tres.gd | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/resources_spreadsheet_view/editor_view.gd b/addons/resources_spreadsheet_view/editor_view.gd index c969490..1e0ed76 100644 --- a/addons/resources_spreadsheet_view/editor_view.gd +++ b/addons/resources_spreadsheet_view/editor_view.gd @@ -56,7 +56,7 @@ func _on_filesystem_changed(): else: for k in remembered_paths: - if remembered_paths[k] == null: + if !is_instance_valid(remembered_paths[k]): continue if remembered_paths[k].resource_path != k: diff --git a/addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd b/addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd index 5a69d98..eb19696 100644 --- a/addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd +++ b/addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd @@ -64,8 +64,9 @@ func import_from_path(folderpath : String, insert_func : Callable, sort_by : Str var res : Resource while filepath != "": + res = null + filepath = folderpath + filepath if filepath.ends_with(".tres"): - filepath = folderpath + filepath res = load(filepath) if !is_instance_valid(cur_dir_script): editor_view.fill_property_data(res) @@ -75,8 +76,8 @@ func import_from_path(folderpath : String, insert_func : Callable, sort_by : Str if res.get_script() == cur_dir_script: insert_func.call(res, rows, sort_by, sort_reverse) - editor_view.remembered_paths[res.resource_path] = res + editor_view.remembered_paths[filepath] = res filepath = dir.get_next() return rows