godotengine / godot

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

Corrupted scene when moving a GLB file and its animation files #95637

Open Nodragem opened 3 months ago

Nodragem commented 3 months ago

Tested versions

4.3 stable

System information

Windows 11

Issue description

I have put all the files related to my character in a folder; that is a .tscn, a .glb and extracted animation. After moving this folder to another folder, I get all the scenes that uses this character tagged as corrupted.

After some research, I can see that the .import did not update the save_to_file/path for extracted animation:

[remap]

importer="scene"
importer_version=1
type="PackedScene"
uid="uid://duds002tisele"
valid=false

[deps]

source_file="res://characters/enemies/melee/minion/small_ennemy_animated.glb"

[params]

nodes/root_type=""
nodes/root_name="Skin"
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={
"animations": {
"Attack": {
"save_to_file/enabled": true,
"save_to_file/keep_custom_tracks": true,
"save_to_file/path": "res://enemies/melee/minion/Attack.res",

res://enemies/melee/minion/Attack.res should now be res://characters/enemies/melee/minion/Attack.res To correct these paths fixed the issue.

Also, note that it might be good to give more details on why a scene is corrupted and tell the user that this is the glb import being corrupted.

Steps to reproduce

Minimal reproduction project (MRP)

NA

Nodragem commented 3 months ago

Note 1: I think the bug will also extend to FBX and other 3D files import. Note 2: I experienced the same problem when moving a 3D file with an extracted material. Might need to open another issue, but it is probably a similar bug.

Jordyfel commented 3 months ago

I've come across this as well and investigated a bit. All paths for extraction in the advanced import dialog do not work with moving/renaming, and do not use uids at all.

The solution would be to either:

The relevant code is across scene_import_settings for the settings write and filesystem_dock for moving/renaming files

https://github.com/godotengine/godot/blob/96be44c0ec4bafcb08d78be1a584b751b424db9f/editor/import/3d/scene_import_settings.cpp#L1517-L1561