1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 15:39:49 +00:00
Pixelorama/Scripts/LayerContainer.gd
OverloadedOrama 7318db30ab Major UI changes - including new icons!
- New UI icons for the tools, layer and frame buttons.
- Removed clone, remove and move frame buttons. You can now right click on a frame button to do these actions instead.
- Added first, previous, next and last frame buttons to the timeline.
- Added rulers for the main canvas viewport.
- Window size bumped to 1152x648.
- Default FPS is now 6 instead of 1.
- Fill tool renamed to Bucket.
- Mouse default cursor shape for the canvas is the arrow instead of cross.
- Mouse default cursor shape for the mirror and onion skinning buttons is the pointing hand.
2019-11-19 23:23:43 +02:00

68 lines
2.6 KiB
GDScript

extends Button
class_name LayerContainer
var i
# warning-ignore:unused_class_variable
var currently_selected := false
func _ready() -> void:
changed_selection()
func _on_LayerContainer_pressed() -> void:
var initially_pressed := pressed
var label_initially_visible : bool = $HBoxContainer/Label.visible
Global.canvas.current_layer_index = i
changed_selection()
if !initially_pressed:
if label_initially_visible:
$HBoxContainer/Label.visible = false
$HBoxContainer/LineEdit.visible = true
$HBoxContainer/LineEdit.editable = true
else:
$HBoxContainer/Label.visible = true
$HBoxContainer/LineEdit.visible = false
$HBoxContainer/LineEdit.editable = false
func changed_selection() -> void:
var parent = get_parent()
for child in parent.get_children():
if child is Button:
child.get_node("HBoxContainer/Label").visible = true
child.get_node("HBoxContainer/LineEdit").visible = false
child.get_node("HBoxContainer/LineEdit").editable = false
if Global.canvas.current_layer_index == child.i:
child.currently_selected = true
child.pressed = true
if Global.canvas.current_layer_index < Global.canvas.layers.size() - 1:
Global.move_up_layer_button.disabled = false
Global.move_up_layer_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
else:
Global.move_up_layer_button.disabled = true
Global.move_up_layer_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
if Global.canvas.current_layer_index > 0:
Global.move_down_layer_button.disabled = false
Global.move_down_layer_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
Global.merge_down_layer_button.disabled = false
Global.merge_down_layer_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
else:
Global.move_down_layer_button.disabled = true
Global.move_down_layer_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
Global.merge_down_layer_button.disabled = true
Global.merge_down_layer_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
else:
child.currently_selected = false
child.pressed = false
func _on_VisibilityButton_pressed() -> void:
if Global.canvas.layers[i][3]:
Global.canvas.layers[i][3] = false
get_child(0).get_child(0).texture_normal = preload("res://Assets/Graphics/Layers/layer_invisible.png")
else:
Global.canvas.layers[i][3] = true
get_child(0).get_child(0).texture_normal = preload("res://Assets/Graphics/Layers/layer_visible.png")
func _on_LineEdit_text_changed(new_text : String) -> void:
Global.canvas.layers[i][2] = new_text
$HBoxContainer/Label.text = new_text