diff --git a/Assets/Graphics/Color defaults.png b/Assets/Graphics/Color defaults.png deleted file mode 100644 index 0af189db6..000000000 Binary files a/Assets/Graphics/Color defaults.png and /dev/null differ diff --git a/Assets/Graphics/Color switch.png b/Assets/Graphics/Color switch.png deleted file mode 100644 index 463c45d47..000000000 Binary files a/Assets/Graphics/Color switch.png and /dev/null differ diff --git a/Assets/Graphics/Dark Themes/Misc/Color defaults.png b/Assets/Graphics/Dark Themes/Misc/Color defaults.png new file mode 100644 index 000000000..43a66a1d4 Binary files /dev/null and b/Assets/Graphics/Dark Themes/Misc/Color defaults.png differ diff --git a/Assets/Graphics/Dark Themes/Misc/Color defaults.png.import b/Assets/Graphics/Dark Themes/Misc/Color defaults.png.import new file mode 100644 index 000000000..6025fb33e --- /dev/null +++ b/Assets/Graphics/Dark Themes/Misc/Color defaults.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Color defaults.png-a5219be4cc809f32a593212bcaaa57e5.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Graphics/Dark Themes/Misc/Color defaults.png" +dest_files=[ "res://.import/Color defaults.png-a5219be4cc809f32a593212bcaaa57e5.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Assets/Graphics/Dark Themes/Misc/Color switch.png b/Assets/Graphics/Dark Themes/Misc/Color switch.png new file mode 100644 index 000000000..5abefba48 Binary files /dev/null and b/Assets/Graphics/Dark Themes/Misc/Color switch.png differ diff --git a/Assets/Graphics/Color switch.png.import b/Assets/Graphics/Dark Themes/Misc/Color switch.png.import similarity index 66% rename from Assets/Graphics/Color switch.png.import rename to Assets/Graphics/Dark Themes/Misc/Color switch.png.import index 72f979a7e..3c4aa23d9 100644 --- a/Assets/Graphics/Color switch.png.import +++ b/Assets/Graphics/Dark Themes/Misc/Color switch.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/Color switch.png-f9e2eb085120719d1eee74a1bce856b6.stex" +path="res://.import/Color switch.png-ed9731ce2a88d923756596ba8b5d5970.stex" metadata={ "vram_texture": false } [deps] -source_file="res://Assets/Graphics/Color switch.png" -dest_files=[ "res://.import/Color switch.png-f9e2eb085120719d1eee74a1bce856b6.stex" ] +source_file="res://Assets/Graphics/Dark Themes/Misc/Color switch.png" +dest_files=[ "res://.import/Color switch.png-ed9731ce2a88d923756596ba8b5d5970.stex" ] [params] diff --git a/Assets/Graphics/Dark Themes/Timeline/Next_Frame_hover.png b/Assets/Graphics/Dark Themes/Timeline/Next_Frame_Hover.png similarity index 100% rename from Assets/Graphics/Dark Themes/Timeline/Next_Frame_hover.png rename to Assets/Graphics/Dark Themes/Timeline/Next_Frame_Hover.png diff --git a/Assets/Graphics/Dark Themes/Timeline/Next_Frame_hover.png.import b/Assets/Graphics/Dark Themes/Timeline/Next_Frame_Hover.png.import similarity index 100% rename from Assets/Graphics/Dark Themes/Timeline/Next_Frame_hover.png.import rename to Assets/Graphics/Dark Themes/Timeline/Next_Frame_Hover.png.import diff --git a/Assets/Graphics/Light Themes/Layers/Clone_Layer.png b/Assets/Graphics/Light Themes/Layers/Clone_Layer.png index 0b722f36b..aa5c6dd21 100644 Binary files a/Assets/Graphics/Light Themes/Layers/Clone_Layer.png and b/Assets/Graphics/Light Themes/Layers/Clone_Layer.png differ diff --git a/Assets/Graphics/Light Themes/Layers/Delete_Layer.png b/Assets/Graphics/Light Themes/Layers/Delete_Layer.png index 70a61bb34..787cf86ac 100644 Binary files a/Assets/Graphics/Light Themes/Layers/Delete_Layer.png and b/Assets/Graphics/Light Themes/Layers/Delete_Layer.png differ diff --git a/Assets/Graphics/Light Themes/Layers/Layer_Invisible.png b/Assets/Graphics/Light Themes/Layers/Layer_Invisible.png index ca0296dbd..4000e347c 100644 Binary files a/Assets/Graphics/Light Themes/Layers/Layer_Invisible.png and b/Assets/Graphics/Light Themes/Layers/Layer_Invisible.png differ diff --git a/Assets/Graphics/Light Themes/Layers/Layer_Visible.png b/Assets/Graphics/Light Themes/Layers/Layer_Visible.png index b405fa5bb..a236268ef 100644 Binary files a/Assets/Graphics/Light Themes/Layers/Layer_Visible.png and b/Assets/Graphics/Light Themes/Layers/Layer_Visible.png differ diff --git a/Assets/Graphics/Light Themes/Layers/Merge_Down.png b/Assets/Graphics/Light Themes/Layers/Merge_Down.png index a0215bd8d..1fa720635 100644 Binary files a/Assets/Graphics/Light Themes/Layers/Merge_Down.png and b/Assets/Graphics/Light Themes/Layers/Merge_Down.png differ diff --git a/Assets/Graphics/Light Themes/Layers/Move_Down.png b/Assets/Graphics/Light Themes/Layers/Move_Down.png index cba033866..2a90ff9c9 100644 Binary files a/Assets/Graphics/Light Themes/Layers/Move_Down.png and b/Assets/Graphics/Light Themes/Layers/Move_Down.png differ diff --git a/Assets/Graphics/Light Themes/Layers/Move_Up.png b/Assets/Graphics/Light Themes/Layers/Move_Up.png index 8a93cec7b..7551644df 100644 Binary files a/Assets/Graphics/Light Themes/Layers/Move_Up.png and b/Assets/Graphics/Light Themes/Layers/Move_Up.png differ diff --git a/Assets/Graphics/Light Themes/Layers/New_Layer.png b/Assets/Graphics/Light Themes/Layers/New_Layer.png index 0642c0e82..4d08c51d1 100644 Binary files a/Assets/Graphics/Light Themes/Layers/New_Layer.png and b/Assets/Graphics/Light Themes/Layers/New_Layer.png differ diff --git a/Assets/Graphics/Light Themes/Misc/Color defaults.png b/Assets/Graphics/Light Themes/Misc/Color defaults.png new file mode 100644 index 000000000..abfadac0e Binary files /dev/null and b/Assets/Graphics/Light Themes/Misc/Color defaults.png differ diff --git a/Assets/Graphics/Light Themes/Misc/Color defaults.png.import b/Assets/Graphics/Light Themes/Misc/Color defaults.png.import new file mode 100644 index 000000000..b01792db6 --- /dev/null +++ b/Assets/Graphics/Light Themes/Misc/Color defaults.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Color defaults.png-8c3256c5d6467fd18ff3c8e5943e4524.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Graphics/Light Themes/Misc/Color defaults.png" +dest_files=[ "res://.import/Color defaults.png-8c3256c5d6467fd18ff3c8e5943e4524.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Assets/Graphics/Light Themes/Misc/Color switch.png b/Assets/Graphics/Light Themes/Misc/Color switch.png new file mode 100644 index 000000000..e4b523c10 Binary files /dev/null and b/Assets/Graphics/Light Themes/Misc/Color switch.png differ diff --git a/Assets/Graphics/Color defaults.png.import b/Assets/Graphics/Light Themes/Misc/Color switch.png.import similarity index 66% rename from Assets/Graphics/Color defaults.png.import rename to Assets/Graphics/Light Themes/Misc/Color switch.png.import index 92cba6252..2dfd9d5db 100644 --- a/Assets/Graphics/Color defaults.png.import +++ b/Assets/Graphics/Light Themes/Misc/Color switch.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/Color defaults.png-b685e4709fe1b7b16bbba96d732e892b.stex" +path="res://.import/Color switch.png-18403b22b815354775440e2a99f1f74f.stex" metadata={ "vram_texture": false } [deps] -source_file="res://Assets/Graphics/Color defaults.png" -dest_files=[ "res://.import/Color defaults.png-b685e4709fe1b7b16bbba96d732e892b.stex" ] +source_file="res://Assets/Graphics/Light Themes/Misc/Color switch.png" +dest_files=[ "res://.import/Color switch.png-18403b22b815354775440e2a99f1f74f.stex" ] [params] diff --git a/Assets/Graphics/Light Themes/Timeline/Go_To_First_Frame.png b/Assets/Graphics/Light Themes/Timeline/Go_To_First_Frame.png index f14ad5496..bc9753370 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/Go_To_First_Frame.png and b/Assets/Graphics/Light Themes/Timeline/Go_To_First_Frame.png differ diff --git a/Assets/Graphics/Light Themes/Timeline/Go_To_Last_Frame.png b/Assets/Graphics/Light Themes/Timeline/Go_To_Last_Frame.png index beea38bde..99633ba3f 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/Go_To_Last_Frame.png and b/Assets/Graphics/Light Themes/Timeline/Go_To_Last_Frame.png differ diff --git a/Assets/Graphics/Light Themes/Timeline/Loop.png b/Assets/Graphics/Light Themes/Timeline/Loop.png index d08f65f34..c9fb1263b 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/Loop.png and b/Assets/Graphics/Light Themes/Timeline/Loop.png differ diff --git a/Assets/Graphics/Light Themes/Timeline/Loop_None.png b/Assets/Graphics/Light Themes/Timeline/Loop_None.png index 6b3332ee0..e81dd6210 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/Loop_None.png and b/Assets/Graphics/Light Themes/Timeline/Loop_None.png differ diff --git a/Assets/Graphics/Light Themes/Timeline/Loop_PingPong.png b/Assets/Graphics/Light Themes/Timeline/Loop_PingPong.png index 926c6fe76..f05dfa07f 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/Loop_PingPong.png and b/Assets/Graphics/Light Themes/Timeline/Loop_PingPong.png differ diff --git a/Assets/Graphics/Light Themes/Timeline/New_Frame.png b/Assets/Graphics/Light Themes/Timeline/New_Frame.png index 3e0066482..3a430ba42 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/New_Frame.png and b/Assets/Graphics/Light Themes/Timeline/New_Frame.png differ diff --git a/Assets/Graphics/Light Themes/Timeline/Next_Frame.png b/Assets/Graphics/Light Themes/Timeline/Next_Frame.png index 24372b939..47e25780b 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/Next_Frame.png and b/Assets/Graphics/Light Themes/Timeline/Next_Frame.png differ diff --git a/Assets/Graphics/Light Themes/Timeline/Pause.png b/Assets/Graphics/Light Themes/Timeline/Pause.png index 4f947f0c2..fa2ceb299 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/Pause.png and b/Assets/Graphics/Light Themes/Timeline/Pause.png differ diff --git a/Assets/Graphics/Light Themes/Timeline/Play Backwards.png b/Assets/Graphics/Light Themes/Timeline/Play Backwards.png index 924bec462..e606af394 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/Play Backwards.png and b/Assets/Graphics/Light Themes/Timeline/Play Backwards.png differ diff --git a/Assets/Graphics/Light Themes/Timeline/Play.png b/Assets/Graphics/Light Themes/Timeline/Play.png index 127fd0e52..4102993f2 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/Play.png and b/Assets/Graphics/Light Themes/Timeline/Play.png differ diff --git a/Assets/Graphics/Light Themes/Timeline/Previous_Frame.png b/Assets/Graphics/Light Themes/Timeline/Previous_Frame.png index 327a63188..c5f12e4ad 100644 Binary files a/Assets/Graphics/Light Themes/Timeline/Previous_Frame.png and b/Assets/Graphics/Light Themes/Timeline/Previous_Frame.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Brush.png b/Assets/Graphics/Light Themes/Tools/Brush.png index e97dc8cc8..2c245085e 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Brush.png and b/Assets/Graphics/Light Themes/Tools/Brush.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Brush_l.png b/Assets/Graphics/Light Themes/Tools/Brush_l.png index ae2919e07..2104df551 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Brush_l.png and b/Assets/Graphics/Light Themes/Tools/Brush_l.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Brush_r.png b/Assets/Graphics/Light Themes/Tools/Brush_r.png index 67d3dfde8..85b0afa6c 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Brush_r.png and b/Assets/Graphics/Light Themes/Tools/Brush_r.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Bucket.png b/Assets/Graphics/Light Themes/Tools/Bucket.png index 63d118768..8e80c9bc9 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Bucket.png and b/Assets/Graphics/Light Themes/Tools/Bucket.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Bucket_l.png b/Assets/Graphics/Light Themes/Tools/Bucket_l.png index 3ef679bf7..d285efa0c 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Bucket_l.png and b/Assets/Graphics/Light Themes/Tools/Bucket_l.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Bucket_r.png b/Assets/Graphics/Light Themes/Tools/Bucket_r.png index 4c4cdb2d9..c0bd7bef7 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Bucket_r.png and b/Assets/Graphics/Light Themes/Tools/Bucket_r.png differ diff --git a/Assets/Graphics/Light Themes/Tools/ColorPicker.png b/Assets/Graphics/Light Themes/Tools/ColorPicker.png index 095eceed6..b693c5af2 100644 Binary files a/Assets/Graphics/Light Themes/Tools/ColorPicker.png and b/Assets/Graphics/Light Themes/Tools/ColorPicker.png differ diff --git a/Assets/Graphics/Light Themes/Tools/ColorPicker_l.png b/Assets/Graphics/Light Themes/Tools/ColorPicker_l.png index 86f59c7f5..2ed36f7a9 100644 Binary files a/Assets/Graphics/Light Themes/Tools/ColorPicker_l.png and b/Assets/Graphics/Light Themes/Tools/ColorPicker_l.png differ diff --git a/Assets/Graphics/Light Themes/Tools/ColorPicker_r.png b/Assets/Graphics/Light Themes/Tools/ColorPicker_r.png index 7a85f6993..e17385fbc 100644 Binary files a/Assets/Graphics/Light Themes/Tools/ColorPicker_r.png and b/Assets/Graphics/Light Themes/Tools/ColorPicker_r.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Eraser.png b/Assets/Graphics/Light Themes/Tools/Eraser.png index 53b59385d..c7280214f 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Eraser.png and b/Assets/Graphics/Light Themes/Tools/Eraser.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Eraser_l.png b/Assets/Graphics/Light Themes/Tools/Eraser_l.png index 400f8f99f..a676602f2 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Eraser_l.png and b/Assets/Graphics/Light Themes/Tools/Eraser_l.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Eraser_r.png b/Assets/Graphics/Light Themes/Tools/Eraser_r.png index eedda6419..2c8beb5ba 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Eraser_r.png and b/Assets/Graphics/Light Themes/Tools/Eraser_r.png differ diff --git a/Assets/Graphics/Light Themes/Tools/LightenDarken.png b/Assets/Graphics/Light Themes/Tools/LightenDarken.png index adfa57fe0..f6d3dc6c1 100644 Binary files a/Assets/Graphics/Light Themes/Tools/LightenDarken.png and b/Assets/Graphics/Light Themes/Tools/LightenDarken.png differ diff --git a/Assets/Graphics/Light Themes/Tools/LightenDarken_l.png b/Assets/Graphics/Light Themes/Tools/LightenDarken_l.png index 266dc779e..33a009e9b 100644 Binary files a/Assets/Graphics/Light Themes/Tools/LightenDarken_l.png and b/Assets/Graphics/Light Themes/Tools/LightenDarken_l.png differ diff --git a/Assets/Graphics/Light Themes/Tools/LightenDarken_r.png b/Assets/Graphics/Light Themes/Tools/LightenDarken_r.png index d28a7ada4..d3f3a8007 100644 Binary files a/Assets/Graphics/Light Themes/Tools/LightenDarken_r.png and b/Assets/Graphics/Light Themes/Tools/LightenDarken_r.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Pencil.png b/Assets/Graphics/Light Themes/Tools/Pencil.png index 27c4ea992..3b61a0324 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Pencil.png and b/Assets/Graphics/Light Themes/Tools/Pencil.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Pencil_l.png b/Assets/Graphics/Light Themes/Tools/Pencil_l.png index 8d890050f..388d38451 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Pencil_l.png and b/Assets/Graphics/Light Themes/Tools/Pencil_l.png differ diff --git a/Assets/Graphics/Light Themes/Tools/Pencil_r.png b/Assets/Graphics/Light Themes/Tools/Pencil_r.png index 779517c9e..6f4fd0fc5 100644 Binary files a/Assets/Graphics/Light Themes/Tools/Pencil_r.png and b/Assets/Graphics/Light Themes/Tools/Pencil_r.png differ diff --git a/Assets/Graphics/Light Themes/Tools/RectSelect.png b/Assets/Graphics/Light Themes/Tools/RectSelect.png index af5517590..2a4e1d8c9 100644 Binary files a/Assets/Graphics/Light Themes/Tools/RectSelect.png and b/Assets/Graphics/Light Themes/Tools/RectSelect.png differ diff --git a/Assets/Graphics/Light Themes/Tools/RectSelect_l.png b/Assets/Graphics/Light Themes/Tools/RectSelect_l.png index 6339c87b3..a18ff569d 100644 Binary files a/Assets/Graphics/Light Themes/Tools/RectSelect_l.png and b/Assets/Graphics/Light Themes/Tools/RectSelect_l.png differ diff --git a/Assets/Graphics/Light Themes/Tools/RectSelect_r.png b/Assets/Graphics/Light Themes/Tools/RectSelect_r.png index de73bf5f0..23892a427 100644 Binary files a/Assets/Graphics/Light Themes/Tools/RectSelect_r.png and b/Assets/Graphics/Light Themes/Tools/RectSelect_r.png differ diff --git a/Main.tscn b/Main.tscn index 494aa90e7..419146f86 100644 --- a/Main.tscn +++ b/Main.tscn @@ -9,8 +9,8 @@ [ext_resource path="res://Assets/Graphics/Dark Themes/Tools/Eraser_r.png" type="Texture" id=7] [ext_resource path="res://Assets/Graphics/Dark Themes/Tools/Bucket.png" type="Texture" id=8] [ext_resource path="res://Assets/Graphics/Dark Themes/Tools/LightenDarken.png" type="Texture" id=9] -[ext_resource path="res://Assets/Graphics/Color switch.png" type="Texture" id=10] -[ext_resource path="res://Assets/Graphics/Color defaults.png" type="Texture" id=11] +[ext_resource path="res://Assets/Graphics/Dark Themes/Misc/Color switch.png" type="Texture" id=10] +[ext_resource path="res://Assets/Graphics/Dark Themes/Misc/Color defaults.png" type="Texture" id=11] [ext_resource path="res://Assets/Graphics/Brush_button.png" type="Texture" id=12] [ext_resource path="res://Themes & Styles/Dark Theme/DarkRulerStyle.tres" type="StyleBox" id=13] [ext_resource path="res://Scripts/HorizontalRuler.gd" type="Script" id=14] @@ -52,7 +52,7 @@ [ext_resource path="res://Assets/Graphics/Dark Themes/Layers/Merge_Down.png" type="Texture" id=50] [ext_resource path="res://Assets/Graphics/Dark Themes/Layers/Merge_Down_Hover.png" type="Texture" id=51] [ext_resource path="res://Assets/Graphics/Dark Themes/Layers/Merge_Down_Disabled.png" type="Texture" id=52] -[ext_resource path="res://Scripts/PaletteContainer.gd" type="Script" id=53] +[ext_resource path="res://Scripts/Palette/PaletteContainer.gd" type="Script" id=53] [ext_resource path="res://Prefabs/BrushButton.tscn" type="PackedScene" id=54] [ext_resource path="res://Assets/Graphics/Canvas_split.png" type="Texture" id=55] [ext_resource path="res://Assets/Graphics/Canvas_unsplit.png" type="Texture" id=56] @@ -226,7 +226,6 @@ text = "[64×64]" align = 2 [node name="UI" type="HBoxContainer" parent="MenuAndUI"] -editor/display_folded = true margin_top = 28.0 margin_right = 1152.0 margin_bottom = 648.0 @@ -375,7 +374,6 @@ button_mask = 3 texture_normal = ExtResource( 9 ) [node name="ColorAndToolOptions" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools"] -editor/display_folded = true margin_top = 159.0 margin_right = 208.0 margin_bottom = 612.0 @@ -383,39 +381,21 @@ size_flags_vertical = 3 custom_constants/separation = 8 alignment = 1 -[node name="ColorPickersCenter" type="CenterContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions"] -margin_top = 59.0 +[node name="ColorButtonsVertical" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions"] +margin_top = 56.0 margin_right = 208.0 -margin_bottom = 91.0 +margin_bottom = 94.0 +custom_constants/separation = -4 -[node name="ColorPickersHorizontal" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter"] -margin_left = 27.0 -margin_right = 180.0 -margin_bottom = 32.0 +[node name="ColorSwitchCenter" type="CenterContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical"] +margin_right = 208.0 +margin_bottom = 7.0 -[node name="LeftColorPickerButton" type="ColorPickerButton" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal"] -margin_right = 64.0 -margin_bottom = 32.0 -rect_min_size = Vector2( 64, 32 ) -hint_tooltip = "LEFTCOLOR_HT" -mouse_default_cursor_shape = 2 -size_flags_horizontal = 0 -size_flags_vertical = 0 -flat = true - -[node name="ColorButtonsCenter" type="CenterContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal"] -editor/display_folded = true -margin_left = 68.0 -margin_right = 85.0 -margin_bottom = 32.0 - -[node name="ColorButtonsVertical" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/ColorButtonsCenter"] -margin_top = 7.0 -margin_right = 17.0 -margin_bottom = 24.0 - -[node name="ColorSwitch" type="TextureButton" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/ColorButtonsCenter/ColorButtonsVertical"] -margin_right = 17.0 +[node name="ColorSwitch" type="TextureButton" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorSwitchCenter" groups=[ +"UIButtons", +]] +margin_left = 97.0 +margin_right = 110.0 margin_bottom = 7.0 hint_tooltip = "COLORSWITCH_HT" mouse_default_cursor_shape = 2 @@ -423,35 +403,62 @@ shortcut_in_tooltip = false shortcut = SubResource( 2 ) texture_normal = ExtResource( 10 ) -[node name="ColorDefaults" type="TextureButton" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/ColorButtonsCenter/ColorButtonsVertical"] -margin_top = 11.0 -margin_right = 17.0 -margin_bottom = 17.0 -hint_tooltip = "COLORDEFAULTS_HT" -mouse_default_cursor_shape = 2 -texture_normal = ExtResource( 11 ) +[node name="ColorPickersCenter" type="CenterContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical"] +margin_top = 3.0 +margin_right = 208.0 +margin_bottom = 35.0 -[node name="RightColorPickerButton" type="ColorPickerButton" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal"] -margin_left = 89.0 -margin_right = 153.0 +[node name="ColorPickersHorizontal" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter"] +margin_left = 33.0 +margin_right = 174.0 +margin_bottom = 32.0 +custom_constants/separation = 13 + +[node name="LeftColorPickerButton" type="ColorPickerButton" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal"] +margin_right = 64.0 +margin_bottom = 32.0 +rect_min_size = Vector2( 64, 32 ) +hint_tooltip = "LEFTCOLOR_HT" +mouse_default_cursor_shape = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 + +[node name="RightColorPickerButton" type="ColorPickerButton" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal"] +margin_left = 77.0 +margin_right = 141.0 margin_bottom = 32.0 rect_min_size = Vector2( 64, 32 ) hint_tooltip = "RIGHTCOLOR_HT" mouse_default_cursor_shape = 2 size_flags_horizontal = 0 size_flags_vertical = 0 -flat = true color = Color( 1, 1, 1, 1 ) -[node name="HSeparator" type="HSeparator" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions"] -margin_top = 99.0 +[node name="ColorDefaultsCenter" type="CenterContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical"] +margin_top = 31.0 margin_right = 208.0 -margin_bottom = 103.0 +margin_bottom = 38.0 +size_flags_horizontal = 3 + +[node name="ColorDefaults" type="TextureButton" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorDefaultsCenter" groups=[ +"UIButtons", +]] +margin_left = 97.0 +margin_right = 110.0 +margin_bottom = 7.0 +hint_tooltip = "COLORDEFAULTS_HT" +mouse_default_cursor_shape = 2 +texture_normal = ExtResource( 11 ) + +[node name="HSeparator" type="HSeparator" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions"] +margin_top = 102.0 +margin_right = 208.0 +margin_bottom = 106.0 [node name="LeftToolOptions" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions"] -margin_top = 111.0 +margin_top = 114.0 margin_right = 208.0 -margin_bottom = 242.0 +margin_bottom = 245.0 [node name="LeftLabel" type="Label" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions"] margin_right = 208.0 @@ -623,14 +630,14 @@ mouse_default_cursor_shape = 2 text = "Vertical" [node name="HSeparator2" type="HSeparator" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions"] -margin_top = 250.0 +margin_top = 253.0 margin_right = 208.0 -margin_bottom = 254.0 +margin_bottom = 257.0 [node name="RightToolOptions" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions"] -margin_top = 262.0 +margin_top = 265.0 margin_right = 208.0 -margin_bottom = 393.0 +margin_bottom = 396.0 [node name="RightLabel" type="Label" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions"] margin_right = 208.0 @@ -802,7 +809,6 @@ mouse_default_cursor_shape = 2 text = "Vertical" [node name="CanvasAndTimeline" type="VBoxContainer" parent="MenuAndUI/UI"] -editor/display_folded = true margin_left = 224.0 margin_right = 928.0 margin_bottom = 620.0 @@ -1724,6 +1730,7 @@ visible = false [node name="NewPaletteDialog" parent="." instance=ExtResource( 60 )] [node name="PaletteImportFileDialog" parent="." instance=ExtResource( 61 )] +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/" @@ -1734,14 +1741,14 @@ visible = false [node name="RightCursor" type="Sprite" parent="."] visible = false -[connection signal="color_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_on_LeftColorPickerButton_color_changed"] -[connection signal="popup_closed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_can_draw_true"] -[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_can_draw_false"] -[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/ColorButtonsCenter/ColorButtonsVertical/ColorSwitch" to="." method="_on_ColorSwitch_pressed"] -[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/ColorButtonsCenter/ColorButtonsVertical/ColorDefaults" to="." method="_on_ColorDefaults_pressed"] -[connection signal="color_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/RightColorPickerButton" to="." method="_on_RightColorPickerButton_color_changed"] -[connection signal="popup_closed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/RightColorPickerButton" to="." method="_can_draw_true"] -[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorPickersCenter/ColorPickersHorizontal/RightColorPickerButton" to="." method="_can_draw_false"] +[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorSwitchCenter/ColorSwitch" to="." method="_on_ColorSwitch_pressed"] +[connection signal="color_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_on_LeftColorPickerButton_color_changed"] +[connection signal="popup_closed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_can_draw_true"] +[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_can_draw_false"] +[connection signal="color_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal/RightColorPickerButton" to="." method="_on_RightColorPickerButton_color_changed"] +[connection signal="popup_closed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal/RightColorPickerButton" to="." method="_can_draw_true"] +[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal/RightColorPickerButton" to="." method="_can_draw_false"] +[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorDefaultsCenter/ColorDefaults" to="." method="_on_ColorDefaults_pressed"] [connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftIndicatorCheckbox" to="." method="_on_LeftIndicatorCheckbox_toggled"] [connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushType/LeftBrushTypeButton" to="." method="_on_LeftBrushTypeButton_pressed"] [connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushSize/LeftBrushSizeEdit" to="." method="_on_LeftBrushSizeEdit_value_changed"] diff --git a/Misc/Linux/com.orama_interactive.Pixelorama.appdata.xml b/Misc/Linux/com.orama_interactive.Pixelorama.appdata.xml index 9ea914312..26a75cea8 100644 --- a/Misc/Linux/com.orama_interactive.Pixelorama.appdata.xml +++ b/Misc/Linux/com.orama_interactive.Pixelorama.appdata.xml @@ -1,5 +1,5 @@ - + com.orama_interactive.Pixelorama.desktop Pixelorama @@ -12,18 +12,18 @@ CC0-1.0 MIT - OverloadedOrama + Orama Interactive https://www.orama-interactive.com/pixelorama - https://github.com/OverloadedOrama/Pixelorama/issues + https://github.com/Orama-Interactive/Pixelorama/issues - - https://functionoverload590613498.files.wordpress.com/2019/11/screenshot_268.png - Editing an animated sprite + + https://static.wixstatic.com/media/673cdd_b31327135c20489d8d632cfe9e642257~mv2.png + Art by Erevos - + hugo.locurcio@hugo.pro diff --git a/Prefabs/EditPalettePopup.tscn b/Prefabs/EditPalettePopup.tscn index 84d4746a7..275a33d18 100644 --- a/Prefabs/EditPalettePopup.tscn +++ b/Prefabs/EditPalettePopup.tscn @@ -1,11 +1,12 @@ [gd_scene load_steps=6 format=2] -[ext_resource path="res://Scripts/EditPalettePopup.gd" type="Script" id=1] +[ext_resource path="res://Scripts/Palette/EditPalettePopup.gd" type="Script" id=1] [ext_resource path="res://Assets/Graphics/Palette/new_swatch_button.png" type="Texture" id=2] [ext_resource path="res://Assets/Graphics/Palette/new_swatch_button_hover.png" type="Texture" id=3] [ext_resource path="res://Assets/Graphics/Palette/remove_swatch_button.png" type="Texture" id=4] [ext_resource path="res://Assets/Graphics/Palette/remove_swatch_button_hover.png" type="Texture" id=5] + [node name="EditPalettePopup" type="WindowDialog"] visible = true margin_right = 600.0 diff --git a/Prefabs/PaletteButton.tscn b/Prefabs/PaletteButton.tscn index fc1c63245..ea268349c 100644 --- a/Prefabs/PaletteButton.tscn +++ b/Prefabs/PaletteButton.tscn @@ -4,9 +4,10 @@ [ext_resource path="res://Themes & Styles/StyleBoxes/palette_stylebox_pressedr.tres" type="StyleBox" id=2] [ext_resource path="res://Themes & Styles/StyleBoxes/palette_stylebox_focus.tres" type="StyleBox" id=3] [ext_resource path="res://Themes & Styles/StyleBoxes/palette_stylebox_normal.tres" type="StyleBox" id=4] -[ext_resource path="res://Scripts/PaletteButton.gd" type="Script" id=5] +[ext_resource path="res://Scripts/Palette/PaletteButton.gd" type="Script" id=5] [ext_resource path="res://Assets/Graphics/Palette/palette_button_fill.png" type="Texture" id=6] + [sub_resource type="ImageTexture" id=1] [node name="PaletteButton" type="Button"] diff --git a/Scripts/Import.gd b/Scripts/Import.gd new file mode 100644 index 000000000..b3b3f5d2a --- /dev/null +++ b/Scripts/Import.gd @@ -0,0 +1,41 @@ +extends Node + +func import_gpl(path : String) -> Palette: + var result : Palette = null + var file = File.new() + if file.file_exists(path): + file.open(path, File.READ) + var text = file.get_as_text() + var lines = text.split('\n') + var line_number := 0 + var comments := "" + for line in lines: + # Check if valid Gimp Palette Library file + if line_number == 0: + if line != "GIMP Palette": + break + else: + result = Palette.new() + var name_start = path.find_last('/') + 1 + var name_end = path.find_last('.') + if name_end > name_start: + result.name = path.substr(name_start, name_end - name_start) + + # Comments + if line.begins_with('#'): + comments += line.trim_prefix('#') + '\n' + pass + elif line_number > 0 && line.length() >= 12: + var red : float = line.substr(0, 4).to_float() / 255.0 + var green : float = line.substr(4, 4).to_float() / 255.0 + var blue : float = line.substr(8, 4).to_float() / 255.0 + var name : String = line.substr(12, line.length() - 12) + var color = Color(red, green, blue) + result.add_color(color, name) + line_number += 1 + + if result: + result.comments = comments + file.close() + + return result diff --git a/Scripts/EditPalettePopup.gd b/Scripts/Palette/EditPalettePopup.gd similarity index 78% rename from Scripts/EditPalettePopup.gd rename to Scripts/Palette/EditPalettePopup.gd index 3b75fe658..43b1cafc8 100644 --- a/Scripts/EditPalettePopup.gd +++ b/Scripts/Palette/EditPalettePopup.gd @@ -8,8 +8,7 @@ var palette_button = preload("res://Prefabs/PaletteButton.tscn"); var current_palette : String var current_swatch := -1 -var working_palette : Dictionary - +var working_palette : Palette func open(palette : String) -> void: current_palette = palette @@ -26,7 +25,7 @@ func _display_palette() -> void: var index := 0 for color_data in working_palette.colors: - var color = Color(color_data.data) + var color = color_data.color var new_button = palette_button.instance() new_button.color = color @@ -48,14 +47,12 @@ func _clear_swatches() -> void: func on_swatch_select(index : int) -> void: current_swatch = index - color_name_edit.text = working_palette.colors[index].name - color_picker.color = working_palette.colors[index].data + color_name_edit.text = working_palette.get_color_name(index) + color_picker.color = working_palette.get_color(index) pass func on_move_swatch(from : int, to : int) -> void: - var color_to_move = working_palette.colors[from] - working_palette.colors.remove(from) - working_palette.colors.insert(to, color_to_move) + working_palette.move_color(from, to) palette_grid.move_child(palette_grid.get_child(from), to) @@ -68,15 +65,14 @@ func on_move_swatch(from : int, to : int) -> void: func _on_AddSwatchButton_pressed() -> void: var color = Color.white - var color_data = {} - color_data.data = color.to_html(true) - color_data.name = "no name" - working_palette.colors.push_back(color_data) + var new_index : int = working_palette.colors.size() + working_palette.add_color(color) + var new_button = palette_button.instance() new_button.color = color new_button.get_child(0).modulate = color - new_button.hint_tooltip = color_data.data.to_upper() + " " + color_data.name + new_button.hint_tooltip = "#" + working_palette.get_color_data(new_index).to_upper() + " " + working_palette.get_color_name(new_index) new_button.draggable = true var index : int = palette_grid.get_child_count() new_button.index = index @@ -87,7 +83,7 @@ func _on_AddSwatchButton_pressed() -> void: pass # Replace with function body. func _on_RemoveSwatchButton_pressed() -> void: - working_palette.colors.remove(current_swatch) + working_palette.remove_color(current_swatch) palette_grid.remove_child(palette_grid.get_child(current_swatch)) pass # Replace with function body. @@ -104,17 +100,17 @@ func _on_EditPaletteCancelButton_pressed() -> void: func _on_EditPaletteColorNameLineEdit_text_changed(new_text) -> void: if current_swatch >= 0 && current_swatch < working_palette.colors.size(): - working_palette.colors[current_swatch].name = new_text + working_palette.set_color_name(current_swatch, new_text) _refresh_hint_tooltip(current_swatch) pass func _on_EditPaletteColorPicker_color_changed(color) -> void: if current_swatch >= 0 && current_swatch < working_palette.colors.size(): palette_grid.get_child(current_swatch).get_child(0).modulate = color - working_palette.colors[current_swatch].data = color.to_html(true) + working_palette.set_color(current_swatch, color) _refresh_hint_tooltip(current_swatch) pass func _refresh_hint_tooltip(index : int): - palette_grid.get_child(current_swatch).hint_tooltip = working_palette.colors[current_swatch].data.to_upper() + " " + working_palette.colors[current_swatch].name + palette_grid.get_child(current_swatch).hint_tooltip = "#" + working_palette.get_color_data(current_swatch).to_upper() + " " + working_palette.get_color_name(current_swatch) pass diff --git a/Scripts/Palette/Palette.gd b/Scripts/Palette/Palette.gd new file mode 100644 index 000000000..fa746e1b9 --- /dev/null +++ b/Scripts/Palette/Palette.gd @@ -0,0 +1,134 @@ +extends Reference + +class_name Palette +func get_class(): return "Palette" +func is_class(name): return name == "Palette" or .is_class(name) + +var name : String = "Custom_Palette" +var colors : Array = [] +var comments : String = "" +var editable : bool = true + +func insert_color(index : int, new_color : Color, name : String = "no name") -> void: + if index < colors.size(): + var c := PaletteColor.new(new_color, name) + colors.insert(index, c) + +func add_color(new_color : Color, name : String = "no name") -> void: + var c := PaletteColor.new(new_color, name) + + colors.push_back(c) + +func remove_color(index : int) -> void: + if index < colors.size(): + colors.remove(index) + +func move_color(from : int, to : int) -> void: + if from < colors.size() && to < colors.size(): + var c : PaletteColor = colors[from] + remove_color(from) + insert_color(to, c.color, c.name) + +func get_color(index : int) -> Color: + var result := Color.black + + if index < colors.size(): + result = colors[index].color + + return result + +func set_color(index : int, new_color : Color) -> void: + if index < colors.size(): + colors[index].color = new_color + +func get_color_data(index : int) -> String: + var result := "" + + if index < colors.size(): + result = colors[index].data + + return result + +func set_color_data(index : int, new_color : String) -> void: + if index < colors.size(): + colors[index].data = new_color + +func get_color_name(index : int) -> String: + var result = "" + + if index < colors.size(): + result = colors[index].name + + return result + +func set_color_name(index : int, new_name : String) -> void: + if index < colors.size(): + colors[index].name = new_name + +func save_to_file(path : String) -> void: + var file = File.new() + file.open(path, File.WRITE) + file.store_string(_serialize()) + file.close() + +func duplicate() -> Palette: + var copy : Palette = get_script().new() + copy.name = name + copy.comments = comments + copy.editable = editable + for color in colors: + copy.colors.push_back(color.duplicate()) + return copy + +func _serialize() -> String: + var result = "" + var serialize_data : Dictionary = { + "name" : name, + "colors" : [], + "comments" : comments, + "editable" : editable + } + for color in colors: + serialize_data.colors.push_back(color.toDict()) + + result = JSON.print(serialize_data) + + return result; + +func deserialize(input_string : String) -> Palette: + var result = get_script().new() + + var result_json = JSON.parse(input_string) +# + if result_json.error != OK: # If parse has errors + print("Error: ", result_json.error) + print("Error Line: ", result_json.error_line) + print("Error String: ", result_json.error_string) + result = null + else: # If parse OK + var data = result_json.result + if data.has("name"): #If data is 'valid' palette file + result = get_script().new() + result.name = data.name + if data.has("comments"): + result.comments = data.comments + if data.has("editable"): + result.editable = data.editable + for color_data in data.colors: + result.add_color(color_data.data, color_data.name) + + return result + +func load_from_file(path : String) -> Palette: + var result : Palette = null + var file = File.new() + + if file.file_exists(path): + file.open(path, File.READ) + + var text : String = file.get_as_text() + result = deserialize(text) + + file.close() + + return result \ No newline at end of file diff --git a/Scripts/PaletteButton.gd b/Scripts/Palette/PaletteButton.gd similarity index 100% rename from Scripts/PaletteButton.gd rename to Scripts/Palette/PaletteButton.gd diff --git a/Scripts/Palette/PaletteColor.gd b/Scripts/Palette/PaletteColor.gd new file mode 100644 index 000000000..d4103aa7e --- /dev/null +++ b/Scripts/Palette/PaletteColor.gd @@ -0,0 +1,42 @@ +extends Reference + +class_name PaletteColor +func get_class(): return "PaletteColor" +func is_class(name): return name == "PaletteColor" or .is_class(name) + +var color : Color = Color.black setget _set_color +var data : String = "" setget _set_data +var name : String = "no name" + +func _init(new_color : Color = Color.black, new_name : String = "no name"): + self.color = new_color + self.name = new_name + +func _set_color(new_value : Color) -> void: + color = new_value + data = color.to_html(true) + +func _set_data(new_value : String) -> void: + data = new_value + color = Color(data) + +func toDict() -> Dictionary: + var result = { + "data" : data, + "name" : name + } + return result + +func fromDict(input_dict : Dictionary) -> PaletteColor: + var result = get_script().new() + + result.data = input_dict.data + result.name = input_dict.name + + return result + +func duplicate() -> PaletteColor: + var copy : PaletteColor = get_script().new() + copy.data = data + copy.name = name + return copy \ No newline at end of file diff --git a/Scripts/PaletteContainer.gd b/Scripts/Palette/PaletteContainer.gd similarity index 56% rename from Scripts/PaletteContainer.gd rename to Scripts/Palette/PaletteContainer.gd index 11b839742..fc2e0c216 100644 --- a/Scripts/PaletteContainer.gd +++ b/Scripts/Palette/PaletteContainer.gd @@ -3,7 +3,7 @@ extends GridContainer const palette_button = preload("res://Prefabs/PaletteButton.tscn"); var current_palette = "Default" -var from_palette : = {} +var from_palette : Palette # Called when the node enters the scene tree for the first time. func _ready() -> void: @@ -22,12 +22,11 @@ func on_palette_select(palette_name : String) -> void: _clear_swatches() if Global.palettes.has(palette_name): #Palette exists in memory current_palette = palette_name - var palette : Dictionary = Global.palettes[palette_name] + var palette : Palette = Global.palettes[palette_name] Global.remove_palette_button.disabled = true # Cannot remove by default - if palette.has("editable"): - if palette.editable: - Global.remove_palette_button.disabled = false # Can remove if custom palette + if palette.editable: + Global.remove_palette_button.disabled = false # Can remove if custom palette _display_palette(palette) else: #Use default on fail @@ -37,7 +36,7 @@ func on_palette_select(palette_name : String) -> void: func on_new_empty_palette() -> void: Global.new_palette_dialog.window_title = "Create a new empty palette?" Global.new_palette_name_line_edit.text = "Custom_Palette" - from_palette = {} + from_palette = null Global.new_palette_dialog.popup_centered() pass @@ -47,42 +46,35 @@ func on_import_palette() -> void: func on_palette_import_file_selected(path) -> void: var file := File.new() + var palette : Palette = null + if path.to_lower().ends_with("json"): + palette = Palette.new().load_from_file(path) + elif path.to_lower().ends_with("gpl"): + palette = Import.import_gpl(path) - file.open(path, File.READ) - var text = file.get_as_text() - var result_json = JSON.parse(text) - var result = {} - var palette_name = null # Default error condition - - if result_json.error != OK: # If parse has errors - print("Error: ", result_json.error) - print("Error Line: ", result_json.error_line) - print("Error String: ", result_json.error_string) - else: # If parse OK - var data = result_json.result - if data.has("name"): #If data is 'valid' palette file - palette_name = data.name - if not Global.palettes.has(palette_name): - Global.palettes[palette_name] = data - Global.palette_option_button.add_item(palette_name) - var index := Global.palette_option_button.get_item_count() - 1 - Global.palette_option_button.set_item_metadata(index, palette_name) - Global.palette_option_button.select(index) - on_palette_select(palette_name) - save_palette(palette_name, palette_name + ".json") - else: - Global.error_dialog.set_text("Palette named '" + palette_name + "' already exists"); - Global.error_dialog.popup_centered() - file.close() + if palette: + if not Global.palettes.has(palette.name): + Global.palettes[palette.name] = palette + Global.palette_option_button.add_item(palette.name) + var index := Global.palette_option_button.get_item_count() - 1 + Global.palette_option_button.set_item_metadata(index, palette.name) + Global.palette_option_button.select(index) + on_palette_select(palette.name) + save_palette(palette.name, palette.name + ".json") + else: + Global.error_dialog.set_text("Palette named '" + palette.name + "' already exists"); + Global.error_dialog.popup_centered() + else: + Global.error_dialog.set_text("Invalid Palette file!") + Global.error_dialog.popup_centered() pass func on_edit_palette() -> void: var palette : Dictionary = Global.palettes[current_palette] var create_new_palette := true # Create new palette by default - if palette.has("editable"): - if palette.editable: - create_new_palette = false # Edit if already a custom palette + if palette.editable: + create_new_palette = false # Edit if already a custom palette if create_new_palette: from_palette = Global.palettes[current_palette] @@ -90,7 +82,7 @@ func on_edit_palette() -> void: Global.new_palette_name_line_edit.text = "Custom_" + current_palette Global.new_palette_dialog.popup_centered() else: - from_palette = {} + from_palette = null Global.edit_palette_popup.open(current_palette) func on_new_palette_confirmed() -> void: @@ -100,8 +92,8 @@ func on_new_palette_confirmed() -> void: Global.error_dialog.set_text(result); Global.error_dialog.popup_centered() -func create_new_palette(name : String, from_palette : Dictionary = {}) -> String: # Returns empty string, else error string - var new_palette : Dictionary = {} +func create_new_palette(name : String, from_palette : Palette) -> String: # Returns empty string, else error string + var new_palette : Palette = Palette.new() # Check if new name is valid if name.empty(): @@ -112,14 +104,10 @@ func create_new_palette(name : String, from_palette : Dictionary = {}) -> String new_palette.name = name # Check if source palette has data - if from_palette.has("name"): + if from_palette: new_palette = from_palette.duplicate() new_palette.name = name new_palette.editable = true - else: - new_palette.colors = [] - new_palette.comments = "" - new_palette.editable = true # Add palette to Global and options Global.palettes[name] = new_palette @@ -133,22 +121,22 @@ func create_new_palette(name : String, from_palette : Dictionary = {}) -> String on_palette_select(name) return "" -func _display_palette(palette : Dictionary) -> void: +func _display_palette(palette : Palette) -> void: var index := 0 for color_data in palette.colors: - var color = Color(color_data.data) + var color = color_data.color var new_button = palette_button.instance() new_button.get_child(0).modulate = color - new_button.hint_tooltip = color_data.data.to_upper() + " " + color_data.name + new_button.hint_tooltip = "#" + color_data.data.to_upper() + " " + color_data.name new_button.connect("pressed", self, "on_color_select", [index]) add_child(new_button) index += 1 func on_color_select(index : int) -> void: - var color = Color(Global.palettes[current_palette].colors[index].data) + var color : Color = Global.palettes[current_palette].get_color(index) if Input.is_action_just_released("left_mouse"): Global.left_color_picker.color = color @@ -173,23 +161,25 @@ func _load_palettes() -> void: var palette_files : Array = get_palette_files("user://palettes") for file_name in palette_files: - var result : String = load_palette("user://palettes/" + file_name) - if result: - Global.palette_option_button.add_item(result) + var palette : Palette = Palette.new().load_from_file("user://palettes/" + file_name) + if palette: + Global.palettes[palette.name] = palette + Global.palette_option_button.add_item(palette.name) var index := Global.palette_option_button.get_item_count() - 1 - Global.palette_option_button.set_item_metadata(index, result) - if result == "Default": + Global.palette_option_button.set_item_metadata(index, palette.name) + if palette.name == "Default": Global.palette_option_button.select(index) dir.open("user://palettes/custom") var custom_palette_files : Array = get_palette_files("user://palettes/custom") for file_name in custom_palette_files: - var result : String = load_palette("user://palettes/custom/" + file_name) - if result: - Global.palette_option_button.add_item(result) + var palette : Palette = Palette.new().load_from_file("user://palettes/custom/" + file_name) + if palette: + Global.palettes[palette.name] = palette + Global.palette_option_button.add_item(palette.name) var index := Global.palette_option_button.get_item_count() - 1 - Global.palette_option_button.set_item_metadata(index, result) + Global.palette_option_button.set_item_metadata(index, palette.name) func get_palette_files(path : String) -> Array: var dir := Directory.new() @@ -209,41 +199,15 @@ func get_palette_files(path : String) -> Array: return results -func load_palette(path : String) -> String: - # Open file for reading - var file := File.new() - file.open(path, File.READ) - - var text = file.get_as_text() - var result_json = JSON.parse(text) - var result = {} - - var palette_name = null # Default error condition - - if result_json.error != OK: # If parse has errors - print("Error: ", result_json.error) - print("Error Line: ", result_json.error_line) - print("Error String: ", result_json.error_string) - else: # If parse OK - var data = result_json.result - if data.has("name"): #If data is 'valid' palette file - palette_name = data.name - Global.palettes[data.name] = data - - file.close() - - return palette_name - func remove_current_palette() -> void: - if Global.palettes[current_palette].has("editable"): - if Global.palettes[current_palette].editable: - _delete_palette_file(current_palette + ".json") - Global.palettes.erase(current_palette) - var selected_index := Global.palette_option_button.selected - Global.palette_option_button.remove_item(selected_index) - if(selected_index - 1 >= 0): - Global.palette_option_button.select(selected_index - 1) - on_palette_select(Global.palette_option_button.get_item_metadata(selected_index - 1)) + if Global.palettes[current_palette].editable: + _delete_palette_file(current_palette + ".json") + Global.palettes.erase(current_palette) + var selected_index := Global.palette_option_button.selected + Global.palette_option_button.remove_item(selected_index) + if(selected_index - 1 >= 0): + Global.palette_option_button.select(selected_index - 1) + on_palette_select(Global.palette_option_button.get_item_metadata(selected_index - 1)) pass func _delete_palette_file(file_name : String) -> void: @@ -251,11 +215,6 @@ func _delete_palette_file(file_name : String) -> void: dir.remove("user://palettes/custom/" + file_name) func save_palette(palette_name : String, filename : String) -> void: - var palette_data = Global.palettes[palette_name] - # Open file for writing - var file := File.new() - file.open("user://palettes/custom/" + filename, File.WRITE) + var palette = Global.palettes[palette_name] - # Write palette data to file - file.store_string(JSON.print(palette_data)) - file.close() + palette.save_to_file("user://palettes/custom/" + filename) diff --git a/project.godot b/project.godot index 83394292c..ae5e4aa83 100644 --- a/project.godot +++ b/project.godot @@ -23,11 +23,23 @@ _global_script_classes=[ { "class": "LayerContainer", "language": "GDScript", "path": "res://Scripts/LayerContainer.gd" +}, { +"base": "Reference", +"class": "Palette", +"language": "GDScript", +"path": "res://Scripts/Palette/Palette.gd" +}, { +"base": "Reference", +"class": "PaletteColor", +"language": "GDScript", +"path": "res://Scripts/Palette/PaletteColor.gd" } ] _global_script_class_icons={ "Canvas": "", "Guide": "", -"LayerContainer": "" +"LayerContainer": "", +"Palette": "", +"PaletteColor": "" } [application] @@ -43,6 +55,7 @@ config/Version="v0.5" [autoload] Global="*res://Scripts/Global.gd" +Import="*res://Scripts/Import.gd" [debug] @@ -198,7 +211,7 @@ redo_secondary={ [locale] -translations=PoolStringArray( "res://Translations/#Translations.en.translation", "res://Translations/#Translations.el.translation", "res://Translations/#Translations.fr.translation", "res://Translations/#Translations.de.translation", "res://Translations/#Translations.pl.translation", "res://Translations/#Translations.ru.translation", "res://Translations/#Translations.zh_TW.translation", "res://Translations/#Translations.pt_BR.translation" ) +translations=PoolStringArray( "res://Translations/#Translations.en.translation", "res://Translations/#Translations.el.translation", "res://Translations/#Translations.fr.translation", "res://Translations/#Translations.de.translation", "res://Translations/#Translations.pl.translation", "res://Translations/#Translations.ru.translation", "res://Translations/#Translations.zh_TW.translation" ) locale_filter=[ 0, [ ] ] [rendering]