diff --git a/Scripts/Canvas.gd b/Scripts/Canvas.gd index 1a65143e4..d0545141e 100644 --- a/Scripts/Canvas.gd +++ b/Scripts/Canvas.gd @@ -517,7 +517,6 @@ func generate_layer_panels() -> void: layer_container.get_child(1).get_child(0).texture = layers[i][1] layer_container.get_child(1).get_child(1).text = layers[i][2] layer_container.get_child(1).get_child(2).text = layers[i][2] - layers[i][3] = true # Set visible Global.vbox_layer_container.add_child(layer_container) func pencil_and_eraser(mouse_pos : Vector2, color : Color, current_mouse_button : String, current_action := "None") -> void: diff --git a/Scripts/LayerContainer.gd b/Scripts/LayerContainer.gd index 27a37a761..d873eb563 100644 --- a/Scripts/LayerContainer.gd +++ b/Scripts/LayerContainer.gd @@ -10,11 +10,15 @@ onready var label := $HBoxContainer/Label onready var line_edit := $HBoxContainer/LineEdit func _ready() -> void: - visibility_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible.png" % Global.theme_type) - visibility_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible_Hover.png" % Global.theme_type) changed_selection() + if Global.canvas.layers[i][3]: + visibility_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible.png" % Global.theme_type) + visibility_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible_Hover.png" % Global.theme_type) + else: + visibility_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Layer_Invisible.png" % Global.theme_type) + visibility_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Layer_Invisible_Hover.png" % Global.theme_type) -func _input(event : InputEvent): +func _input(event : InputEvent) -> void: if event.is_action_released("ui_accept") && line_edit.visible && event.scancode != KEY_SPACE: label.visible = true line_edit.visible = false @@ -79,6 +83,7 @@ func _on_VisibilityButton_pressed() -> void: Global.canvas.layers[i][3] = true visibility_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible.png" % Global.theme_type) visibility_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible_Hover.png" % Global.theme_type) + Global.canvas.update() func _on_LineEdit_text_changed(new_text : String) -> void: Global.canvas.layers[i][2] = new_text