From 778c86183fe087bd410d4a540d9cab6d139c9374 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Wed, 18 Mar 2020 02:02:41 +0200 Subject: [PATCH] Cel buttons have a green outline to indicate that they're linked The first time the link button get pressed, the currently selected cel is being linked. In futue commits, new frames will be linked on layers where the link button is pressed. --- Prefabs/FrameButton.tscn | 7 +++++++ Scripts/FrameButton.gd | 2 ++ Scripts/LayerContainer.gd | 2 ++ 3 files changed, 11 insertions(+) diff --git a/Prefabs/FrameButton.tscn b/Prefabs/FrameButton.tscn index 6822506..33443f4 100644 --- a/Prefabs/FrameButton.tscn +++ b/Prefabs/FrameButton.tscn @@ -33,5 +33,12 @@ margin_right = 20.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 items = [ "Remove Frame", null, 0, false, true, -1, 0, null, "", false, "Clone Frame", null, 0, false, false, -1, 0, null, "", false, "Move Left", null, 0, false, true, -1, 0, null, "", false, "Move Right", null, 0, false, true, -1, 0, null, "", false ] + +[node name="LinkedIndicator" type="Polygon2D" parent="."] +visible = false +color = Color( 0.0627451, 0.741176, 0.215686, 1 ) +invert_enable = true +invert_border = 1.0 +polygon = PoolVector2Array( 0, 0, 36, 0, 36, 36, 0, 36 ) [connection signal="pressed" from="." to="." method="_on_FrameButton_pressed"] [connection signal="id_pressed" from="PopupMenu" to="." method="_on_PopupMenu_id_pressed"] diff --git a/Scripts/FrameButton.gd b/Scripts/FrameButton.gd index 98ec516..7c45747 100644 --- a/Scripts/FrameButton.gd +++ b/Scripts/FrameButton.gd @@ -7,6 +7,8 @@ onready var popup_menu := $PopupMenu func _ready() -> void: hint_tooltip = "Frame: %s, Layer: %s" % [frame, layer] + if frame in Global.layers[layer][5]: + get_node("LinkedIndicator").visible = true func _on_FrameButton_pressed() -> void: if Input.is_action_just_released("left_mouse"): diff --git a/Scripts/LayerContainer.gd b/Scripts/LayerContainer.gd index d7e9a59..4f61492 100644 --- a/Scripts/LayerContainer.gd +++ b/Scripts/LayerContainer.gd @@ -66,3 +66,5 @@ func _on_LockButton_pressed() -> void: func _on_LinkButton_pressed() -> void: Global.layers[i][4] = !Global.layers[i][4] + if !Global.layers[i][5]: + Global.layers[i][5].append(Global.current_frame)