From fe34c45d2af3157ce1dbe65fd8b624851109a02d Mon Sep 17 00:00:00 2001 From: Juan Date: Mon, 23 Sep 2024 16:07:40 +0200 Subject: Allow passing UID to importer This helps, for importers spitting out new resources to the res:// filesystem to actually hash them to generate deterministic UIDs. This PR also fixes the determinism for translations. --- editor/editor_file_system.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'editor/editor_file_system.cpp') diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 558eed98c6..e2ad78164d 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -2740,13 +2740,17 @@ Error EditorFileSystem::_reimport_file(const String &p_file, const HashMapcreate_id(); + } + //finally, perform import!! String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(p_file); List import_variants; List gen_files; Variant meta; - Error err = importer->import(p_file, base_path, params, &import_variants, &gen_files, &meta); + Error err = importer->import(uid, p_file, base_path, params, &import_variants, &gen_files, &meta); // As import is complete, save the .import file. @@ -2767,10 +2771,6 @@ Error EditorFileSystem::_reimport_file(const String &p_file, const HashMapstore_line("type=\"" + importer->get_resource_type() + "\""); } - if (uid == ResourceUID::INVALID_ID) { - uid = ResourceUID::get_singleton()->create_id(); - } - f->store_line("uid=\"" + ResourceUID::get_singleton()->id_to_text(uid) + "\""); // Store in readable format. if (err == OK) { -- cgit v1.2.3