diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-11-11 14:18:25 -0600 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-11-11 14:18:25 -0600 |
commit | 2430b7f9b41c84e37c4d47f5adde9cdb9c9b1d59 (patch) | |
tree | 4de561a465a0acf5ec66ee4b23a24458b28215ef /editor | |
parent | 93815e7e9767058ec5bf54c2bae442bbfcfc074e (diff) | |
parent | d57846087b225d2d8b7e8dca5db0a3874924e448 (diff) | |
download | redot-engine-2430b7f9b41c84e37c4d47f5adde9cdb9c9b1d59.tar.gz |
Merge pull request #97352 from reduz/uids-everywhere
Universalize UID support in all resource types
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_file_system.cpp | 9 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 558eed98c6..0c284feb37 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1259,6 +1259,15 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir, } } } + + if (fi->uid == ResourceUID::INVALID_ID && ResourceLoader::exists(path) && !ResourceLoader::has_custom_uid_support(path) && !FileAccess::exists(path + ".uid")) { + // Create a UID. + Ref<FileAccess> f = FileAccess::open(path + ".uid", FileAccess::WRITE); + if (f.is_valid()) { + fi->uid = ResourceUID::get_singleton()->create_id(); + f->store_line(ResourceUID::get_singleton()->id_to_text(fi->uid)); + } + } } if (fi->uid != ResourceUID::INVALID_ID) { diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index a468d71568..fcd5a572b4 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1446,6 +1446,13 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_ } } + if (p_item.is_file && FileAccess::exists(old_path + ".uid")) { + err = da->rename(old_path + ".uid", new_path + ".uid"); + if (err != OK) { + EditorNode::get_singleton()->add_io_error(TTR("Error moving:") + "\n" + old_path + ".uid\n"); + } + } + // Update scene if it is open. for (int i = 0; i < file_changed_paths.size(); ++i) { String new_item_path = p_item.is_file ? new_path : file_changed_paths[i].replace_first(old_path, new_path); |