mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Choose how many rows or columns when exporting spritesheet
Also made CreateNewImage.tscn, ScaleImage.tscn and OutlineDialogn.tscn scenes of their own, with their respective scripts.
This commit is contained in:
parent
1a6f6c1cc9
commit
3ae679fe00
228
Main.tscn
228
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://Themes & Styles/Dark Theme/Dark Theme.tres" type="Theme" id=1]
|
||||||
[ext_resource path="res://Scripts/Main.gd" type="Script" id=2]
|
[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://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_split.png" type="Texture" id=59]
|
||||||
[ext_resource path="res://Assets/Graphics/Canvas_unsplit.png" type="Texture" id=60]
|
[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/CreateNewImage.tscn" type="PackedScene" id=61]
|
||||||
[ext_resource path="res://Prefabs/Dialogs/ExportSprites.tscn" type="PackedScene" id=62]
|
[ext_resource path="res://Prefabs/Dialogs/ImportSprites.tscn" type="PackedScene" id=62]
|
||||||
[ext_resource path="res://Prefabs/Dialogs/PreferencesDialog.tscn" type="PackedScene" id=63]
|
[ext_resource path="res://Prefabs/Dialogs/ExportSprites.tscn" type="PackedScene" id=63]
|
||||||
[ext_resource path="res://Prefabs/Dialogs/AboutDialog.tscn" type="PackedScene" id=64]
|
[ext_resource path="res://Prefabs/Dialogs/ScaleImage.tscn" type="PackedScene" id=64]
|
||||||
[ext_resource path="res://Prefabs/EditPalettePopup.tscn" type="PackedScene" id=65]
|
[ext_resource path="res://Prefabs/Dialogs/PreferencesDialog.tscn" type="PackedScene" id=65]
|
||||||
[ext_resource path="res://Prefabs/NewPaletteDialog.tscn" type="PackedScene" id=66]
|
[ext_resource path="res://Prefabs/Dialogs/OutlineDialog.tscn" type="PackedScene" id=66]
|
||||||
[ext_resource path="res://Prefabs/PaletteImportFileDialog.tscn" type="PackedScene" id=67]
|
[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]
|
[sub_resource type="InputEventKey" id=1]
|
||||||
scancode = 88
|
scancode = 88
|
||||||
|
@ -1333,6 +1336,7 @@ margin_right = 224.0
|
||||||
margin_bottom = 199.0
|
margin_bottom = 199.0
|
||||||
|
|
||||||
[node name="PaletteVBoxContainer" type="VBoxContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"]
|
[node name="PaletteVBoxContainer" type="VBoxContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_top = 203.0
|
margin_top = 203.0
|
||||||
margin_right = 224.0
|
margin_right = 224.0
|
||||||
margin_bottom = 355.0
|
margin_bottom = 355.0
|
||||||
|
@ -1517,7 +1521,6 @@ texture_hover = ExtResource( 56 )
|
||||||
texture_disabled = ExtResource( 57 )
|
texture_disabled = ExtResource( 57 )
|
||||||
|
|
||||||
[node name="OpacityCenter" type="CenterContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer"]
|
[node name="OpacityCenter" type="CenterContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/LayerVBoxContainer"]
|
||||||
editor/display_folded = true
|
|
||||||
margin_top = 38.0
|
margin_top = 38.0
|
||||||
margin_right = 224.0
|
margin_right = 224.0
|
||||||
margin_bottom = 55.0
|
margin_bottom = 55.0
|
||||||
|
@ -1640,72 +1643,7 @@ toggle_mode = true
|
||||||
texture_normal = ExtResource( 59 )
|
texture_normal = ExtResource( 59 )
|
||||||
texture_pressed = ExtResource( 60 )
|
texture_pressed = ExtResource( 60 )
|
||||||
|
|
||||||
[node name="CreateNewImage" type="ConfirmationDialog" parent="."]
|
[node name="CreateNewImage" parent="." instance=ExtResource( 61 )]
|
||||||
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="OpenSprite" type="FileDialog" parent="."]
|
[node name="OpenSprite" type="FileDialog" parent="."]
|
||||||
margin_right = 515.0
|
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_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
|
||||||
current_path = "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 )]
|
[node name="ExportSprites" parent="." instance=ExtResource( 63 )]
|
||||||
visible = false
|
|
||||||
|
|
||||||
[node name="ScaleImage" type="ConfirmationDialog" parent="."]
|
[node name="ScaleImage" parent="." instance=ExtResource( 64 )]
|
||||||
editor/display_folded = true
|
|
||||||
margin_right = 200.0
|
|
||||||
margin_bottom = 114.0
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScaleImage"]
|
[node name="PreferencesDialog" parent="." instance=ExtResource( 65 )]
|
||||||
margin_left = 8.0
|
|
||||||
margin_top = 8.0
|
|
||||||
margin_right = 192.0
|
|
||||||
margin_bottom = 75.0
|
|
||||||
|
|
||||||
[node name="ImageSize" type="Label" parent="ScaleImage/VBoxContainer"]
|
[node name="OutlineDialog" parent="." instance=ExtResource( 66 )]
|
||||||
margin_right = 184.0
|
|
||||||
margin_bottom = 15.0
|
|
||||||
text = "Image Size"
|
|
||||||
|
|
||||||
[node name="OptionsContainer" type="GridContainer" parent="ScaleImage/VBoxContainer"]
|
[node name="AboutDialog" parent="." instance=ExtResource( 67 )]
|
||||||
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="QuitDialog" type="ConfirmationDialog" parent="."]
|
[node name="QuitDialog" type="ConfirmationDialog" parent="."]
|
||||||
margin_right = 200.0
|
margin_right = 200.0
|
||||||
|
@ -1877,12 +1696,12 @@ margin_bottom = 60.0
|
||||||
window_title = "Error!"
|
window_title = "Error!"
|
||||||
dialog_text = "This is an error message!"
|
dialog_text = "This is an error message!"
|
||||||
|
|
||||||
[node name="EditPalettePopup" parent="." instance=ExtResource( 65 )]
|
[node name="EditPalettePopup" parent="." instance=ExtResource( 68 )]
|
||||||
visible = false
|
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" )
|
filters = PoolStringArray( "*.json ; JavaScript Object Notation", "*.gpl ; Gimp Palette Library" )
|
||||||
current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
|
current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
|
||||||
current_path = "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/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="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="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="popup_hide" from="CreateNewImage" to="." method="_can_draw_true"]
|
||||||
[connection signal="file_selected" from="OpenSprite" to="." method="_on_OpenSprite_file_selected"]
|
[connection signal="file_selected" from="OpenSprite" to="." method="_on_OpenSprite_file_selected"]
|
||||||
[connection signal="popup_hide" from="OpenSprite" to="." method="_on_ImportSprites_popup_hide"]
|
[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="SaveSprite" to="." method="_can_draw_true"]
|
||||||
[connection signal="popup_hide" from="ImportSprites" 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="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="ScaleImage" to="." method="_can_draw_true"]
|
||||||
[connection signal="popup_hide" from="PreferencesDialog" 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="OutlineDialog" to="." method="_can_draw_true"]
|
||||||
[connection signal="popup_hide" from="AboutDialog" 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"]
|
[connection signal="confirmed" from="QuitDialog" to="." method="_on_QuitDialog_confirmed"]
|
||||||
|
|
75
Prefabs/Dialogs/CreateNewImage.tscn
Normal file
75
Prefabs/Dialogs/CreateNewImage.tscn
Normal file
|
@ -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"]
|
|
@ -41,6 +41,7 @@ text = "Resize:"
|
||||||
margin_left = 50.0
|
margin_left = 50.0
|
||||||
margin_right = 124.0
|
margin_right = 124.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 40.0
|
||||||
|
mouse_default_cursor_shape = 2
|
||||||
min_value = 10.0
|
min_value = 10.0
|
||||||
max_value = 1000.0
|
max_value = 1000.0
|
||||||
step = 10.0
|
step = 10.0
|
||||||
|
@ -55,8 +56,9 @@ margin_bottom = 27.0
|
||||||
text = "Interpolation:"
|
text = "Interpolation:"
|
||||||
|
|
||||||
[node name="Interpolation" type="OptionButton" parent="Resize"]
|
[node name="Interpolation" type="OptionButton" parent="Resize"]
|
||||||
margin_right = 41.0
|
margin_left = 219.0
|
||||||
margin_bottom = 20.0
|
margin_right = 303.0
|
||||||
|
margin_bottom = 40.0
|
||||||
text = "Item 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 ]
|
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
|
selected = 0
|
||||||
|
@ -68,15 +70,16 @@ margin_top = 8.0
|
||||||
margin_right = 507.0
|
margin_right = 507.0
|
||||||
margin_bottom = 312.0
|
margin_bottom = 312.0
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="Spritesheet"]
|
[node name="ColumnsOrRows" type="OptionButton" parent="Spritesheet"]
|
||||||
margin_top = 145.0
|
margin_right = 97.0
|
||||||
margin_right = 60.0
|
margin_bottom = 304.0
|
||||||
margin_bottom = 159.0
|
text = "Columns"
|
||||||
text = "Columns:"
|
items = [ "Columns", null, false, 0, null, "Rows", null, false, 1, null ]
|
||||||
|
selected = 0
|
||||||
|
|
||||||
[node name="VerticalFrames" type="SpinBox" parent="Spritesheet"]
|
[node name="Frames" type="SpinBox" parent="Spritesheet"]
|
||||||
margin_left = 64.0
|
margin_left = 101.0
|
||||||
margin_right = 138.0
|
margin_right = 175.0
|
||||||
margin_bottom = 304.0
|
margin_bottom = 304.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
min_value = 1.0
|
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="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="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="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"]
|
||||||
|
|
59
Prefabs/Dialogs/OutlineDialog.tscn
Normal file
59
Prefabs/Dialogs/OutlineDialog.tscn
Normal file
|
@ -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"]
|
76
Prefabs/Dialogs/ScaleImage.tscn
Normal file
76
Prefabs/Dialogs/ScaleImage.tscn
Normal file
|
@ -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"]
|
18
Scripts/Dialogs/CreateNewImage.gd
Normal file
18
Scripts/Dialogs/CreateNewImage.gd
Normal file
|
@ -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)
|
|
@ -4,6 +4,7 @@ var current_export_path := ""
|
||||||
var export_option := 0
|
var export_option := 0
|
||||||
var resize := 100
|
var resize := 100
|
||||||
var interpolation = Image.INTERPOLATE_NEAREST
|
var interpolation = Image.INTERPOLATE_NEAREST
|
||||||
|
var per_rows := false
|
||||||
var spritesheet_rows = 1
|
var spritesheet_rows = 1
|
||||||
var spritesheet_columns = 1
|
var spritesheet_columns = 1
|
||||||
|
|
||||||
|
@ -31,12 +32,19 @@ func _on_ResizeValue_value_changed(value) -> void:
|
||||||
func _on_Interpolation_item_selected(ID : int) -> void:
|
func _on_Interpolation_item_selected(ID : int) -> void:
|
||||||
interpolation = ID
|
interpolation = ID
|
||||||
|
|
||||||
func _on_VerticalFrames_value_changed(value) -> void:
|
func _on_ColumnsOrRows_item_selected(ID) -> void:
|
||||||
value = min(value, Global.canvases.size())
|
per_rows = bool(ID)
|
||||||
spritesheet_columns = value
|
|
||||||
|
|
||||||
var vertical_frames : SpinBox = Global.find_node_by_name(self, "VerticalFrames")
|
func _on_Frames_value_changed(value):
|
||||||
vertical_frames.value = spritesheet_columns
|
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:
|
func _on_ExportSprites_file_selected(path : String) -> void:
|
||||||
current_export_path = path
|
current_export_path = path
|
||||||
|
@ -83,7 +91,10 @@ func save_sprite(canvas : Canvas, path : String) -> void:
|
||||||
OS.alert("Can't save file")
|
OS.alert("Can't save file")
|
||||||
|
|
||||||
func save_spritesheet() -> void:
|
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 width = Global.canvas.size.x * spritesheet_rows
|
||||||
var height = Global.canvas.size.y * spritesheet_columns
|
var height = Global.canvas.size.y * spritesheet_columns
|
||||||
|
|
||||||
|
@ -94,14 +105,25 @@ func save_spritesheet() -> void:
|
||||||
var hh := 0
|
var hh := 0
|
||||||
var vv := 0
|
var vv := 0
|
||||||
for canvas in Global.canvases:
|
for canvas in Global.canvases:
|
||||||
if hh < spritesheet_rows:
|
if per_rows:
|
||||||
dst.x = canvas.size.x * hh
|
if vv < spritesheet_columns:
|
||||||
hh += 1
|
dst.y = canvas.size.y * vv
|
||||||
|
vv += 1
|
||||||
|
else:
|
||||||
|
hh += 1
|
||||||
|
dst.y = 0
|
||||||
|
vv = 1
|
||||||
|
dst.x = canvas.size.x * hh
|
||||||
|
|
||||||
else:
|
else:
|
||||||
vv += 1
|
if hh < spritesheet_rows:
|
||||||
dst.x = 0
|
dst.x = canvas.size.x * hh
|
||||||
hh = 1
|
hh += 1
|
||||||
dst.y = canvas.size.y * vv
|
else:
|
||||||
|
vv += 1
|
||||||
|
dst.x = 0
|
||||||
|
hh = 1
|
||||||
|
dst.y = canvas.size.y * vv
|
||||||
|
|
||||||
for layer in canvas.layers:
|
for layer in canvas.layers:
|
||||||
var img : Image = layer[0]
|
var img : Image = layer[0]
|
||||||
|
@ -121,3 +143,4 @@ func save_spritesheet() -> void:
|
||||||
var err = whole_image.save_png(current_export_path)
|
var err = whole_image.save_png(current_export_path)
|
||||||
if err != OK:
|
if err != OK:
|
||||||
OS.alert("Can't save file")
|
OS.alert("Can't save file")
|
||||||
|
|
||||||
|
|
74
Scripts/Dialogs/OutlineDialog.gd
Normal file
74
Scripts/Dialogs/OutlineDialog.gd
Normal file
|
@ -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")
|
20
Scripts/Dialogs/ScaleImage.gd
Normal file
20
Scripts/Dialogs/ScaleImage.gd
Normal file
|
@ -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()
|
111
Scripts/Main.gd
111
Scripts/Main.gd
|
@ -340,23 +340,6 @@ func help_menu_id_pressed(id : int) -> void:
|
||||||
$AboutDialog.popup_centered()
|
$AboutDialog.popup_centered()
|
||||||
Global.can_draw = false
|
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:
|
func _on_OpenSprite_file_selected(path : String) -> void:
|
||||||
var file := File.new()
|
var file := File.new()
|
||||||
var err := file.open(path, File.READ)
|
var err := file.open(path, File.READ)
|
||||||
|
@ -521,99 +504,6 @@ func clear_canvases() -> void:
|
||||||
$ExportSprites.current_export_path = ""
|
$ExportSprites.current_export_path = ""
|
||||||
file_menu.set_item_text(5, "Export PNG...")
|
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:
|
func _on_ImportSprites_popup_hide() -> void:
|
||||||
if !opensprite_file_selected:
|
if !opensprite_file_selected:
|
||||||
Global.can_draw = true
|
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.canvas.layers[Global.canvas.current_layer_index][4] = value / 100
|
||||||
Global.layer_opacity_slider.value = value
|
Global.layer_opacity_slider.value = value
|
||||||
Global.layer_opacity_spinbox.value = value
|
Global.layer_opacity_spinbox.value = value
|
||||||
|
Global.canvas.update()
|
||||||
|
|
||||||
func _on_QuitDialog_confirmed() -> void:
|
func _on_QuitDialog_confirmed() -> void:
|
||||||
# Darken the UI to denote that the application is currently exiting
|
# Darken the UI to denote that the application is currently exiting
|
||||||
|
|
Loading…
Reference in a new issue