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

All ExtResource ids change after saving (4.1 regression) #77172

Closed
rakkarage opened this issue May 17, 2023 · 6 comments · Fixed by #77749
Closed

All ExtResource ids change after saving (4.1 regression) #77172

rakkarage opened this issue May 17, 2023 · 6 comments · Fixed by #77749

Comments

@rakkarage
Copy link
Contributor

rakkarage commented May 17, 2023

Godot version

v4.1.dev.custom_build [a8453cb]

System information

Windows 11, Core i5-12400F, RX 6600

Issue description

in recent custom 4.1 builds it is regening every ext id on every save even if just one simple file

[gd_scene load_steps=2 format=3 uid="uid://bj3w1run711x7"]

[ext_resource type="Texture2D" uid="uid://c082xolc76p8n" path="res://icon.svg" id="1_ftki2"]

[node name="Node2D" type="Node2D"]

[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(351, 294)
texture = ExtResource("1_ftki2")

can use a script like this save all files and regen all ext ids in project

@tool
extends EditorScript

func listFiles(path: String, extensions: Array = []) -> Array:
	var list := []
	for dir in DirAccess.get_directories_at(path):
		if not dir.begins_with("."):
			list.append_array(listFiles(path + dir + "/", extensions))
	for file in DirAccess.get_files_at(path):
		var ext := file.split(".")[-1]
		if not file.begins_with(".") and ext != "import":
			if extensions.is_empty() or ext in extensions:
				list.append(path + file)
	return list

func _run() -> void:
	for file in listFiles("res://", ["tscn", "tres"]):
		ResourceSaver.save(load(file))

in 4.0.2 this script does not regen every ext id in the project each time it is run (just when needed) but in latest 4.1 it does
but just ctrl+s works'nt too

thanks

thought it was related to this but maybe not
#76693

Steps to reproduce

  • make new scene with ext resource (new control, new sprite, set texture to icon)
    1 - save, stage changes
    2 - goto 1

or can use script on any project to see that it applies to everything, everywhere, all at once

Minimal reproduction project

n/a

@rakkarage rakkarage changed the title 4.1 all Local to Scene SubResource Ids change after saving 4.1.custom all Local to Scene SubResource Ids change after saving May 17, 2023
@DevanOBoyle
Copy link
Contributor

I'm interested in tackling this issue.

@AThousandShips
Copy link
Member

Note that these are ExtResource IDs not SubResource IDs which are non-external, this seems to be handled here:

external_resources[instance] = itos(index) + "_" + Resource::generate_scene_unique_id(); // Keep the order for improved thread loading performance.

And here:
String id = itos(external_resources.size() + 1) + "_" + Resource::generate_scene_unique_id();

@rakkarage rakkarage changed the title 4.1.custom all Local to Scene SubResource Ids change after saving 4.1.custom all ext Ids change after saving May 17, 2023
@vmedea
Copy link
Contributor

vmedea commented May 24, 2023

i've noticed this running recent builds of master as well, it makes git history hard to read due to the noise on every save. If it's useful i could bisect it to find what commit introduced this behavior.

@akien-mga akien-mga added this to the 4.1 milestone May 24, 2023
@akien-mga
Copy link
Member

I've seen this too. Bisecting the regression would be very helpful yes :)

@akien-mga akien-mga changed the title 4.1.custom all ext Ids change after saving All ExtResource ids change after saving (4.1 regression) May 24, 2023
@vmedea
Copy link
Contributor

vmedea commented May 24, 2023

I narrowed it down to: 8983b20 " Avoid interaction issues between resource loading threads " (#74405)

@KoBeWi
Copy link
Member

KoBeWi commented Jun 1, 2023

This issue makes the current version unusable for people using VCS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants