diff options
author | kobewi <kobewi4e@gmail.com> | 2023-11-16 14:53:09 +0100 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2024-06-29 19:57:44 +0200 |
commit | f13bb2ff569e220dc3191229e36b66f1ef2123ca (patch) | |
tree | f7735477a3638cc703d0baa9b8200a85def174bf | |
parent | 25de53e147a04ba15afc461b3ad4aa1884ff927d (diff) | |
download | redot-engine-f13bb2ff569e220dc3191229e36b66f1ef2123ca.tar.gz |
Reimport file when .import changes
-rw-r--r-- | editor/editor_file_system.cpp | 16 | ||||
-rw-r--r-- | editor/editor_file_system.h | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index f0dc850af0..435eee98bc 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -150,6 +150,11 @@ uint64_t EditorFileSystemDirectory::get_file_modified_time(int p_idx) const { return files[p_idx]->modified_time; } +uint64_t EditorFileSystemDirectory::get_file_import_modified_time(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx, files.size(), 0); + return files[p_idx]->import_modified_time; +} + String EditorFileSystemDirectory::get_file_script_class_name(int p_idx) const { return files[p_idx]->script_class_name; } @@ -720,7 +725,16 @@ bool EditorFileSystem::_update_scan_actions() { int idx = ia.dir->find_file_index(ia.file); ERR_CONTINUE(idx == -1); String full_path = ia.dir->get_file_path(idx); - if (_test_for_reimport(full_path, false)) { + + bool need_reimport = _test_for_reimport(full_path, false); + if (!need_reimport && FileAccess::exists(full_path + ".import")) { + uint64_t import_mt = ia.dir->get_file_import_modified_time(idx); + if (import_mt != FileAccess::get_modified_time(full_path + ".import")) { + need_reimport = true; + } + } + + if (need_reimport) { //must reimport reimports.push_back(full_path); Vector<String> dependencies = _get_dependencies(full_path); diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index b0c6f0de51..47b658a558 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -89,6 +89,7 @@ public: Vector<String> get_file_deps(int p_idx) const; bool get_file_import_is_valid(int p_idx) const; uint64_t get_file_modified_time(int p_idx) const; + uint64_t get_file_import_modified_time(int p_idx) const; String get_file_script_class_name(int p_idx) const; //used for scripts String get_file_script_class_extends(int p_idx) const; //used for scripts String get_file_script_class_icon_path(int p_idx) const; //used for scripts |