2021-03-15 16:22:11 +01:00
|
|
|
tool
|
|
|
|
extends MenuButton
|
|
|
|
|
|
|
|
var current_piece
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
# Gotta love the nodes system some times
|
|
|
|
# Praise the paths (っ´ω`c)♡
|
|
|
|
current_piece = get_parent().get_parent().get_parent().get_parent()
|
|
|
|
var popup = get_popup()
|
|
|
|
popup.connect("index_pressed", self, "_on_OptionSelected")
|
|
|
|
|
|
|
|
|
|
|
|
func _on_OptionSelected(index):
|
2021-03-27 10:53:28 +01:00
|
|
|
var timeline_editor = current_piece.editor_reference.get_node('MainPanel/TimelineEditor')
|
2021-03-15 16:22:11 +01:00
|
|
|
if index == 0:
|
|
|
|
# Moving this up
|
2021-03-27 10:53:28 +01:00
|
|
|
timeline_editor.move_block(current_piece, 'up')
|
2021-03-15 16:22:11 +01:00
|
|
|
elif index == 1:
|
|
|
|
# Moving piece down
|
2021-03-27 10:53:28 +01:00
|
|
|
timeline_editor.move_block(current_piece, 'down')
|
2021-03-15 16:22:11 +01:00
|
|
|
elif index == 3:
|
|
|
|
# Removing a piece
|
2021-04-07 22:32:31 +02:00
|
|
|
if timeline_editor.selected_item != current_piece:
|
|
|
|
timeline_editor._select_item(current_piece)
|
|
|
|
timeline_editor.delete_event()
|
2021-03-27 10:53:28 +01:00
|
|
|
timeline_editor.indent_events()
|