-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
TSCN/TRES subresource random reordering of CollisionPolygon2Ds #5889
Comments
I had this problem in this issue #5289 [node name="About" type="TextureButton" parent="CanvasLayer/Sprite"]
-margin/left = 87.0
-margin/top = -6.0
-margin/right = 111.0
-margin/bottom = 10.0
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
+margin/left = 87.0
+margin/top = -6.0
+margin/right = 111.0
+margin/bottom = 10.0
toggle_mode = false
textures/normal = ExtResource( 4 )
textures/pressed = ExtResource( 4 )
textures/hover = ExtResource( 5 ) -[sub_resource type="ConcavePolygonShape2D" id=13]
+[sub_resource type="ConcavePolygonShape2D" id=3]
custom_solver_bias = 0.0
segments = Vector2Array( -16, -13, -12, -8, -12, -8, -10, -3, -10, -3, -10, 3, -10, 3, -12, 8, -12, 8, -16, 13, -16, 13, -16, -13 )
-[sub_resource type="ConcavePolygonShape2D" id=14]
+[sub_resource type="ConcavePolygonShape2D" id=4]
custom_solver_bias = 0.0
segments = Vector2Array( -16, -1, 16, -1, 16, -1, 16, 11, 16, 11, -10, 11, -10, 11, -16, -1 )
-[sub_resource type="ConvexPolygonShape2D" id=16]
+[sub_resource type="ConvexPolygonShape2D" id=5]
custom_solver_bias = 0.0
points = Vector2Array( -16, -1, 16, -1, 16, 11, -16, 11 )
-[sub_resource type="ConvexPolygonShape2D" id=17]
+[sub_resource type="ConvexPolygonShape2D" id=6]
etc |
This is not a bug and It should not be fixed. The resources have effectively changed by re-building the tileset, so Godot will not try to overwrite their internal IDs. Remember that the internal IDs are persistent, mean to always represent the same resource inside the file. In this case, the resources are replaced so Godot will assign different IDs to them. |
What we could try to do instead is to somehow steal the IDs of the previews tile item when converting/merging to tileset |
Have you tried my steps to reproduce? This happens even when not re-building the tileset. And effectively, the IDs do not represent the same resources inside the file, since their IDs change. |
let me check if i can do this |
just checking this and I don't really think it could be done.. maybe with a lot of hacking |
In the example I gave I suggested to recreate the tileset without merging as it makes the issue easier to reproduce, but I also get such diffs on tileset resources that I haven't modified in weeks. Just saving the scene that uses it sometimes changes the ordering of subresources. |
For example clone https://github.com/KOBUGE-Games/jetpaca, open |
Some more discussion from today on IRC:
So this will likely have to wait for 3.0 to be fixed properly. I promise to ensure (by harassing @reduz) that such diffs are eradicated in 3.0 ;) |
@Zylann Regarding your diff on |
I remember i fixed dictionaries at some point, which got rid of many of these issues. Is this still a problem? |
so I guess this can be closed now, @akien-mga ? would be the sixteenth version of the issue present in the 3.0 milestone :P |
IIRC a lot of dictionaries now use OrderedHashMap so this could have been fixed. |
I haven't checked in depth, but assuming fixed. |
Operating system or device - Godot version:
Mageia 6 x64, git master HEAD
Issue description (what happened, and what was expected):
Loading a tileset source TSCN and saving it, and/or exporting/saving again an existing TRES tileset resource generates random redistribution of the subresources' IDs, leading to unnecessary diffs.
Steps to reproduce:
git diff
)mountain_tileset.tscn
in the editor, export the TileSet to overwritemountain_tileset.tres
(make sure to untick "Merge with existing").git diff
: it might show some random reordering of the subresources inmountain_tileset.tres
. If it doesn't, close the editor, and repeat step 2 and 3. It might take several attempts to happen.git add .
the changes to take it as the new "reference" (in case the previous state was actually bad).TileMap.tscn
might also exhibit the issue, as it resaves the TRES resource.The behaviour is a bit non-deterministic, it kind of looks like the order of the subresources depends on the time, or the way the resources were loaded into memory in the editor, etc.
At any rate, some way should be found to ensure that such resources won't get randomly reordered, and ideally they should be sorted by ascending IDs.
Example diff:
Link to minimal example project (optional but very welcome):
tres_subresource_reordering.zip
The text was updated successfully, but these errors were encountered: