2020-10-19 14:57:40 +00:00
|
|
|
extends ConfirmationDialog
|
|
|
|
|
|
|
|
onready var frame_num = $VBoxContainer/GridContainer/FrameNum
|
|
|
|
onready var frame_dur = $VBoxContainer/GridContainer/FrameTime
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
|
|
|
func set_frame_label(frame: int) -> void:
|
2020-10-19 14:57:40 +00:00
|
|
|
frame_num.set_text(str(frame + 1))
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
|
|
|
func set_frame_dur(duration: float) -> void:
|
2020-12-10 18:39:29 +00:00
|
|
|
frame_dur.set_value(duration)
|
2020-10-19 14:57:40 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
2020-10-19 14:57:40 +00:00
|
|
|
func _on_FrameProperties_popup_hide() -> void:
|
|
|
|
Global.dialog_open(false)
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
2020-10-19 14:57:40 +00:00
|
|
|
func _on_FrameProperties_confirmed():
|
2021-11-25 12:48:30 +00:00
|
|
|
var frame: int = int(frame_num.get_text()) - 1
|
|
|
|
var duration: float = frame_dur.get_value()
|
2020-12-16 20:54:08 +00:00
|
|
|
var new_duration = Global.current_project.frames[frame].duration
|
|
|
|
new_duration = duration
|
2020-10-19 14:57:40 +00:00
|
|
|
|
|
|
|
Global.current_project.undos += 1
|
|
|
|
Global.current_project.undo_redo.create_action("Change frame duration")
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
Global.current_project.undo_redo.add_do_property(
|
|
|
|
Global.current_project.frames[frame], "duration", new_duration
|
|
|
|
)
|
|
|
|
Global.current_project.undo_redo.add_undo_property(
|
|
|
|
Global.current_project.frames[frame],
|
|
|
|
"duration",
|
|
|
|
Global.current_project.frames[frame].duration
|
|
|
|
)
|
2020-10-19 14:57:40 +00:00
|
|
|
|
|
|
|
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
|
|
|
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
|
|
|
Global.current_project.undo_redo.commit_action()
|