fix(background): Use default background actually restores the shipped art

Browse… writes the chosen picture into BOTH CustomBackgroundPath and AssetId, and the default
stamp bails when AssetId is already set. So flipping "Use default background" back on changed a
bool while the preview kept showing the custom image — it looked like the switch did nothing.

Turning the default on now clears the custom pointer and the asset, re-runs
StampDefaultBackgroundAsset for the scene's shipped art, and only then invalidates the bake,
updates the preview and refreshes thumbnails.

BackgroundTests pass (17); Release 0 warnings.
This commit is contained in:
2026-11-01 15:59:10 -08:00
parent c297b3fb0f
commit d6088f8e35
+15
View File
@@ -107,6 +107,21 @@ public partial class MainViewModel : ViewModelBase
{
if (e.PropertyName == nameof(SceneElement.UseDefaultBackground))
{
// ⛔ Turning the default back ON has to RE-STAMP the shipped art. Browse… writes the
// custom image into both CustomBackgroundPath AND AssetId, so without this the toggle
// flipped a bool while the preview kept showing the custom picture — the setting
// appeared to do nothing (creator report, 2026-11-01).
if (StagedScene is { } scene)
{
var background = scene.Elements.OfType<Source>().FirstOrDefault(s => s.IsBackground);
if (background is { UseDefaultBackground: true })
{
background.CustomBackgroundPath = null;
background.AssetId = null; // lets the stamp run
StampDefaultBackgroundAsset(background, scene.Name);
}
}
if (StagedScene != null) _sceneGraph.InvalidateBake(StagedScene);
UpdateBackgroundImage();
RefreshSnapshotsAsync();