[EXPERIMENTAL] Re-making the timeline

Trying to merge layers into the timeline, and eventually add more features like "share layer with all frames", among others. THIS IS NOT FINISHED, IT WILL *NOT* WORK PROPERLY. Once it is finished, this branch will be merged onto master.

So far only add layer and add frame work, and even they may have some issues. Undoing also does not work properly yet.

The UI is also not finished, as it currently has problems with the scroll containers.
This commit is contained in:
OverloadedOrama 2020-01-18 21:06:47 +02:00
parent 7c408731b8
commit 953d002d91
12 changed files with 758 additions and 710 deletions

View file

@ -1,16 +1,16 @@
class_name LayerContainer
extends Button
var i
var i := 0
# warning-ignore:unused_class_variable
var currently_selected := false
onready var visibility_button := $VisibilityButton
onready var visibility_button := $HBoxContainer/VisibilityButton
onready var label := $HBoxContainer/Label
onready var line_edit := $HBoxContainer/LineEdit
func _ready() -> void:
changed_selection()
#changed_selection()
if Global.canvas.layers[i][3]:
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)
@ -27,8 +27,8 @@ func _input(event : InputEvent) -> void:
func _on_LayerContainer_pressed() -> void:
var initially_pressed := pressed
var label_initially_visible : bool = label.visible
Global.canvas.current_layer_index = i
changed_selection()
# Global.canvas.current_layer_index = i
# changed_selection()
if !initially_pressed:
if label_initially_visible:
label.visible = false
@ -44,14 +44,15 @@ func changed_selection() -> void:
var parent := get_parent()
for child in parent.get_children():
if child is Button:
#print(child.name)
child.label.visible = true
child.line_edit.visible = false
child.line_edit.editable = false
if Global.canvas.current_layer_index == child.i: # The selected layer
child.currently_selected = true
child.pressed = true
Global.layer_opacity_slider.value = Global.canvas.layers[child.i][4] * 100
Global.layer_opacity_spinbox.value = Global.canvas.layers[child.i][4] * 100
Global.layer_opacity_slider.value = Global.canvas.layers[child.i][3] * 100
Global.layer_opacity_spinbox.value = Global.canvas.layers[child.i][3] * 100
if Global.canvas.current_layer_index < Global.canvas.layers.size() - 1:
Global.move_up_layer_button.disabled = false
@ -86,5 +87,5 @@ func _on_VisibilityButton_pressed() -> void:
Global.canvas.update()
func _on_LineEdit_text_changed(new_text : String) -> void:
Global.canvas.layers[i][2] = new_text
Global.layers[i][0] = new_text
label.text = new_text