Skip to content

Commit

Permalink
Button textures change based on their filename and not their node name
Browse files Browse the repository at this point in the history
Restored layer nodes back to their previous names
  • Loading branch information
OverloadedOrama committed Dec 21, 2019
1 parent 23b83c8 commit 8058cf2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
24 changes: 12 additions & 12 deletions Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ margin_left = 6.0
margin_right = 218.0
margin_bottom = 32.0

[node name="New_Layer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
[node name="AddLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
"LayerButtons",
]]
margin_right = 32.0
Expand All @@ -1208,7 +1208,7 @@ mouse_default_cursor_shape = 2
texture_normal = ExtResource( 37 )
texture_hover = ExtResource( 38 )

[node name="Delete_Layer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
[node name="RemoveLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
"LayerButtons",
]]
margin_left = 36.0
Expand All @@ -1221,7 +1221,7 @@ texture_normal = ExtResource( 39 )
texture_hover = ExtResource( 40 )
texture_disabled = ExtResource( 41 )

[node name="Move_Up" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
[node name="MoveUpLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
"LayerButtons",
]]
margin_left = 72.0
Expand All @@ -1234,7 +1234,7 @@ texture_normal = ExtResource( 42 )
texture_hover = ExtResource( 43 )
texture_disabled = ExtResource( 44 )

[node name="Move_Down" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
[node name="MovwDownLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
"LayerButtons",
]]
margin_left = 108.0
Expand All @@ -1247,7 +1247,7 @@ texture_normal = ExtResource( 45 )
texture_hover = ExtResource( 46 )
texture_disabled = ExtResource( 47 )

[node name="Clone_Layer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
[node name="CloneLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
"LayerButtons",
]]
margin_left = 144.0
Expand All @@ -1258,7 +1258,7 @@ mouse_default_cursor_shape = 2
texture_normal = ExtResource( 48 )
texture_hover = ExtResource( 49 )

