summaryrefslogtreecommitdiffstats
path: root/editor/editor_file_system.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-07-08 19:13:24 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-07-08 19:13:24 +0200
commit137b138be80d9fc333c77bf96970aab2f44971f7 (patch)
tree2b5d2278b7f44d59810bc785ced5ba9f10fa27f5 /editor/editor_file_system.cpp
parentec02d406ca0b9c822addff49cf58e9a72cf74eb0 (diff)
parentf13bb2ff569e220dc3191229e36b66f1ef2123ca (diff)
downloadredot-engine-137b138be80d9fc333c77bf96970aab2f44971f7.tar.gz
Merge pull request #84974 from KoBeWi/import_reimport
Reimport file when .import changes
Diffstat (limited to 'editor/editor_file_system.cpp')
-rw-r--r--editor/editor_file_system.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 65ae25e046..3a0ed44104 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);