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

Remove empty project when importing an image

This should no longer keep empty canvases when importing images
This commit is contained in:
Manolis Papadeas 2022-03-21 23:33:45 +02:00
parent 4cf9c57e84
commit 9648b48a96
2 changed files with 12 additions and 15 deletions

View file

@ -394,7 +394,7 @@ func open_image_as_new_tab(path: String, image: Image) -> void:
frame.cels.append(Cel.new(image, 1))
project.frames.append(frame)
set_new_tab(project, path)
set_new_imported_tab(project, path)
func open_image_as_spritesheet_tab(path: String, image: Image, horiz: int, vert: int) -> void:
@ -424,7 +424,7 @@ func open_image_as_spritesheet_tab(path: String, image: Image, horiz: int, vert:
project.frames.append(frame)
set_new_tab(project, path)
set_new_imported_tab(project, path)
func open_image_as_spritesheet_layer(
@ -595,7 +595,9 @@ func open_image_as_new_layer(image: Image, file_name: String, frame_index := 0)
project.undo_redo.commit_action()
func set_new_tab(project: Project, path: String) -> void:
func set_new_imported_tab(project: Project, path: String) -> void:
var prev_project_empty: bool = Global.current_project.is_empty()
var prev_project_pos: int = Global.current_project_index
Global.tabs.current_tab = Global.tabs.get_tab_count() - 1
Global.canvas.camera_zoom()
@ -615,6 +617,9 @@ func set_new_tab(project: Project, path: String) -> void:
Export.directory_path = directory_path
Export.file_name = file_name
if prev_project_empty:
Global.tabs.delete_tab(prev_project_pos)
func update_autosave() -> void:
autosave_timer.stop()

View file

@ -135,17 +135,13 @@ max_value = 16384.0
value = 64.0
suffix = "px"
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/SizeContainer" groups=[
"UIButtons",
]]
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/SizeContainer" groups=["UIButtons"]]
margin_left = 350.0
margin_right = 359.0
margin_bottom = 52.0
texture = ExtResource( 6 )
[node name="AspectRatioButton" type="TextureButton" parent="VBoxContainer/SizeContainer/TextureRect" groups=[
"UIButtons",
]]
[node name="AspectRatioButton" type="TextureButton" parent="VBoxContainer/SizeContainer/TextureRect" groups=["UIButtons"]]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
@ -168,9 +164,7 @@ margin_top = 134.0
margin_right = 359.0
margin_bottom = 154.0
[node name="PortraitButton" type="Button" parent="VBoxContainer/SizeButtonsContainer" groups=[
"UIButtons",
]]
[node name="PortraitButton" type="Button" parent="VBoxContainer/SizeButtonsContainer" groups=["UIButtons"]]
margin_right = 20.0
margin_bottom = 20.0
rect_min_size = Vector2( 20, 0 )
@ -193,9 +187,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="LandscapeButton" type="Button" parent="VBoxContainer/SizeButtonsContainer" groups=[
"UIButtons",
]]
[node name="LandscapeButton" type="Button" parent="VBoxContainer/SizeButtonsContainer" groups=["UIButtons"]]
margin_left = 24.0
margin_right = 44.0
margin_bottom = 20.0