mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-03-06 03:23:14 +00:00
Instead of having a frame_duration[] array in the Project class. This makes the code much more readable and understandable, using less lines of code and, by avoiding an extra array, we also avoid potential out-of-bound array crashes. The functionality for the user has not changed, and by testing so far I didn't find any issues.
29 lines
1.1 KiB
GDScript
29 lines
1.1 KiB
GDScript
extends ConfirmationDialog
|
|
|
|
onready var frame_num = $VBoxContainer/GridContainer/FrameNum
|
|
onready var frame_dur = $VBoxContainer/GridContainer/FrameTime
|
|
|
|
func set_frame_label(frame : int) -> void:
|
|
frame_num.set_text(str(frame + 1))
|
|
|
|
func set_frame_dur(duration : float) -> void:
|
|
frame_dur.set_value(duration)
|
|
|
|
func _on_FrameProperties_popup_hide() -> void:
|
|
Global.dialog_open(false)
|
|
|
|
func _on_FrameProperties_confirmed():
|
|
var frame : int = int(frame_num.get_text()) - 1
|
|
var duration : float = frame_dur.get_value()
|
|
var new_duration = Global.current_project.frames[frame].duration
|
|
new_duration = duration
|
|
|
|
Global.current_project.undos += 1
|
|
Global.current_project.undo_redo.create_action("Change frame duration")
|
|
|
|
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)
|
|
|
|
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()
|