mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
Fixed issue where new images had the size of the previous project
This commit is contained in:
parent
66feec8f21
commit
8118381b0b
|
@ -243,7 +243,7 @@ func camera_zoom() -> void:
|
||||||
Global.transparent_checker._ready() # To update the rect size
|
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()
|
var frame := Frame.new()
|
||||||
for l in Global.current_project.layers: # Create as many cels as there are layers
|
for l in Global.current_project.layers: # Create as many cels as there are layers
|
||||||
# The sprite itself
|
# 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")
|
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"):
|
if Global.config_cache.has_section_key("preferences", "default_fill_color"):
|
||||||
fill_color = Global.config_cache.get_value("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.fill(fill_color)
|
||||||
sprite.lock()
|
sprite.lock()
|
||||||
frame.cels.append(Cel.new(sprite, 1))
|
frame.cels.append(Cel.new(sprite, 1))
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
class_name Cel extends Reference
|
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
|
var image : Image setget image_changed
|
||||||
|
|
|
@ -5,5 +5,6 @@ class_name Frame extends Reference
|
||||||
|
|
||||||
var cels : Array # An array of Cels
|
var cels : Array # An array of Cels
|
||||||
|
|
||||||
|
|
||||||
func _init(_cels := []) -> void:
|
func _init(_cels := []) -> void:
|
||||||
cels = _cels
|
cels = _cels
|
||||||
|
|
|
@ -74,7 +74,7 @@ func _on_CreateNewImage_confirmed() -> void:
|
||||||
var height : int = height_value.value
|
var height : int = height_value.value
|
||||||
var fill_color : Color = fill_color_node.color
|
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])
|
var new_project := Project.new([frame])
|
||||||
new_project.layers.append(Layer.new())
|
new_project.layers.append(Layer.new())
|
||||||
Global.projects.append(new_project)
|
Global.projects.append(new_project)
|
||||||
|
|
Loading…
Reference in a new issue