[node name="Merge_Down" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
[node name="MergeDownLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons" groups=[
"LayerButtons",
]]
margin_left = 180.0
Expand Down Expand Up @@ -1744,12 +1744,12 @@ visible = false
[connection signal="value_changed" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/OnionSkinningButtons/PastOnionSkinning" to="." method="_on_PastOnionSkinning_value_changed"]
[connection signal="value_changed" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/OnionSkinningButtons/FutureOnionSkinning" to="." method="_on_FutureOnionSkinning_value_changed"]
[connection signal="toggled" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/OnionSkinningButtons/BlueRedMode" to="." method="_on_BlueRedMode_toggled"]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/New_Layer" to="." method="add_layer"]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/Delete_Layer" to="." method="_on_RemoveLayerButton_pressed"]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/Move_Up" to="." method="change_layer_order" binds= [ 1 ]]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/Move_Down" to="." method="change_layer_order" binds= [ -1 ]]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/Clone_Layer" to="." method="add_layer" binds= [ false ]]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/Merge_Down" to="." method="_on_MergeLayer_pressed"]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/AddLayer" to="." method="add_layer"]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/RemoveLayer" to="." method="_on_RemoveLayerButton_pressed"]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/MoveUpLayer" to="." method="change_layer_order" binds= [ 1 ]]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/MovwDownLayer" to="." method="change_layer_order" binds= [ -1 ]]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/CloneLayer" to="." method="add_layer" binds= [ false ]]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/CenterLayerButtons/LayerButtons/MergeDownLayer" to="." method="_on_MergeLayer_pressed"]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/PaletteVBoxContainer/PaletteButtons/RemovePalette" to="." method="_on_RemovePalette_pressed"]
[connection signal="item_selected" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/PaletteVBoxContainer/PaletteButtons/PaletteOptionButton" to="." method="_on_PaletteOptionButton_item_selected"]
[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/PaletteVBoxContainer/PaletteButtons/EditPalette" to="." method="_on_EditPalette_pressed"]
Expand Down
4 changes: 2 additions & 2 deletions Prefabs/LayerContainer.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ __meta__ = {
"_edit_horizontal_guides_": [ ]
}

[node name="Layer_Visible" type="TextureButton" parent="." groups=[
[node name="VisibilityButton" type="TextureButton" parent="." groups=[
"LayerButtons",
]]
margin_left = 6.0
Expand Down Expand Up @@ -68,5 +68,5 @@ editable = false
caret_blink = true
caret_blink_speed = 0.5
[connection signal="pressed" from="." to="." method="_on_LayerContainer_pressed"]
[connection signal="pressed" from="Layer_Visible" to="." method="_on_VisibilityButton_pressed"]
[connection signal="pressed" from="VisibilityButton" to="." method="_on_VisibilityButton_pressed"]
[connection signal="text_changed" from="HBoxContainer/LineEdit" to="." method="_on_LineEdit_text_changed"]
8 changes: 4 additions & 4 deletions Scripts/Global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ func _ready() -> void:
frame_container = find_node_by_name(root, "FrameContainer")

var layer_buttons = find_node_by_name(root, "LayerButtons")
remove_layer_button = find_node_by_name(layer_buttons, "Delete_Layer")
move_up_layer_button = find_node_by_name(layer_buttons, "Move_Up")
move_down_layer_button = find_node_by_name(layer_buttons, "Move_Down")
merge_down_layer_button = find_node_by_name(layer_buttons, "Merge_Down")
remove_layer_button = find_node_by_name(layer_buttons, "RemoveLayer")
move_up_layer_button = find_node_by_name(layer_buttons, "MoveUpLayer")
move_down_layer_button = find_node_by_name(layer_buttons, "MovwDownLayer")
merge_down_layer_button = find_node_by_name(layer_buttons, "MergeDownLayer")
vbox_layer_container = find_node_by_name(root, "VBoxLayerContainer")

add_palette_button = find_node_by_name(root, "AddPalette")
Expand Down
4 changes: 1 addition & 3 deletions Scripts/LayerContainer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var i
# warning-ignore:unused_class_variable
var currently_selected := false

onready var visibility_button := $Layer_Visible
onready var visibility_button := $VisibilityButton
onready var label := $HBoxContainer/Label
onready var line_edit := $HBoxContainer/LineEdit

Expand Down Expand Up @@ -71,12 +71,10 @@ func changed_selection() -> void:
func _on_VisibilityButton_pressed() -> void:
if Global.canvas.layers[i][3]:
Global.canvas.layers[i][3] = false
visibility_button.name = "Layer_Invisible"
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.canvas.layers[i][3] = true
visibility_button.name = "Layer_Visible"
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)

Expand Down
9 changes: 6 additions & 3 deletions Scripts/PreferencesDialog.gd
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ func change_theme(ID : int) -> void:
Global.vertical_ruler.add_stylebox_override("hover", ruler_style)
Global.vertical_ruler.add_stylebox_override("focus", ruler_style)
for button in get_tree().get_nodes_in_group("LayerButtons"):
button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/%s.png" % [Global.theme_type, button.name])
button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/%s_Hover.png" % [Global.theme_type, button.name])
var normal_file_name = button.texture_normal.resource_path.get_file()
button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/%s" % [Global.theme_type, normal_file_name])
var hover_file_name = button.texture_hover.resource_path.get_file()
button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/%s" % [Global.theme_type, hover_file_name])
if button.texture_disabled:
button.texture_disabled = load("res://Assets/Graphics/%s Themes/Layers/%s_Disabled.png" % [Global.theme_type, button.name])
var disabled_file_name = button.texture_disabled.resource_path.get_file()
button.texture_disabled = load("res://Assets/Graphics/%s Themes/Layers/%s" % [Global.theme_type, disabled_file_name])

func _on_GridWidthValue_value_changed(value : float) -> void:
Global.grid_width = value
Expand Down

0 comments on commit 8058cf2

Please sign in to comment.