Files
LlamaCasty/Models/Scene.cs
T
gramps 8e1d6f44db Scene strip tile artwork + on-air indicator (creator ruling 2026-10-10). Top-bar tiles now carry their own art: each canonical scene's tile is a per-scene CRT-styled image stored in the internal DB (Scene.ThumbnailAssetId - additive migration, seeded at heal from the creator's five Downloads JPGs via SceneThumbnailSeedPaths), and the preview pane keeps rendering the scene's ORIGINAL background - never the tiles. One shared on-air image (Gemini 4zajyl...jpg) replaces the staged scene's tile and follows the scene swap ('the on-air screen jumps around the top bar as the user swaps scenes'): stored as an Asset BLOB tracked by the OnAirImageAssetId Setting (EnsureOnAirImage, same contract as the alert clip) with MainViewModel.OnAirSeedPath override; RefreshSnapshotsAsync shows it for the staged scene, otherwise thumbnail-or-background art, and a staged Live with no on-air art still falls back to the green placeholder (minis never render live captures). Removed the 6px #22c55e rectangle in PreviewPane's backdrop ('green outline around the preview screen' that surfaced when a scene had no background) - the outer PreviewGlow red border is the real live signal. Doubled the scene-tile labels (FontSize 10 -> 20). Fixed a real bug this surfaced: Save()'s Asset pruner only kept Source/alert-clip rows, so the first save would have DELETED the seeded tile + on-air assets - the keep-set now includes Scene.ThumbnailAssetId and the OnAirImageAssetId Setting. New Settings/Load/Save migrations + SceneThumbnailTests (4 tests: seeded tile in strip, preview keeps original bg, Live-staged tile, no-seed fallback, on-air swap + persistence). 427 pass, 0 build warnings. (Unit: strip tiles + on-air)
2026-10-10 13:27:26 -07:00

114 lines
3.4 KiB
C#

using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Media.Imaging;
namespace ytLive.Models;
public class Scene : INotifyPropertyChanged
{
public string Id { get; init; } = Guid.NewGuid().ToString();
private string _name = string.Empty;
private bool _isHidden;
private bool _hasBackground;
private bool _hasSocialBar;
private bool _isStaged;
private bool _isLive;
private string _hotkeyLabel = string.Empty;
public bool IsStaged
{
get => _isStaged;
set => Set(ref _isStaged, value);
}
public bool IsLive
{
get => _isLive;
set => Set(ref _isLive, value);
}
public string Name
{
get => _name;
set => Set(ref _name, value);
}
public bool IsHidden
{
get => _isHidden;
set => Set(ref _isHidden, value);
}
/// <summary>
/// Whether the scene has a live desktop/game background layer. Enforced by
/// policy: only the canonical Live scene ever has one (see SceneCatalog).
/// </summary>
public bool HasBackground
{
get => _hasBackground;
set => Set(ref _hasBackground, value);
}
/// <summary>
/// Whether the social bar plays on this scene. Toggled by the footer [+]/[-]
/// control — the socials themselves are a global resource (see SocialsConfig).
/// </summary>
public bool HasSocialBar
{
get => _hasSocialBar;
set => Set(ref _hasSocialBar, value);
}
/// <summary>
/// The scene's rendered elements in z-order (back to front): multi-instance
/// Sources plus this scene's webcam usage (<see cref="WebcamConfig"/>), if any.
/// </summary>
public ObservableCollection<SceneElement> Elements { get; } = new();
/// <summary>This scene's webcam usage, or null if the creator hasn't added the webcam here.</summary>
public WebcamSceneConfig? WebcamConfig => Elements.OfType<WebcamSceneConfig>().FirstOrDefault();
public bool IsChatScene { get; init; }
/// <summary>
/// Asset-table id of this scene's top-strip tile artwork. The tile is a
/// separate image from the scene's background: the preview pane keeps
/// rendering the scene's original background, the strip shows this instead.
/// Null = the strip falls back to the background art (creator ruling 2026-10-10).
/// </summary>
public string? ThumbnailAssetId { get; set; }
private BitmapSource? _snapshot;
/// <summary>
/// Cached thumbnail snapshot of this scene for the control surface strip.
/// Updated by the compositor when the scene is not live-previewed.
/// </summary>
public BitmapSource? Snapshot
{
get => _snapshot;
set => Set(ref _snapshot, value);
}
/// <summary>
/// The current hotkey label for this scene (e.g. "F1", "Ctrl+F10").
/// Set by MainViewModel from the active bindings; empty for non-canonical scenes.
/// </summary>
public string HotkeyLabel
{
get => _hotkeyLabel;
set => Set(ref _hotkeyLabel, value);
}
public event PropertyChangedEventHandler? PropertyChanged;
private void Set<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value)) return;
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}