godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.18k stars 21.2k forks source link

Escn resources not reloaded. #19966

Closed panzergame closed 1 year ago

panzergame commented 6 years ago

Godot version: master (8ce6444f595839d6c0128427d17100b6f361e26c)

OS/device including version: Linux localhost.localdomain 4.9.95-gentoo #2 SMP Wed Jun 27 16:10:10 -00 2018 x86_64 Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz GenuineIntel GNU/Linux

Issue description: escn files are not reloaded when modified

Steps to reproduce: Create a escn file with a sub resource ArrayMesh and a MeshInstance usign it, then open it in godot through any project, back to the escn and modify the first array index of the ArrayMesh, back to godot it reloads resources but the mesh is unchanged.

Debugging Some debug prints were added in branch (dirty sorry) https://github.com/panzergame/godot/tree/debug_escn_reload to expose in details the loading of property "surfaces/0"

The first init look like :

create node type : ArrayMesh at path : res://test.escn::1
find property of type: 26
convert dict
find property of type: 5
key : array_data
find property of type: 31
convert array (288)
find property of type: 5
key : vertex_count
find property of type: 40
find property of type: 5
key : array_index_data
find property of type: 31
convert array (72)
find property of type: 5
key : index_count
find property of type: 40
find property of type: 5
key : primitive
find property of type: 40
find property of type: 5
key : format
find property of type: 40
find property of type: 5
key : aabb
find property of type: 15
find property of type: 5
key : skeleton_aabb
find property of type: 30
convert array (0)
find property of type: 5
key : blend_shape_data
find property of type: 30
convert array (0)
add surface, indices :
        0
        0
        1
        0
        2
        0
        2
        0
        1
        0
        3
        0
        4
        0
        5
        0
        6
        0
        6
        0
        5
        0
        7
        0
        8
        0
        9
        0
        10
        0
        10
        0
        9
        0
        11
        0

After modifying the escn the debug prints are the same, using gdb and a breakpoint to ResourceInteractiveLoaderBinary::open which open the file used in ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v), the parent functions ResourceLoader::_load, ResourceLoader::loadand finally ResourceFormatImporter::load are certainly using a wrong path. The path gets from ResourceFormatImporter::_get_path_and_type is res://.import/test.escn-de1328157aaff12ffc6ce9d30945ff18.scn which is still the old resource. This is confirmed by the fact that deleting the .import directory force the recreation of the resource properly.

Other than that the ArrayMesh is recreated every time and add_surface is called every time.

So the path seems incorrect or the file targeted by this path isn't updated.

Minimal reproduction project: escn_reload.zip

sdfgeoff commented 6 years ago

Quick note that on larger than trivial escn files, this frequently causes godot to segfault, or other strange behavior (some object transforms are weird, matching neither old nor new file)

reduz commented 5 years ago

Will work on improving this workflow after 3,1 is out, together with the new 3D demo.

QbieShay commented 5 years ago

bump @reduz

KoBeWi commented 3 years ago

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

coderarnold commented 2 years ago

I confirm this bug is still in Godot v4 alpha 16. I have an escn file instanced in a tscn. When I update the escn, Godot does its thing, it reloads according to the popup with progress bars inside, but then nothing changes in the tscn.

When I go to the folder .godot/imported and delete both the scn and md5 files whil Godot is open, to force an update, Godot regenerates them but unchanged, I don't know where it gets the old data... probably from memory because when I close Godot, delete the md5 and scn files, then reopen Godot, it generates them correctly.

KoBeWi commented 2 years ago

@coderarnold Does it update if you restart the editor? (without deleting any files)

coderarnold commented 2 years ago

No it doesn't. However I found out that if I close in the editor the tscn which is referencing the escn, then regenerate the escn (must be different), it reloads correctly and I can reopen the tscn. It's a bit tedious but this workaround works.

KoBeWi commented 2 years ago

Well that does sound similar to #61423

coderarnold commented 2 years ago

Possibly yes.

lyuma commented 1 year ago

Likely fixed by #71409. Please reopen the issue if you are still affected. See also #61423 was closed