From a76a3d2acd9577373220b89d24d169095b91e574 Mon Sep 17 00:00:00 2001 From: gramps Date: Wed, 19 Aug 2026 15:02:47 -0700 Subject: [PATCH] fix: BRB backdrop seed replaces existing instead of skipping SeedBrbBackdrop() now updates the AssetId on an existing Background source instead of bailing when one already exists. This ensures the new brb-backdrop.jpg replaces any old image already in the DB. --- ViewModels/MainViewModel.cs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs index 0bd7af9..870c0dc 100644 --- a/ViewModels/MainViewModel.cs +++ b/ViewModels/MainViewModel.cs @@ -1771,7 +1771,6 @@ public class MainViewModel : ViewModelBase { var brb = Scenes.FirstOrDefault(s => SceneCatalog.Is(s.Name, "BRB")); if (brb == null) return; - if (brb.Elements.OfType().Any(s => s.Type == SourceType.Background)) return; var uri = new Uri("pack://application:,,,/Assets/brb-backdrop.jpg", UriKind.Absolute); using var stream = Application.GetResourceStream(uri)?.Stream; @@ -1781,14 +1780,25 @@ public class MainViewModel : ViewModelBase var bytes = ms.ToArray(); var assetId = AddAsset(bytes); if (assetId == null) return; - brb.Elements.Add(new Source + + var existing = brb.Elements.OfType().FirstOrDefault(s => s.Type == SourceType.Background); + if (existing != null) { - Name = "Background", - Type = SourceType.Background, - AssetId = assetId, - Width = 1920, - Height = 1080, - }); + existing.AssetId = assetId; + existing.Width = 1920; + existing.Height = 1080; + } + else + { + brb.Elements.Add(new Source + { + Name = "Background", + Type = SourceType.Background, + AssetId = assetId, + Width = 1920, + Height = 1080, + }); + } } catch { /* non-critical — stream works fine without a default bg */ } }