Skip to content

A uid still will be assigned when copying resource with importer set to keep or skip #112336

@Rindbee

Description

@Rindbee

Tested versions

System information

Godot v4.6.dev (0fdbf05) - Linux Mint 22.2 (Zara) on X11 - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - integrated AMD Radeon Graphics (RADV PHOENIX) - AMD Ryzen 7 8745H w/ Radeon 780M Graphics (16 threads) - 25.22 GiB memory

Issue description

When the importer of an importable resource file is configured to keep or skip, the file will not be assigned a UID.

However, when the file is copied, the copied file will be assigned a new UID.

// 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
Ref<ConfigFile> cfg;
cfg.instantiate();
cfg->load(p_from + ".import");
cfg->set_value("remap", "uid", ResourceUID::get_singleton()->id_to_text(res_uid));
err = cfg->save(p_to + ".import");
if (err != OK) {
return err;
}
// Make sure it's immediately added to the map so we can remap dependencies if we want to after this.
ResourceUID::get_singleton()->add_id(res_uid, p_to);

The importer should be checked to determine whether a uid should be assigned.

Steps to reproduce

  1. Copy icon.svg to 1.svg and import it as keep or skip;
  2. Open and view 1.svg.import;
[remap]

importer="keep"
  1. In the FileSystem dock, copy 1.svg to 2.svg;
  2. Open and view 2.svg.import.
[remap]

importer="keep"
uid="uid://c61530ca75hre"

Minimal reproduction project (MRP)

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions