1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Fix crash when importing an image file as a new frame

This commit is contained in:
Manolis Papadeas 2020-12-09 18:07:12 +02:00
parent b7f7643317
commit de6f78b058
3 changed files with 9 additions and 5 deletions

View file

@ -555,11 +555,11 @@ func update_recent_projects_submenu() -> void:
recent_projects_submenu.add_item(project.get_file())
func use_osx_shortcuts() -> void:
var inputmap := InputMap
var inputmap := InputMap
for action in inputmap.get_actions():
var event : InputEvent = inputmap.get_action_list(action)[0]
var event : InputEvent = inputmap.get_action_list(action)[0]
if event.control:
event.control = false
event.command = true

View file

@ -394,6 +394,7 @@ func open_image_as_new_frame(image : Image, layer_index := 0) -> void:
var project = Global.current_project
image.crop(project.size.x, project.size.y)
var new_frames : Array = project.frames.duplicate()
var frame_duration : Array = Global.current_project.frame_duration.duplicate()
var frame := Frame.new()
for i in project.layers.size():
@ -408,6 +409,7 @@ func open_image_as_new_frame(image : Image, layer_index := 0) -> void:
frame.cels.append(Cel.new(empty_image, 1))
new_frames.append(frame)
frame_duration.insert(project.current_frame + 1, 1)
project.undos += 1
project.undo_redo.create_action("Add Frame")
@ -417,10 +419,12 @@ func open_image_as_new_frame(image : Image, layer_index := 0) -> void:
project.undo_redo.add_do_property(project, "frames", new_frames)
project.undo_redo.add_do_property(project, "current_frame", new_frames.size() - 1)
project.undo_redo.add_do_property(project, "current_layer", layer_index)
Global.current_project.undo_redo.add_do_property(Global.current_project, "frame_duration", frame_duration) # Add an 1 in the list of frame_duration
project.undo_redo.add_undo_property(project, "frames", project.frames)
project.undo_redo.add_undo_property(project, "current_frame", project.current_frame)
project.undo_redo.add_undo_property(project, "current_layer", project.current_layer)
Global.current_project.undo_redo.add_undo_property(Global.current_project, "frame_duration", Global.current_project.frame_duration)
project.undo_redo.commit_action()

View file

@ -50,7 +50,7 @@ func add_frame() -> void:
Global.current_project.undo_redo.add_do_property(Global.current_project, "frames", new_frames)
Global.current_project.undo_redo.add_do_property(Global.current_project, "current_frame", Global.current_project.current_frame + 1)
Global.current_project.undo_redo.add_do_property(Global.current_project, "layers", new_layers)
Global.current_project.undo_redo.add_do_property(Global.current_project, "frame_duration", frame_duration) #Add a 1 in the list of frame_duration
Global.current_project.undo_redo.add_do_property(Global.current_project, "frame_duration", frame_duration) # Add an 1 in the list of frame_duration
Global.current_project.undo_redo.add_undo_property(Global.current_project, "frames", Global.current_project.frames)
Global.current_project.undo_redo.add_undo_property(Global.current_project, "current_frame", Global.current_project.current_frame )