1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Fixed issue where the wrong amount of cels were being created

The new image's frames had as many cels as the previously selected project
This commit is contained in:
OverloadedOrama 2020-06-05 18:19:05 +03:00
parent d37b07db5d
commit 7a61f1ea4a
3 changed files with 7 additions and 3 deletions

View file

@ -246,9 +246,9 @@ func camera_zoom() -> void:
Global.transparent_checker._ready() # To update the rect size
func new_empty_frame(first_time := false) -> Frame:
func new_empty_frame(first_time := false, single_layer := false) -> Frame:
var frame := Frame.new()
for l in Global.current_project.layers:
for l in Global.current_project.layers: # Create as many cels as there are layers
# The sprite itself
var sprite := Image.new()
if first_time:
@ -263,6 +263,9 @@ func new_empty_frame(first_time := false) -> Frame:
sprite.lock()
frame.cels.append(Cel.new(sprite, 1))
if single_layer:
break
return frame

View file

@ -117,6 +117,7 @@ func change_project() -> void:
Global.create_brush_button(brush)
Global.canvas.update()
Global.transparent_checker._ready()
func frames_changed(value : Array) -> void:

View file

@ -74,7 +74,7 @@ func _on_CreateNewImage_confirmed() -> void:
var height : int = height_value.value
var fill_color : Color = fill_color_node.color
var frame : Frame = Global.canvas.new_empty_frame()
var frame : Frame = Global.canvas.new_empty_frame(false, true)
Global.projects.append(Project.new([frame]))
Global.tabs.current_tab = Global.tabs.get_tab_count() - 1
Global.current_project.size = Vector2(width, height).floor()