diff --git a/Main.tscn b/Main.tscn index 310d8834c..9789385c1 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=90 format=2] +[gd_scene load_steps=93 format=2] [ext_resource path="res://Themes & Styles/Dark Theme/Dark Theme.tres" type="Theme" id=1] [ext_resource path="res://Scripts/Main.gd" type="Script" id=2] @@ -60,13 +60,16 @@ [ext_resource path="res://Prefabs/BrushButton.tscn" type="PackedScene" id=58] [ext_resource path="res://Assets/Graphics/Canvas_split.png" type="Texture" id=59] [ext_resource path="res://Assets/Graphics/Canvas_unsplit.png" type="Texture" id=60] -[ext_resource path="res://Prefabs/Dialogs/ImportSprites.tscn" type="PackedScene" id=61] -[ext_resource path="res://Prefabs/Dialogs/ExportSprites.tscn" type="PackedScene" id=62] -[ext_resource path="res://Prefabs/Dialogs/PreferencesDialog.tscn" type="PackedScene" id=63] -[ext_resource path="res://Prefabs/Dialogs/AboutDialog.tscn" type="PackedScene" id=64] -[ext_resource path="res://Prefabs/EditPalettePopup.tscn" type="PackedScene" id=65] -[ext_resource path="res://Prefabs/NewPaletteDialog.tscn" type="PackedScene" id=66] -[ext_resource path="res://Prefabs/PaletteImportFileDialog.tscn" type="PackedScene" id=67] +[ext_resource path="res://Prefabs/Dialogs/CreateNewImage.tscn" type="PackedScene" id=61] +[ext_resource path="res://Prefabs/Dialogs/ImportSprites.tscn" type="PackedScene" id=62] +[ext_resource path="res://Prefabs/Dialogs/ExportSprites.tscn" type="PackedScene" id=63] +[ext_resource path="res://Prefabs/Dialogs/ScaleImage.tscn" type="PackedScene" id=64] +[ext_resource path="res://Prefabs/Dialogs/PreferencesDialog.tscn" type="PackedScene" id=65] +[ext_resource path="res://Prefabs/Dialogs/OutlineDialog.tscn" type="PackedScene" id=66] +[ext_resource path="res://Prefabs/Dialogs/AboutDialog.tscn" type="PackedScene" id=67] +[ext_resource path="res://Prefabs/EditPalettePopup.tscn" type="PackedScene" id=68] +[ext_resource path="res://Prefabs/NewPaletteDialog.tscn" type="PackedScene" id=69] +[ext_resource path="res://Prefabs/PaletteImportFileDialog.tscn" type="PackedScene" id=70] [sub_resource type="InputEventKey" id=1] scancode = 88 @@ -1333,6 +1336,7 @@ margin_right = 224.0 margin_bottom = 199.0 [node name="PaletteVBoxContainer" type="VBoxContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"] +editor/display_folded = true margin_top = 203.0 margin_right = 224.0 margin_bottom = 355.0 @@ -1517,7 +1521,6 @@ texture_hover = ExtResource( 56 ) texture_disabled = ExtResource( 57 ) [node name="OpacityCenter" type="CenterContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer"] -editor/display_folded = true margin_top = 38.0 margin_right = 224.0 margin_bottom = 55.0 @@ -1640,72 +1643,7 @@ toggle_mode = true texture_normal = ExtResource( 59 ) texture_pressed = ExtResource( 60 ) -[node name="CreateNewImage" type="ConfirmationDialog" parent="."] -editor/display_folded = true -margin_right = 200.0 -margin_bottom = 70.0 - -[node name="VBoxContainer" type="VBoxContainer" parent="CreateNewImage"] -margin_left = 8.0 -margin_top = 8.0 -margin_right = 192.0 -margin_bottom = 31.0 - -[node name="ImageSize" type="Label" parent="CreateNewImage/VBoxContainer"] -margin_right = 184.0 -margin_bottom = 15.0 -text = "Image Size" - -[node name="OptionsContainer" type="GridContainer" parent="CreateNewImage/VBoxContainer"] -margin_top = 19.0 -margin_right = 184.0 -margin_bottom = 76.0 -columns = 2 - -[node name="WidthLabel" type="Label" parent="CreateNewImage/VBoxContainer/OptionsContainer"] -margin_top = 1.0 -margin_right = 75.0 -margin_bottom = 16.0 -text = "Width:" - -[node name="WidthValue" type="SpinBox" parent="CreateNewImage/VBoxContainer/OptionsContainer"] -margin_left = 75.0 -margin_right = 139.0 -margin_bottom = 17.0 -min_value = 1.0 -max_value = 16384.0 -value = 64.0 -suffix = "px" - -[node name="Height" type="Label" parent="CreateNewImage/VBoxContainer/OptionsContainer"] -margin_top = 19.0 -margin_right = 75.0 -margin_bottom = 33.0 -text = "Height:" - -[node name="HeightValue" type="SpinBox" parent="CreateNewImage/VBoxContainer/OptionsContainer"] -margin_left = 75.0 -margin_top = 19.0 -margin_right = 139.0 -margin_bottom = 34.0 -min_value = 1.0 -max_value = 16384.0 -value = 64.0 -suffix = "px" - -[node name="FillColorLabel" type="Label" parent="CreateNewImage/VBoxContainer/OptionsContainer"] -margin_top = 41.0 -margin_right = 75.0 -margin_bottom = 53.0 -text = "Fill with color:" - -[node name="FillColor" type="ColorPickerButton" parent="CreateNewImage/VBoxContainer/OptionsContainer"] -margin_left = 75.0 -margin_top = 38.0 -margin_right = 139.0 -margin_bottom = 57.0 -rect_min_size = Vector2( 64, 20 ) -color = Color( 0, 0, 0, 0 ) +[node name="CreateNewImage" parent="." instance=ExtResource( 61 )] [node name="OpenSprite" type="FileDialog" parent="."] margin_right = 515.0 @@ -1734,136 +1672,17 @@ filters = PoolStringArray( "*.pxo ; Pixelorama Project" ) current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama" current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/" -[node name="ImportSprites" parent="." instance=ExtResource( 61 )] +[node name="ImportSprites" parent="." instance=ExtResource( 62 )] -[node name="ExportSprites" parent="." instance=ExtResource( 62 )] -visible = false +[node name="ExportSprites" parent="." instance=ExtResource( 63 )] -[node name="ScaleImage" type="ConfirmationDialog" parent="."] -editor/display_folded = true -margin_right = 200.0 -margin_bottom = 114.0 +[node name="ScaleImage" parent="." instance=ExtResource( 64 )] -[node name="VBoxContainer" type="VBoxContainer" parent="ScaleImage"] -margin_left = 8.0 -margin_top = 8.0 -margin_right = 192.0 -margin_bottom = 75.0 +[node name="PreferencesDialog" parent="." instance=ExtResource( 65 )] -[node name="ImageSize" type="Label" parent="ScaleImage/VBoxContainer"] -margin_right = 184.0 -margin_bottom = 15.0 -text = "Image Size" +[node name="OutlineDialog" parent="." instance=ExtResource( 66 )] -[node name="OptionsContainer" type="GridContainer" parent="ScaleImage/VBoxContainer"] -editor/display_folded = true -margin_top = 19.0 -margin_right = 184.0 -margin_bottom = 90.0 -columns = 2 - -[node name="WidthLabel" type="Label" parent="ScaleImage/VBoxContainer/OptionsContainer"] -margin_top = 5.0 -margin_right = 72.0 -margin_bottom = 20.0 -text = "Width:" - -[node name="WidthValue" type="SpinBox" parent="ScaleImage/VBoxContainer/OptionsContainer"] -margin_left = 72.0 -margin_right = 155.0 -margin_bottom = 25.0 -min_value = 1.0 -max_value = 16384.0 -value = 64.0 -suffix = "px" - -[node name="Height" type="Label" parent="ScaleImage/VBoxContainer/OptionsContainer"] -margin_top = 30.0 -margin_right = 72.0 -margin_bottom = 45.0 -text = "Height:" - -[node name="HeightValue" type="SpinBox" parent="ScaleImage/VBoxContainer/OptionsContainer"] -margin_left = 72.0 -margin_top = 25.0 -margin_right = 155.0 -margin_bottom = 50.0 -min_value = 1.0 -max_value = 16384.0 -value = 64.0 -suffix = "px" - -[node name="InterpolationLabel" type="Label" parent="ScaleImage/VBoxContainer/OptionsContainer"] -margin_top = 53.0 -margin_right = 72.0 -margin_bottom = 68.0 -text = "Interpolation:" - -[node name="InterpolationType" type="OptionButton" parent="ScaleImage/VBoxContainer/OptionsContainer"] -margin_left = 72.0 -margin_top = 50.0 -margin_right = 155.0 -margin_bottom = 71.0 -text = "Nearest" -items = [ "Nearest", null, false, 0, null, "Bilinear", null, false, 1, null, "Cubic", null, false, 2, null, "Trilinear", null, false, 3, null, "Lanczos", null, true, 4, null ] -selected = 0 - -[node name="PreferencesDialog" parent="." instance=ExtResource( 63 )] - -[node name="OutlineDialog" type="ConfirmationDialog" parent="."] -editor/display_folded = true -margin_right = 200.0 -margin_bottom = 70.0 - -[node name="OptionsContainer" type="GridContainer" parent="OutlineDialog"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -92.0 -margin_top = -27.0 -margin_right = 92.0 -margin_bottom = -4.0 -custom_constants/vseparation = 4 -custom_constants/hseparation = 4 -columns = 2 - -[node name="ThickLabel" type="Label" parent="OutlineDialog/OptionsContainer"] -margin_top = 1.0 -margin_right = 115.0 -margin_bottom = 16.0 -text = "Thickness:" - -[node name="ThickValue" type="SpinBox" parent="OutlineDialog/OptionsContainer"] -margin_left = 119.0 -margin_right = 183.0 -margin_bottom = 17.0 -min_value = 1.0 -max_value = 16384.0 -value = 1.0 -suffix = "px" - -[node name="OutlineColorLabel" type="Label" parent="OutlineDialog/OptionsContainer"] -margin_top = 23.0 -margin_right = 115.0 -margin_bottom = 38.0 -text = "Fill with color:" - -[node name="OutlineColor" type="ColorPickerButton" parent="OutlineDialog/OptionsContainer"] -margin_left = 119.0 -margin_top = 21.0 -margin_right = 183.0 -margin_bottom = 41.0 -rect_min_size = Vector2( 64, 20 ) -color = Color( 1, 0, 0, 1 ) - -[node name="DiagonalCheckBox" type="CheckBox" parent="OutlineDialog/OptionsContainer"] -margin_top = 45.0 -margin_right = 115.0 -margin_bottom = 61.0 -text = "Diagonal outlines" - -[node name="AboutDialog" parent="." instance=ExtResource( 64 )] +[node name="AboutDialog" parent="." instance=ExtResource( 67 )] [node name="QuitDialog" type="ConfirmationDialog" parent="."] margin_right = 200.0 @@ -1877,12 +1696,12 @@ margin_bottom = 60.0 window_title = "Error!" dialog_text = "This is an error message!" -[node name="EditPalettePopup" parent="." instance=ExtResource( 65 )] +[node name="EditPalettePopup" parent="." instance=ExtResource( 68 )] visible = false -[node name="NewPaletteDialog" parent="." instance=ExtResource( 66 )] +[node name="NewPaletteDialog" parent="." instance=ExtResource( 69 )] -[node name="PaletteImportFileDialog" parent="." instance=ExtResource( 67 )] +[node name="PaletteImportFileDialog" parent="." instance=ExtResource( 70 )] filters = PoolStringArray( "*.json ; JavaScript Object Notation", "*.gpl ; Gimp Palette Library" ) current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama" current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/" @@ -1958,7 +1777,6 @@ visible = false [connection signal="value_changed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/OpacityCenter/OpacityContainer/OpacitySlider" to="." method="_on_OpacitySlider_value_changed"] [connection signal="value_changed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer/OpacityCenter/OpacityContainer/OpacitySpinBox" to="." method="_on_OpacitySlider_value_changed"] [connection signal="toggled" from="SplitScreenButton" to="." method="_on_SplitScreenButton_toggled"] -[connection signal="confirmed" from="CreateNewImage" to="." method="_on_CreateNewImage_confirmed"] [connection signal="popup_hide" from="CreateNewImage" to="." method="_can_draw_true"] [connection signal="file_selected" from="OpenSprite" to="." method="_on_OpenSprite_file_selected"] [connection signal="popup_hide" from="OpenSprite" to="." method="_on_ImportSprites_popup_hide"] @@ -1966,10 +1784,8 @@ visible = false [connection signal="popup_hide" from="SaveSprite" to="." method="_can_draw_true"] [connection signal="popup_hide" from="ImportSprites" to="." method="_can_draw_true"] [connection signal="popup_hide" from="ExportSprites" to="." method="_can_draw_true"] -[connection signal="confirmed" from="ScaleImage" to="." method="_on_ScaleImage_confirmed"] [connection signal="popup_hide" from="ScaleImage" to="." method="_can_draw_true"] [connection signal="popup_hide" from="PreferencesDialog" to="." method="_can_draw_true"] -[connection signal="confirmed" from="OutlineDialog" to="." method="_on_OutlineDialog_confirmed"] [connection signal="popup_hide" from="OutlineDialog" to="." method="_can_draw_true"] [connection signal="popup_hide" from="AboutDialog" to="." method="_can_draw_true"] [connection signal="confirmed" from="QuitDialog" to="." method="_on_QuitDialog_confirmed"] diff --git a/Prefabs/Dialogs/CreateNewImage.tscn b/Prefabs/Dialogs/CreateNewImage.tscn new file mode 100644 index 000000000..ee211a4bb --- /dev/null +++ b/Prefabs/Dialogs/CreateNewImage.tscn @@ -0,0 +1,75 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scripts/Dialogs/CreateNewImage.gd" type="Script" id=1] + +[node name="CreateNewImage" type="ConfirmationDialog"] +margin_right = 200.0 +margin_bottom = 70.0 +script = ExtResource( 1 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +margin_left = 8.0 +margin_top = 8.0 +margin_right = 192.0 +margin_bottom = 34.0 + +[node name="ImageSize" type="Label" parent="VBoxContainer"] +margin_right = 184.0 +margin_bottom = 15.0 +text = "Image Size" + +[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"] +margin_top = 19.0 +margin_right = 184.0 +margin_bottom = 76.0 +custom_constants/vseparation = 4 +custom_constants/hseparation = 2 +columns = 2 + +[node name="WidthLabel" type="Label" parent="VBoxContainer/OptionsContainer"] +margin_top = 1.0 +margin_right = 75.0 +margin_bottom = 16.0 +text = "Width:" + +[node name="WidthValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"] +margin_left = 75.0 +margin_right = 139.0 +margin_bottom = 17.0 +mouse_default_cursor_shape = 2 +min_value = 1.0 +max_value = 16384.0 +value = 64.0 +suffix = "px" + +[node name="Height" type="Label" parent="VBoxContainer/OptionsContainer"] +margin_top = 19.0 +margin_right = 75.0 +margin_bottom = 33.0 +text = "Height:" + +[node name="HeightValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"] +margin_left = 75.0 +margin_top = 19.0 +margin_right = 139.0 +margin_bottom = 34.0 +mouse_default_cursor_shape = 2 +min_value = 1.0 +max_value = 16384.0 +value = 64.0 +suffix = "px" + +[node name="FillColorLabel" type="Label" parent="VBoxContainer/OptionsContainer"] +margin_top = 41.0 +margin_right = 75.0 +margin_bottom = 53.0 +text = "Fill with color:" + +[node name="FillColor" type="ColorPickerButton" parent="VBoxContainer/OptionsContainer"] +margin_left = 75.0 +margin_top = 38.0 +margin_right = 139.0 +margin_bottom = 57.0 +rect_min_size = Vector2( 64, 20 ) +color = Color( 0, 0, 0, 0 ) +[connection signal="confirmed" from="." to="." method="_on_CreateNewImage_confirmed"] diff --git a/Prefabs/Dialogs/ExportSprites.tscn b/Prefabs/Dialogs/ExportSprites.tscn index e621ad6dd..a8fa17127 100644 --- a/Prefabs/Dialogs/ExportSprites.tscn +++ b/Prefabs/Dialogs/ExportSprites.tscn @@ -41,6 +41,7 @@ text = "Resize:" margin_left = 50.0 margin_right = 124.0 margin_bottom = 40.0 +mouse_default_cursor_shape = 2 min_value = 10.0 max_value = 1000.0 step = 10.0 @@ -55,8 +56,9 @@ margin_bottom = 27.0 text = "Interpolation:" [node name="Interpolation" type="OptionButton" parent="Resize"] -margin_right = 41.0 -margin_bottom = 20.0 +margin_left = 219.0 +margin_right = 303.0 +margin_bottom = 40.0 text = "Item 0" items = [ "Nearest", null, false, 0, null, "Bilinear", null, false, 1, null, "Cubic", null, false, 2, null, "Trilinear", null, false, 3, null, "Lanczos", null, true, 4, null ] selected = 0 @@ -68,15 +70,16 @@ margin_top = 8.0 margin_right = 507.0 margin_bottom = 312.0 -[node name="Label" type="Label" parent="Spritesheet"] -margin_top = 145.0 -margin_right = 60.0 -margin_bottom = 159.0 -text = "Columns:" +[node name="ColumnsOrRows" type="OptionButton" parent="Spritesheet"] +margin_right = 97.0 +margin_bottom = 304.0 +text = "Columns" +items = [ "Columns", null, false, 0, null, "Rows", null, false, 1, null ] +selected = 0 -[node name="VerticalFrames" type="SpinBox" parent="Spritesheet"] -margin_left = 64.0 -margin_right = 138.0 +[node name="Frames" type="SpinBox" parent="Spritesheet"] +margin_left = 101.0 +margin_right = 175.0 margin_bottom = 304.0 mouse_default_cursor_shape = 2 min_value = 1.0 @@ -85,4 +88,5 @@ value = 1.0 [connection signal="item_selected" from="ExportOption" to="." method="_on_ExportOption_item_selected"] [connection signal="value_changed" from="Resize/ResizeValue" to="." method="_on_ResizeValue_value_changed"] [connection signal="item_selected" from="Resize/Interpolation" to="." method="_on_Interpolation_item_selected"] -[connection signal="value_changed" from="Spritesheet/VerticalFrames" to="." method="_on_VerticalFrames_value_changed"] +[connection signal="item_selected" from="Spritesheet/ColumnsOrRows" to="." method="_on_ColumnsOrRows_item_selected"] +[connection signal="value_changed" from="Spritesheet/Frames" to="." method="_on_Frames_value_changed"] diff --git a/Prefabs/Dialogs/OutlineDialog.tscn b/Prefabs/Dialogs/OutlineDialog.tscn new file mode 100644 index 000000000..b46847c59 --- /dev/null +++ b/Prefabs/Dialogs/OutlineDialog.tscn @@ -0,0 +1,59 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scripts/Dialogs/OutlineDialog.gd" type="Script" id=1] + +[node name="OutlineDialog" type="ConfirmationDialog"] +margin_right = 200.0 +margin_bottom = 70.0 +script = ExtResource( 1 ) + +[node name="OptionsContainer" type="GridContainer" parent="."] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -92.0 +margin_top = -27.0 +margin_right = 92.0 +margin_bottom = -1.0 +custom_constants/vseparation = 4 +custom_constants/hseparation = 4 +columns = 2 + +[node name="ThickLabel" type="Label" parent="OptionsContainer"] +margin_top = 5.0 +margin_right = 139.0 +margin_bottom = 19.0 +text = "Thickness:" + +[node name="ThickValue" type="SpinBox" parent="OptionsContainer"] +margin_left = 143.0 +margin_right = 217.0 +margin_bottom = 24.0 +mouse_default_cursor_shape = 2 +min_value = 1.0 +max_value = 16384.0 +value = 1.0 +suffix = "px" + +[node name="OutlineColorLabel" type="Label" parent="OptionsContainer"] +margin_top = 31.0 +margin_right = 139.0 +margin_bottom = 45.0 +text = "Fill with color:" + +[node name="OutlineColor" type="ColorPickerButton" parent="OptionsContainer"] +margin_left = 143.0 +margin_top = 28.0 +margin_right = 217.0 +margin_bottom = 48.0 +rect_min_size = Vector2( 64, 20 ) +color = Color( 1, 0, 0, 1 ) + +[node name="DiagonalCheckBox" type="CheckBox" parent="OptionsContainer"] +margin_top = 52.0 +margin_right = 139.0 +margin_bottom = 76.0 +mouse_default_cursor_shape = 2 +text = "Diagonal outlines" +[connection signal="confirmed" from="." to="." method="_on_OutlineDialog_confirmed"] diff --git a/Prefabs/Dialogs/ScaleImage.tscn b/Prefabs/Dialogs/ScaleImage.tscn new file mode 100644 index 000000000..e4f9a19c3 --- /dev/null +++ b/Prefabs/Dialogs/ScaleImage.tscn @@ -0,0 +1,76 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scripts/Dialogs/ScaleImage.gd" type="Script" id=1] + +[node name="ScaleImage" type="ConfirmationDialog"] +margin_right = 200.0 +margin_bottom = 114.0 +script = ExtResource( 1 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +margin_left = 8.0 +margin_top = 8.0 +margin_right = 192.0 +margin_bottom = 78.0 + +[node name="ImageSize" type="Label" parent="VBoxContainer"] +margin_right = 184.0 +margin_bottom = 15.0 +text = "Image Size" + +[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"] +margin_top = 19.0 +margin_right = 184.0 +margin_bottom = 90.0 +custom_constants/vseparation = 4 +custom_constants/hseparation = 2 +columns = 2 + +[node name="WidthLabel" type="Label" parent="VBoxContainer/OptionsContainer"] +margin_top = 5.0 +margin_right = 72.0 +margin_bottom = 20.0 +text = "Width:" + +[node name="WidthValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"] +margin_left = 72.0 +margin_right = 155.0 +margin_bottom = 25.0 +mouse_default_cursor_shape = 2 +min_value = 1.0 +max_value = 16384.0 +value = 64.0 +suffix = "px" + +[node name="Height" type="Label" parent="VBoxContainer/OptionsContainer"] +margin_top = 30.0 +margin_right = 72.0 +margin_bottom = 45.0 +text = "Height:" + +[node name="HeightValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"] +margin_left = 72.0 +margin_top = 25.0 +margin_right = 155.0 +margin_bottom = 50.0 +mouse_default_cursor_shape = 2 +min_value = 1.0 +max_value = 16384.0 +value = 64.0 +suffix = "px" + +[node name="InterpolationLabel" type="Label" parent="VBoxContainer/OptionsContainer"] +margin_top = 53.0 +margin_right = 72.0 +margin_bottom = 68.0 +text = "Interpolation:" + +[node name="InterpolationType" type="OptionButton" parent="VBoxContainer/OptionsContainer"] +margin_left = 72.0 +margin_top = 50.0 +margin_right = 155.0 +margin_bottom = 71.0 +text = "Nearest" +items = [ "Nearest", null, false, 0, null, "Bilinear", null, false, 1, null, "Cubic", null, false, 2, null, "Trilinear", null, false, 3, null, "Lanczos", null, true, 4, null ] +selected = 0 +[connection signal="confirmed" from="." to="." method="_on_ScaleImage_confirmed"] diff --git a/Scripts/Dialogs/CreateNewImage.gd b/Scripts/Dialogs/CreateNewImage.gd new file mode 100644 index 000000000..53dcc3d4f --- /dev/null +++ b/Scripts/Dialogs/CreateNewImage.gd @@ -0,0 +1,18 @@ +extends ConfirmationDialog + +func _on_CreateNewImage_confirmed() -> void: + var width : int = $VBoxContainer/OptionsContainer/WidthValue.value + var height : int = $VBoxContainer/OptionsContainer/HeightValue.value + var fill_color : Color = $VBoxContainer/OptionsContainer/FillColor.color + Global.control.clear_canvases() + Global.canvas = load("res://Prefabs/Canvas.tscn").instance() + Global.canvas.size = Vector2(width, height).floor() + + Global.canvases.append(Global.canvas) + Global.canvas_parent.add_child(Global.canvas) + Global.current_frame = 0 + if fill_color.a > 0: + Global.canvas.layers[0][0].fill(fill_color) + Global.canvas.layers[0][0].lock() + Global.canvas.update_texture(0) + Global.undo_redo.clear_history(false) diff --git a/Scripts/Dialogs/ExportSprites.gd b/Scripts/Dialogs/ExportSprites.gd index 136bceca8..067ba1044 100644 --- a/Scripts/Dialogs/ExportSprites.gd +++ b/Scripts/Dialogs/ExportSprites.gd @@ -4,6 +4,7 @@ var current_export_path := "" var export_option := 0 var resize := 100 var interpolation = Image.INTERPOLATE_NEAREST +var per_rows := false var spritesheet_rows = 1 var spritesheet_columns = 1 @@ -31,12 +32,19 @@ func _on_ResizeValue_value_changed(value) -> void: func _on_Interpolation_item_selected(ID : int) -> void: interpolation = ID -func _on_VerticalFrames_value_changed(value) -> void: - value = min(value, Global.canvases.size()) - spritesheet_columns = value +func _on_ColumnsOrRows_item_selected(ID) -> void: + per_rows = bool(ID) - var vertical_frames : SpinBox = Global.find_node_by_name(self, "VerticalFrames") - vertical_frames.value = spritesheet_columns +func _on_Frames_value_changed(value): + value = min(value, Global.canvases.size()) + var frames_spinbox : SpinBox = Global.find_node_by_name(self, "Frames") + + if per_rows: + spritesheet_rows = value + frames_spinbox.value = spritesheet_rows + else: + spritesheet_columns = value + frames_spinbox.value = spritesheet_columns func _on_ExportSprites_file_selected(path : String) -> void: current_export_path = path @@ -83,7 +91,10 @@ func save_sprite(canvas : Canvas, path : String) -> void: OS.alert("Can't save file") func save_spritesheet() -> void: - spritesheet_rows = ceil(Global.canvases.size() / spritesheet_columns) + if per_rows: + spritesheet_columns = ceil(Global.canvases.size() / spritesheet_rows) + else: + spritesheet_rows = ceil(Global.canvases.size() / spritesheet_columns) var width = Global.canvas.size.x * spritesheet_rows var height = Global.canvas.size.y * spritesheet_columns @@ -94,14 +105,25 @@ func save_spritesheet() -> void: var hh := 0 var vv := 0 for canvas in Global.canvases: - if hh < spritesheet_rows: - dst.x = canvas.size.x * hh - hh += 1 + if per_rows: + if vv < spritesheet_columns: + dst.y = canvas.size.y * vv + vv += 1 + else: + hh += 1 + dst.y = 0 + vv = 1 + dst.x = canvas.size.x * hh + else: - vv += 1 - dst.x = 0 - hh = 1 - dst.y = canvas.size.y * vv + if hh < spritesheet_rows: + dst.x = canvas.size.x * hh + hh += 1 + else: + vv += 1 + dst.x = 0 + hh = 1 + dst.y = canvas.size.y * vv for layer in canvas.layers: var img : Image = layer[0] @@ -121,3 +143,4 @@ func save_spritesheet() -> void: var err = whole_image.save_png(current_export_path) if err != OK: OS.alert("Can't save file") + diff --git a/Scripts/Dialogs/OutlineDialog.gd b/Scripts/Dialogs/OutlineDialog.gd new file mode 100644 index 000000000..41c263ea6 --- /dev/null +++ b/Scripts/Dialogs/OutlineDialog.gd @@ -0,0 +1,74 @@ +extends ConfirmationDialog + +func _on_OutlineDialog_confirmed() -> void: + var outline_color : Color = $OptionsContainer/OutlineColor.color + var thickness : int = $OptionsContainer/ThickValue.value + var diagonal : bool = $OptionsContainer/DiagonalCheckBox.pressed + + var image : Image = Global.canvas.layers[Global.canvas.current_layer_index][0] + if image.is_invisible(): + return + var new_image := Image.new() + new_image.copy_from(image) + new_image.lock() + + Global.canvas.handle_undo("Draw") + for xx in image.get_size().x: + for yy in image.get_size().y: + var pos = Vector2(xx, yy) + var current_pixel := image.get_pixelv(pos) + if current_pixel.a == 0: + continue + + for i in range(1, thickness + 1): + var new_pos : Vector2 = pos + Vector2.LEFT * i # Left + if new_pos.x >= 0: + var new_pixel = image.get_pixelv(new_pos) + if new_pixel.a == 0: + new_image.set_pixelv(new_pos, outline_color) + + new_pos = pos + Vector2.RIGHT * i # Right + if new_pos.x < Global.canvas.size.x: + var new_pixel = image.get_pixelv(new_pos) + if new_pixel.a == 0: + new_image.set_pixelv(new_pos, outline_color) + + new_pos = pos + Vector2.UP * i # Up + if new_pos.y >= 0: + var new_pixel = image.get_pixelv(new_pos) + if new_pixel.a == 0: + new_image.set_pixelv(new_pos, outline_color) + + new_pos = pos + Vector2.DOWN * i # Down + if new_pos.y < Global.canvas.size.y: + var new_pixel = image.get_pixelv(new_pos) + if new_pixel.a == 0: + new_image.set_pixelv(new_pos, outline_color) + + if diagonal: + new_pos = pos + (Vector2.LEFT + Vector2.UP) * i # Top left + if new_pos.x >= 0 && new_pos.y >= 0: + var new_pixel = image.get_pixelv(new_pos) + if new_pixel.a == 0: + new_image.set_pixelv(new_pos, outline_color) + + new_pos = pos + (Vector2.LEFT + Vector2.DOWN) * i # Bottom left + if new_pos.x >= 0 && new_pos.y < Global.canvas.size.y: + var new_pixel = image.get_pixelv(new_pos) + if new_pixel.a == 0: + new_image.set_pixelv(new_pos, outline_color) + + new_pos = pos + (Vector2.RIGHT + Vector2.UP) * i # Top right + if new_pos.x < Global.canvas.size.x && new_pos.y >= 0: + var new_pixel = image.get_pixelv(new_pos) + if new_pixel.a == 0: + new_image.set_pixelv(new_pos, outline_color) + + new_pos = pos + (Vector2.RIGHT + Vector2.DOWN) * i # Bottom right + if new_pos.x < Global.canvas.size.x && new_pos.y < Global.canvas.size.y: + var new_pixel = image.get_pixelv(new_pos) + if new_pixel.a == 0: + new_image.set_pixelv(new_pos, outline_color) + + image.copy_from(new_image) + Global.canvas.handle_redo("Draw") diff --git a/Scripts/Dialogs/ScaleImage.gd b/Scripts/Dialogs/ScaleImage.gd new file mode 100644 index 000000000..2caf86122 --- /dev/null +++ b/Scripts/Dialogs/ScaleImage.gd @@ -0,0 +1,20 @@ +extends ConfirmationDialog + +func _on_ScaleImage_confirmed() -> void: + var width : int = $VBoxContainer/OptionsContainer/WidthValue.value + var height : int = $VBoxContainer/OptionsContainer/HeightValue.value + var interpolation : int = $VBoxContainer/OptionsContainer/InterpolationType.selected + Global.undos += 1 + Global.undo_redo.create_action("Scale") + Global.undo_redo.add_do_property(Global.canvas, "size", Vector2(width, height).floor()) + + for i in range(Global.canvas.layers.size() - 1, -1, -1): + var sprite : Image = Global.canvas.layers[i][1].get_data() + sprite.resize(width, height, interpolation) + Global.undo_redo.add_do_property(Global.canvas.layers[i][0], "data", sprite.data) + Global.undo_redo.add_undo_property(Global.canvas.layers[i][0], "data", Global.canvas.layers[i][0].data) + + Global.undo_redo.add_undo_property(Global.canvas, "size", Global.canvas.size) + Global.undo_redo.add_undo_method(Global, "undo", [Global.canvas]) + Global.undo_redo.add_do_method(Global, "redo", [Global.canvas]) + Global.undo_redo.commit_action() diff --git a/Scripts/Main.gd b/Scripts/Main.gd index 22aced27a..ae1eb1dce 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -340,23 +340,6 @@ func help_menu_id_pressed(id : int) -> void: $AboutDialog.popup_centered() Global.can_draw = false -func _on_CreateNewImage_confirmed() -> void: - var width : int = $CreateNewImage/VBoxContainer/OptionsContainer/WidthValue.value - var height : int = $CreateNewImage/VBoxContainer/OptionsContainer/HeightValue.value - var fill_color : Color = $CreateNewImage/VBoxContainer/OptionsContainer/FillColor.color - clear_canvases() - Global.canvas = load("res://Prefabs/Canvas.tscn").instance() - Global.canvas.size = Vector2(width, height).floor() - - Global.canvases.append(Global.canvas) - Global.canvas_parent.add_child(Global.canvas) - Global.current_frame = 0 - if fill_color.a > 0: - Global.canvas.layers[0][0].fill(fill_color) - Global.canvas.layers[0][0].lock() - Global.canvas.update_texture(0) - Global.undo_redo.clear_history(false) - func _on_OpenSprite_file_selected(path : String) -> void: var file := File.new() var err := file.open(path, File.READ) @@ -521,99 +504,6 @@ func clear_canvases() -> void: $ExportSprites.current_export_path = "" file_menu.set_item_text(5, "Export PNG...") - -func _on_ScaleImage_confirmed() -> void: - var width : int = $ScaleImage/VBoxContainer/OptionsContainer/WidthValue.value - var height : int = $ScaleImage/VBoxContainer/OptionsContainer/HeightValue.value - var interpolation : int = $ScaleImage/VBoxContainer/OptionsContainer/InterpolationType.selected - Global.undos += 1 - Global.undo_redo.create_action("Scale") - Global.undo_redo.add_do_property(Global.canvas, "size", Vector2(width, height).floor()) - - for i in range(Global.canvas.layers.size() - 1, -1, -1): - var sprite : Image = Global.canvas.layers[i][1].get_data() - sprite.resize(width, height, interpolation) - Global.undo_redo.add_do_property(Global.canvas.layers[i][0], "data", sprite.data) - Global.undo_redo.add_undo_property(Global.canvas.layers[i][0], "data", Global.canvas.layers[i][0].data) - - Global.undo_redo.add_undo_property(Global.canvas, "size", Global.canvas.size) - Global.undo_redo.add_undo_method(Global, "undo", [Global.canvas]) - Global.undo_redo.add_do_method(Global, "redo", [Global.canvas]) - Global.undo_redo.commit_action() - -func _on_OutlineDialog_confirmed() -> void: - var outline_color : Color = $OutlineDialog/OptionsContainer/OutlineColor.color - var thickness : int = $OutlineDialog/OptionsContainer/ThickValue.value - var diagonal : bool = $OutlineDialog/OptionsContainer/DiagonalCheckBox.pressed - - var image : Image = Global.canvas.layers[Global.canvas.current_layer_index][0] - if image.is_invisible(): - return - var new_image := Image.new() - new_image.copy_from(image) - new_image.lock() - - Global.canvas.handle_undo("Draw") - for xx in image.get_size().x: - for yy in image.get_size().y: - var pos = Vector2(xx, yy) - var current_pixel := image.get_pixelv(pos) - if current_pixel.a == 0: - continue - - for i in range(1, thickness + 1): - var new_pos : Vector2 = pos + Vector2.LEFT * i # Left - if new_pos.x >= 0: - var new_pixel = image.get_pixelv(new_pos) - if new_pixel.a == 0: - new_image.set_pixelv(new_pos, outline_color) - - new_pos = pos + Vector2.RIGHT * i # Right - if new_pos.x < Global.canvas.size.x: - var new_pixel = image.get_pixelv(new_pos) - if new_pixel.a == 0: - new_image.set_pixelv(new_pos, outline_color) - - new_pos = pos + Vector2.UP * i # Up - if new_pos.y >= 0: - var new_pixel = image.get_pixelv(new_pos) - if new_pixel.a == 0: - new_image.set_pixelv(new_pos, outline_color) - - new_pos = pos + Vector2.DOWN * i # Down - if new_pos.y < Global.canvas.size.y: - var new_pixel = image.get_pixelv(new_pos) - if new_pixel.a == 0: - new_image.set_pixelv(new_pos, outline_color) - - if diagonal: - new_pos = pos + (Vector2.LEFT + Vector2.UP) * i # Top left - if new_pos.x >= 0 && new_pos.y >= 0: - var new_pixel = image.get_pixelv(new_pos) - if new_pixel.a == 0: - new_image.set_pixelv(new_pos, outline_color) - - new_pos = pos + (Vector2.LEFT + Vector2.DOWN) * i # Bottom left - if new_pos.x >= 0 && new_pos.y < Global.canvas.size.y: - var new_pixel = image.get_pixelv(new_pos) - if new_pixel.a == 0: - new_image.set_pixelv(new_pos, outline_color) - - new_pos = pos + (Vector2.RIGHT + Vector2.UP) * i # Top right - if new_pos.x < Global.canvas.size.x && new_pos.y >= 0: - var new_pixel = image.get_pixelv(new_pos) - if new_pixel.a == 0: - new_image.set_pixelv(new_pos, outline_color) - - new_pos = pos + (Vector2.RIGHT + Vector2.DOWN) * i # Bottom right - if new_pos.x < Global.canvas.size.x && new_pos.y < Global.canvas.size.y: - var new_pixel = image.get_pixelv(new_pos) - if new_pixel.a == 0: - new_image.set_pixelv(new_pos, outline_color) - - image.copy_from(new_image) - Global.canvas.handle_redo("Draw") - func _on_ImportSprites_popup_hide() -> void: if !opensprite_file_selected: Global.can_draw = true @@ -1022,6 +912,7 @@ func _on_OpacitySlider_value_changed(value) -> void: Global.canvas.layers[Global.canvas.current_layer_index][4] = value / 100 Global.layer_opacity_slider.value = value Global.layer_opacity_spinbox.value = value + Global.canvas.update() func _on_QuitDialog_confirmed() -> void: # Darken the UI to denote that the application is currently exiting