Added a boolean to check if new frames will be linked and an array of linked frames to Global.layers

This doesn't add any new functionality right now
This commit is contained in:
OverloadedOrama 2020-03-14 21:40:10 +02:00
parent f9ee251b01
commit a60efccbfd
6 changed files with 42 additions and 42 deletions

View file

@ -4,12 +4,14 @@ extends Button
var i := 0
var visibility_button : BaseButton
var lock_button : BaseButton
var linked_button : BaseButton
var label : Label
var line_edit : LineEdit
func _ready() -> void:
visibility_button = Global.find_node_by_name(self, "VisibilityButton")
lock_button = Global.find_node_by_name(self, "LockButton")
linked_button = Global.find_node_by_name(self, "LinkButton")
label = Global.find_node_by_name(self, "Label")
line_edit = Global.find_node_by_name(self, "LineEdit")
@ -27,6 +29,13 @@ func _ready() -> void:
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Unlock.png" % Global.theme_type)
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Unlock_Hover.png" % Global.theme_type)
if Global.layers[i][4]: # If new layers will be linked
linked_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Linked_Layer.png" % Global.theme_type)
linked_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Linked_Layer_Hover.png" % Global.theme_type)
else:
linked_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Unlinked_Layer.png" % Global.theme_type)
linked_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Unlinked_Layer_Hover.png" % Global.theme_type)
func _input(event : InputEvent) -> void:
if (event.is_action_released("ui_accept") or event.is_action_released("ui_cancel")) and line_edit.visible and event.scancode != KEY_SPACE:
save_layer_name(line_edit.text)
@ -49,22 +58,11 @@ func save_layer_name(new_name : String) -> void:
Global.layers[i][0] = new_name
func _on_VisibilityButton_pressed() -> void:
if Global.layers[i][1]:
Global.layers[i][1] = false
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)
else:
Global.layers[i][1] = 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.layers[i][1] = !Global.layers[i][1]
Global.canvas.update()
func _on_LockButton_pressed() -> void:
if Global.layers[i][2]:
Global.layers[i][2] = false
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Unlock.png" % Global.theme_type)
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Unlock_Hover.png" % Global.theme_type)
else:
Global.layers[i][2] = true
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Lock.png" % Global.theme_type)
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Lock_Hover.png" % Global.theme_type)
Global.layers[i][2] = !Global.layers[i][2]
func _on_LinkButton_pressed() -> void:
Global.layers[i][4] = !Global.layers[i][4]