overlay instances use defaults if a setting is missing

This commit is contained in:
Crispy 2021-06-08 19:10:07 +02:00
parent dd28bdcb54
commit 9a5e58351f
2 changed files with 13 additions and 9 deletions

View file

@ -69,17 +69,21 @@ func add_grab():
func load_settings():
if Settings.s.overlays.has(name):
var loaded = Settings.s.overlays[name]
if loaded.has("fallback"):
fallback = loaded.fallback
set_target(loaded.target)
if loaded.has("target"):
set_target(loaded.target)
set_width_in_meters(loaded.width)
for t_key in loaded.offsets:
var t_offset = loaded.offsets[t_key]
_offsets[t_key].pos = t_offset.pos
_offsets[t_key].rot = t_offset.rot
if loaded.has("offsets"):
for t_key in loaded.offsets:
var t_offset = loaded.offsets[t_key]
_offsets[t_key].pos = t_offset.pos
_offsets[t_key].rot = t_offset.rot
update_offset()
if loaded.has("width"):
set_width_in_meters(loaded.width)
if loaded.has("visible"):
set_overlay_visible(loaded.visible)
if loaded.has("alpha"):

View file

@ -7,11 +7,11 @@ func _ready() -> void:
overlay = OverlayManager.get_node(overlay_name)
$MoreOptions/Container/List/SetSize/PanelContainer.visible = false
$MoreOptions/Container/List/SetAlpha/PanelContainer.visible = false
$MoreOptions/Container/List/SetSize/PanelContainer/SizeSlider.value = Settings.s.overlays[overlay_name].width
$MoreOptions/Container/List/SetSize/PanelContainer/SizeSlider.value = overlay.width_meters
$MoreOptions.visible = false
$BasicOptions/Label.text = overlay_name
name = overlay_name
$MoreOptions/Container/List/Target.selected = overlay.TARGETS.find(Settings.s.overlays[overlay_name].target)
$MoreOptions/Container/List/Target.selected = overlay.TARGETS.find(overlay.target)
overlay.connect("overlay_visibility_changed", self, "_overlay_visibility_changed")