Corrupted scene when moving a GLB file and its animation files
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
- Import a GLB into a folder
- Save an inherited scene
- extract the animation using the Advanced Import, into the same folder or a child folder
- move the parent folder to a new place
Minimal reproduction project (MRP)
NA
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.
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:
- Somehow remap paths in all .import files when moving/renaming. Not very realistic with the current state of the code.
- Store uids only, instead of paths, in import settings and the .import file (and display the path in the dialog). The more sensible solution, but do all relevant resource types support uid?
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
Somewhat reproducible on v4.5.dev.custom_build [209a446e3]. I get the following errors, although the export path in my .glb.import file seems to have been correctly renamed to res://models/subfolder/idle.res (the new path I moved the files too):
ERROR: Cannot open file 'res://models/idle.res'.
ERROR: Failed loading resource: res://models/idle.res. Make sure resources have been imported by opening the project in the editor at least once.
It seems then like part of the issue is resolved, but not all of it. I am wondering if perhaps the thing that is not being updated properly is the generated scene file for the .glb model in .godot/imported (though as far as I can tell it looks alright). Another possibility is that while everything is renamed correctly for the new locations, the order means that some errors are emitted at some point along the process.