Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimport file when .import changes #84974

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions editor/editor_file_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class EditorFileSystemDirectory : public Object {
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
Expand Down
Loading