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

Fixed issue where new images had the size of the previous project

This commit is contained in:
OverloadedOrama 2020-06-09 18:44:08 +03:00
parent 66feec8f21
commit 8118381b0b
4 changed files with 7 additions and 4 deletions

View file

@ -243,7 +243,7 @@ func camera_zoom() -> void:
Global.transparent_checker._ready() # To update the rect size
func new_empty_frame(first_time := false, single_layer := false) -> Frame:
func new_empty_frame(first_time := false, single_layer := false, size := Global.current_project.size) -> Frame:
var frame := Frame.new()
for l in Global.current_project.layers: # Create as many cels as there are layers
# The sprite itself
@ -255,7 +255,7 @@ func new_empty_frame(first_time := false, single_layer := false) -> Frame:
Global.current_project.size.y = Global.config_cache.get_value("preferences", "default_image_height")
if Global.config_cache.has_section_key("preferences", "default_fill_color"):
fill_color = Global.config_cache.get_value("preferences", "default_fill_color")
sprite.create(Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8)
sprite.create(size.x, size.y, false, Image.FORMAT_RGBA8)
sprite.fill(fill_color)
sprite.lock()
frame.cels.append(Cel.new(sprite, 1))

View file

@ -1,5 +1,7 @@
class_name Cel extends Reference
# A class for cel properties
# A class for cel properties.
# The term "cel" comes from "celluloid" (https://en.wikipedia.org/wiki/Cel).
# The "image" variable is where the image data of each cel are.
var image : Image setget image_changed

View file

@ -5,5 +5,6 @@ class_name Frame extends Reference
var cels : Array # An array of Cels
func _init(_cels := []) -> void:
cels = _cels

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(false, true)
var frame : Frame = Global.canvas.new_empty_frame(false, true, Vector2(width, height))
var new_project := Project.new([frame])
new_project.layers.append(Layer.new())
Global.projects.append(new_project)