godotengine / godotengine/godot

Not all sub-sub-resource properties of a `PackedScene` are saved when using the CLI with `godot --headless --script`

Open
#89,074 0 comments 0 reactions 0 assignees View on GitHub
bug topic:core
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: v4.2.2.rc1.official.c7fb0645a

### System information

Ubuntu 22.10, Vulkan, NVIDIA GeForce RTX™ 2060 / NVIDIA GeForce RTX™ 2060

### Issue description

When saving a `PackedScene` with `ResourceSaver.save()` not all sub-sub-resource properties are properly saved when running Godot from CLI with `--headless`.

### Steps to reproduce

Open the Minimal Reproduction Project folder. Make sure to run `godot --headless --editor --quit` at least once so all resources are imported.

Run `godot --headless --script dbg.gd` and notice that the new file `saved.tscn` which should be a copy of `dbg.tscn` has the wrong *Material > Shader Parameters > Line Thickness* value. It should be `10`, but its `0`.

You'll also notice in the print statements that the values are loaded correctly so it most likely is the interaction between `ResourceSaver.save()` and `--headless`, because running `godot --script dbg.gd` properly saves all the properties. At least for this case.

A hack for now is to save `dbg.tscn`'s `ShaderMaterial` resource to disk instead of being internal. Then running `godot --headless --script dbg.gd` properly saves the *Material > Shader Parameters > Line Thickness* value as well in `saved.tscn`.

### Minimal reproduction project (MRP)

[godot-dbg.zip](https://github.com/godotengine/godot/files/14468323/godot-dbg.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the minimal reproduction project's dbg.gd and dbg.tscn, and run `godot --headless --editor --quit` followed by `godot --headless --script dbg.gd`. Trace the ResourceSaver.save() path for internal sub-resources and compare saved.tscn with dbg.tscn; done means the ShaderMaterial's Line Thickness is saved as 10 in headless mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, godot
Domain
cli, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.