1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Don't assign a uid when copying resource file whose importer name

is `keep` or `skip`
This commit is contained in:
风青山
2025-11-03 16:21:46 +08:00
parent 0fdbf050e0
commit aed8f32e72

View File

@@ -3085,13 +3085,19 @@ Error EditorFileSystem::_copy_file(const String &p_from, const String &p_to) {
return err; return err;
} }
// Roll a new uid for this copied .import file to avoid conflict.
ResourceUID::ID res_uid = ResourceUID::get_singleton()->create_id_for_path(p_to);
// Save the new .import file // Save the new .import file
Ref<ConfigFile> cfg; Ref<ConfigFile> cfg;
cfg.instantiate(); cfg.instantiate();
cfg->load(p_from + ".import"); cfg->load(p_from + ".import");
String importer_name = cfg->get_value("remap", "importer");
if (importer_name == "keep" || importer_name == "skip") {
err = da->copy(p_from + ".import", p_to + ".import");
return err;
}
// Roll a new uid for this copied .import file to avoid conflict.
ResourceUID::ID res_uid = ResourceUID::get_singleton()->create_id_for_path(p_to);
cfg->set_value("remap", "uid", ResourceUID::get_singleton()->id_to_text(res_uid)); cfg->set_value("remap", "uid", ResourceUID::get_singleton()->id_to_text(res_uid));
err = cfg->save(p_to + ".import"); err = cfg->save(p_to + ".import");
if (err != OK) { if (err != OK) {