properly load slider values in menu

This commit is contained in:
Crispy 2021-07-22 15:40:39 +02:00
parent 774d678bd7
commit 284cfa3c2f
3 changed files with 18 additions and 6 deletions

View file

@ -1,5 +1,7 @@
extends Node extends Node
signal loaded_settings
onready var p = get_parent() onready var p = get_parent()
var loaded := false var loaded := false
var _needs_sync := true var _needs_sync := true
@ -66,6 +68,7 @@ func load_all() -> void:
print("FAILED to load settings") print("FAILED to load settings")
save_all() save_all()
loaded = true loaded = true
emit_signal("loaded_settings")
func _on_SyncTimer_timeout() -> void: func _on_SyncTimer_timeout() -> void:

View file

@ -158,7 +158,7 @@ icon = ExtResource( 4 )
anchor_top = -0.016 anchor_top = -0.016
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = -0.016 anchor_bottom = -0.016
margin_top = -455.944 margin_top = -905.944
margin_bottom = -6.944 margin_bottom = -6.944
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
@ -168,11 +168,12 @@ __meta__ = {
margin_left = 8.0 margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 168.0 margin_right = 168.0
margin_bottom = 441.0 margin_bottom = 891.0
min_value = 0.1 min_value = 0.1
max_value = 1.0 max_value = 1.0
step = 0.05 step = 0.05
value = 0.4 value = 0.4
scrollable = false
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
@ -203,8 +204,9 @@ margin_bottom = 441.0
focus_mode = 0 focus_mode = 0
min_value = 0.3 min_value = 0.3
max_value = 1.0 max_value = 1.0
step = 0.05 step = 0.1
value = 1.0 value = 1.0
scrollable = false
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }

View file

@ -5,17 +5,24 @@ var overlay
func _ready() -> void: func _ready() -> void:
overlay = OverlayManager.get_node(overlay_name) overlay = OverlayManager.get_node(overlay_name)
overlay.get_node("OverlaySettingsSync").connect("loaded_settings", self, "_apply_loaded")
$MoreOptions/Container/List/SetSize/PanelContainer.visible = false $MoreOptions/Container/List/SetSize/PanelContainer.visible = false
$MoreOptions/Container/List/SetAlpha/PanelContainer.visible = false $MoreOptions/Container/List/SetAlpha/PanelContainer.visible = false
$MoreOptions/Container/List/SetSize/PanelContainer/SizeSlider.value = overlay.width_meters
$MoreOptions.visible = false $MoreOptions.visible = false
$BasicOptions/Label.text = overlay_name $BasicOptions/Label.text = overlay_name
name = overlay_name name = overlay_name
# overlay.connect("overlay_visible_changed", self, "_overlay_visible_changed")
# overlay.connect("path_changed", self, "_update_warning")
func _apply_loaded():
$MoreOptions/Container/List/SetSize/PanelContainer/SizeSlider.value = overlay.width_meters
$MoreOptions/Container/List/Target.selected = overlay.TARGETS.find(overlay.target) $MoreOptions/Container/List/Target.selected = overlay.TARGETS.find(overlay.target)
overlay.connect("overlay_visible_changed", self, "_overlay_visible_changed") $MoreOptions/Container/List/SetAlpha/PanelContainer/AlphaSlider.value = overlay.alpha
overlay.connect("path_changed", self, "_update_warning") _overlay_visible_changed(overlay.overlay_visible)
_update_warning()
func _update_warning(): func _update_warning():