fix(@projects/@magic-civilization): 🎨 defer palette-variant warning until palettes load
set_palette_variant can run before set_theme populates _palettes (settings_manager applies saved display prefs at _ready, ahead of theme load). Remember the desired valid variant silently instead of warning; the missing-variant warning now only fires once palettes are actually loaded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
0b147e66a9
commit
edcc5454e6
1 changed files with 9 additions and 0 deletions
|
|
@ -185,6 +185,15 @@ func set_palette_variant(variant_id: String) -> void:
|
|||
if not VALID_VARIANTS.has(variant_id):
|
||||
push_warning("ThemeAssets: unknown palette variant '%s'" % variant_id)
|
||||
return
|
||||
# Palettes load with the theme (set_theme), which can run AFTER autoloads
|
||||
# like settings_manager apply their saved display prefs at _ready. Before the
|
||||
# theme loads, _palettes is empty — remember the desired (valid) variant
|
||||
# silently instead of warning (set_theme establishes the default once
|
||||
# palettes load). The warning below is reserved for a genuinely-missing
|
||||
# variant after palettes ARE loaded.
|
||||
if _palettes.is_empty():
|
||||
_active_palette_variant = variant_id
|
||||
return
|
||||
if not _palettes.has(variant_id):
|
||||
push_warning("ThemeAssets: palette '%s' not loaded" % variant_id)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue