1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 09:39:48 +00:00

Update the button textures accordingly

Every button will have a texture based on its frame AND its layer. Which means, if the button is on layer 2 and frame 1, its texture will be the contents of frame 1's layer 2 contents.
This commit is contained in:
OverloadedOrama 2020-01-19 01:14:35 +02:00
parent 7d7eccb03f
commit 3df9853dda

View file

@ -465,7 +465,7 @@ func redo(_canvases : Array, layer_index : int = -1) -> void:
layers_container.move_child(layer_container, 1) layers_container.move_child(layer_container, 1)
frames_container.add_child(layers[current_layer][1]) frames_container.add_child(layers[current_layer][1])
frames_container.move_child(layers[current_layer][1], 2) frames_container.move_child(layers[current_layer][1], 1)
for i in range(canvases.size()): for i in range(canvases.size()):
var frame_button = load("res://Prefabs/FrameButton.tscn").instance() var frame_button = load("res://Prefabs/FrameButton.tscn").instance()
frame_button.frame = i frame_button.frame = i
@ -487,8 +487,8 @@ func redo(_canvases : Array, layer_index : int = -1) -> void:
label.align = Label.ALIGN_CENTER label.align = Label.ALIGN_CENTER
label.text = str(canvases.size() + 1) label.text = str(canvases.size() + 1)
frame_ids.add_child(label) frame_ids.add_child(label)
if !frames_container.is_a_parent_of(_canvases[0].frame_button): #if !frames_container.is_a_parent_of(_canvases[0].frame_button):
frames_container.add_child(_canvases[0].frame_button) # frames_container.add_child(_canvases[0].frame_button)
elif action_name == "Remove Frame": elif action_name == "Remove Frame":
canvas_parent.remove_child(_canvases[0]) canvas_parent.remove_child(_canvases[0])
frames_container.remove_child(_canvases[0].frame_button) frames_container.remove_child(_canvases[0].frame_button)
@ -527,10 +527,10 @@ func frame_changed(value : int) -> void:
var text_color := Color.white var text_color := Color.white
if theme_type == "Gold" || theme_type == "Light": if theme_type == "Gold" || theme_type == "Light":
text_color = Color.black text_color = Color.black
c.frame_button.pressed = false #c.frame_button.pressed = false
#c.frame_button.get_node("FrameID").add_color_override("font_color", text_color) #c.frame_button.get_node("FrameID").add_color_override("font_color", text_color)
# Make only the current frame button pressed # Make only the current frame button pressed
canvas.frame_button.pressed = true #canvas.frame_button.pressed = true
#canvas.frame_button.get_node("FrameID").add_color_override("font_color", Color("#3c5d75")) #canvas.frame_button.get_node("FrameID").add_color_override("font_color", Color("#3c5d75"))
func create_brush_button(brush_img : Image, brush_type := Brush_Types.CUSTOM, hint_tooltip := "") -> void: func create_brush_button(brush_img : Image, brush_type := Brush_Types.CUSTOM, hint_tooltip := "") -> void: