mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Palettes now get loaded from the root directory instead of user://
Folders "Brushes", "Palette" and "Palette/Custom" now get created if they don't exist (tested on Windows export). Also, the palettes don't need the Default palette to work anymore, and Default along with bubblegum16 aren't copied to the Palette folder now.
This commit is contained in:
parent
ef879882d6
commit
870cf8940d
|
@ -39,6 +39,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- The UI darkens when exiting the application (Thanks to Calinou)
|
||||
- The bucket tool's "paint all pixels with the same color" now gets limited to the selection, if there is any.
|
||||
- If the alpha on the color picker is at 0 and any of the other RGB values change, alpha becomes 1. (Issue #54)
|
||||
- The Brushes folder now gets created if it doesn't exist (tested on Windows)
|
||||
|
||||
### Fixed
|
||||
- UndoRedo leak (issue #34) (Thanks to qarmin)
|
||||
|
|
0
Palettes/.gdignore
Normal file
0
Palettes/.gdignore
Normal file
1
Palettes/Complementary.json
Normal file
1
Palettes/Complementary.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"name":"Complementary","colors":[{"data":"ffb35102","name":"no name"},{"data":"ffff9945","name":"no name"},{"data":"ffff7100","name":"no name"},{"data":"ff0099b3","name":"no name"},{"data":"ff00daff","name":"no name"},{"data":"ffb30202","name":"no name"},{"data":"ffff4545","name":"no name"},{"data":"ffff0201","name":"no name"},{"data":"ff00b333","name":"no name"},{"data":"ff00ff48","name":"no name"},{"data":"ff8002b3","name":"no name"},{"data":"ffca45ff","name":"no name"},{"data":"ffb400fe","name":"no name"},{"data":"ff7fb300","name":"no name"},{"data":"ffb5ff00","name":"no name"},{"data":"ff0211b3","name":"no name"},{"data":"ff4554ff","name":"no name"},{"data":"ff0116ff","name":"no name"},{"data":"ffb38c00","name":"no name"},{"data":"ffffc900","name":"no name"},{"data":"ff029eb3","name":"no name"},{"data":"ff7af0ff","name":"no name"},{"data":"ff00e1ff","name":"no name"},{"data":"ffb34d00","name":"no name"},{"data":"ffff6f00","name":"no name"}],"comments":"","editable":true}
|
1
Palettes/Monochromatic.json
Normal file
1
Palettes/Monochromatic.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"name":"Monochromatic","colors":[{"data":"ff323880","name":"no name"},{"data":"ffb0b7ff","name":"no name"},{"data":"ff636fff","name":"no name"},{"data":"ff4d5182","name":"no name"},{"data":"ff505acc","name":"no name"},{"data":"ff347685","name":"no name"},{"data":"ffb0f1ff","name":"no name"},{"data":"ff63e2ff","name":"no name"},{"data":"ff487985","name":"no name"},{"data":"ff50b5cc","name":"no name"},{"data":"ff40852c","name":"no name"},{"data":"ffadff94","name":"no name"},{"data":"ff7cff54","name":"no name"},{"data":"ff228a03","name":"no name"},{"data":"ff64cc43","name":"no name"},{"data":"ff857f1c","name":"no name"},{"data":"fffffba8","name":"no name"},{"data":"fffff536","name":"no name"},{"data":"ff8a863b","name":"no name"},{"data":"ffccc32b","name":"no name"},{"data":"ff854d15","name":"no name"},{"data":"ffffcd9c","name":"no name"},{"data":"ffff9429","name":"no name"},{"data":"ff8a5f34","name":"no name"},{"data":"ffcc7520","name":"no name"},{"data":"ff57100a","name":"no name"},{"data":"ffeb2d1c","name":"no name"},{"data":"ffd12617","name":"no name"},{"data":"ff5c120b","name":"no name"},{"data":"ff9e1d11","name":"no name"},{"data":"ff521157","name":"no name"},{"data":"ffde31eb","name":"no name"},{"data":"ffc62ad1","name":"no name"},{"data":"ff57135c","name":"no name"},{"data":"ff96209e","name":"no name"},{"data":"ff141414","name":"no name"},{"data":"ffababab","name":"no name"},{"data":"ff6e6e6e","name":"no name"},{"data":"ff2d2d2d","name":"no name"},{"data":"ff616161","name":"no name"}],"comments":"","editable":true}
|
1
Palettes/Shades.json
Normal file
1
Palettes/Shades.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"name":"Shades","colors":[{"data":"ffc25400","name":"no name"},{"data":"ff803900","name":"no name"},{"data":"ffff7300","name":"no name"},{"data":"ff401d00","name":"no name"},{"data":"ffe66700","name":"no name"},{"data":"ffc20000","name":"no name"},{"data":"ff800000","name":"no name"},{"data":"ffff0000","name":"no name"},{"data":"ff400000","name":"no name"},{"data":"ffe60101","name":"no name"},{"data":"ff8800c2","name":"no name"},{"data":"ff590080","name":"no name"},{"data":"ffb300ff","name":"no name"},{"data":"ff2d0040","name":"no name"},{"data":"ffa200e5","name":"no name"},{"data":"ff0010c2","name":"no name"},{"data":"ff000b80","name":"no name"},{"data":"ff0015ff","name":"no name"},{"data":"ff000540","name":"no name"},{"data":"ff0114e6","name":"no name"},{"data":"ff00abc2","name":"no name"},{"data":"ff007180","name":"no name"},{"data":"ff00e1ff","name":"no name"},{"data":"ff003840","name":"no name"},{"data":"ff00cbe6","name":"no name"},{"data":"ff00c237","name":"no name"},{"data":"ff008024","name":"no name"},{"data":"ff00ff48","name":"no name"},{"data":"ff004012","name":"no name"},{"data":"ff00e641","name":"no name"},{"data":"ffb8c200","name":"no name"},{"data":"ff798000","name":"no name"},{"data":"fff2ff00","name":"no name"},{"data":"ff3d4000","name":"no name"},{"data":"ffdce600","name":"no name"}],"comments":"","editable":true}
|
1
Palettes/Triad.json
Normal file
1
Palettes/Triad.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"name":"Triad","colors":[{"data":"ff852c32","name":"no name"},{"data":"ffcc646b","name":"no name"},{"data":"ffe3df66","name":"no name"},{"data":"ff3c7899","name":"no name"},{"data":"ff386680","name":"no name"},{"data":"ff141a85","name":"no name"},{"data":"ff353cd1","name":"no name"},{"data":"ffe66930","name":"no name"},{"data":"ff409e18","name":"no name"},{"data":"ff3a851b","name":"no name"},{"data":"ff8a0500","name":"no name"},{"data":"ffd10600","name":"no name"},{"data":"ffdee609","name":"no name"},{"data":"ff105f9e","name":"no name"},{"data":"ff074c85","name":"no name"},{"data":"ff84168a","name":"no name"},{"data":"ffc942d1","name":"no name"},{"data":"ffe6bf40","name":"no name"},{"data":"ff239e85","name":"no name"},{"data":"ff248571","name":"no name"},{"data":"ff1e8a1a","name":"no name"},{"data":"ff4fd14a","name":"no name"},{"data":"ff6047e6","name":"no name"},{"data":"ff9e5a28","name":"no name"},{"data":"ff854f28","name":"no name"}],"comments":"","editable":true}
|
|
@ -2,6 +2,7 @@ extends Node
|
|||
|
||||
func import_brushes(path : String) -> void:
|
||||
var brushes_dir := Directory.new()
|
||||
brushes_dir.open(".")
|
||||
if !brushes_dir.dir_exists(path):
|
||||
brushes_dir.make_dir(path)
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
extends GridContainer
|
||||
|
||||
const palette_button = preload("res://Prefabs/PaletteButton.tscn");
|
||||
const palettes_path := "Palettes"
|
||||
const custom_palettes_path := "Palettes/Custom"
|
||||
|
||||
var current_palette = "Default"
|
||||
var from_palette : Palette
|
||||
|
@ -9,7 +11,7 @@ var from_palette : Palette
|
|||
func _ready() -> void:
|
||||
_load_palettes()
|
||||
|
||||
#Select default palette "Default"
|
||||
# Select default palette "Default"
|
||||
on_palette_select(current_palette)
|
||||
|
||||
func _clear_swatches() -> void:
|
||||
|
@ -29,9 +31,6 @@ func on_palette_select(palette_name : String) -> void:
|
|||
Global.remove_palette_button.disabled = false # Can remove if custom palette
|
||||
|
||||
_display_palette(palette)
|
||||
else: #Use default on fail
|
||||
current_palette = "Default"
|
||||
_display_palette(Global.palettes["Default"])
|
||||
|
||||
func on_new_empty_palette() -> void:
|
||||
Global.new_palette_dialog.window_title = "Create a new empty palette?"
|
||||
|
@ -85,7 +84,7 @@ func on_new_palette_confirmed() -> void:
|
|||
var new_palette_name : String = Global.new_palette_name_line_edit.text
|
||||
var result : String = create_new_palette(new_palette_name, from_palette)
|
||||
if not result.empty():
|
||||
Global.error_dialog.set_text(result);
|
||||
Global.error_dialog.set_text(result)
|
||||
Global.error_dialog.popup_centered()
|
||||
|
||||
func create_new_palette(name : String, _from_palette : Palette) -> String: # Returns empty string, else error string
|
||||
|
@ -142,22 +141,17 @@ func on_color_select(index : int) -> void:
|
|||
Global.update_right_custom_brush()
|
||||
|
||||
func _load_palettes() -> void:
|
||||
var file := File.new()
|
||||
var dir := Directory.new()
|
||||
dir.open(".")
|
||||
if not dir.dir_exists(palettes_path):
|
||||
dir.make_dir(palettes_path)
|
||||
if not dir.dir_exists(custom_palettes_path):
|
||||
dir.make_dir(custom_palettes_path)
|
||||
|
||||
if not dir.dir_exists("user://palettes"):
|
||||
dir.make_dir("user://palettes");
|
||||
if not dir.dir_exists("user://palettes/custom"):
|
||||
dir.make_dir("user://palettes/custom")
|
||||
if not file.file_exists("user://palettes/default_palette.json"):
|
||||
dir.copy("res://Assets/Graphics/Palette/default_palette.json","user://palettes/default_palette.json");
|
||||
if not file.file_exists("user://palettes/bubblegum16.json"):
|
||||
dir.copy("res://Assets/Graphics/Palette/bubblegum16.json","user://palettes/bubblegum16.json");
|
||||
|
||||
var palette_files : Array = get_palette_files("user://palettes")
|
||||
var palette_files : Array = get_palette_files(palettes_path)
|
||||
|
||||
for file_name in palette_files:
|
||||
var palette : Palette = Palette.new().load_from_file("user://palettes/" + file_name)
|
||||
var palette : Palette = Palette.new().load_from_file(palettes_path.plus_file(file_name))
|
||||
if palette:
|
||||
Global.palettes[palette.name] = palette
|
||||
Global.palette_option_button.add_item(palette.name)
|
||||
|
@ -166,17 +160,20 @@ func _load_palettes() -> void:
|
|||
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")
|
||||
dir.open(custom_palettes_path)
|
||||
var custom_palette_files : Array = get_palette_files(custom_palettes_path)
|
||||
|
||||
for file_name in custom_palette_files:
|
||||
var palette : Palette = Palette.new().load_from_file("user://palettes/custom/" + file_name)
|
||||
var palette : Palette = Palette.new().load_from_file(custom_palettes_path.plus_file(file_name))
|
||||
if palette:
|
||||
Global.palettes[palette.name] = palette
|
||||
Global.palette_option_button.add_item(palette.name)
|
||||
var index: int = Global.palette_option_button.get_item_count() - 1
|
||||
Global.palette_option_button.set_item_metadata(index, palette.name)
|
||||
|
||||
if not "Default" in Global.palettes && Global.palettes.size() > 0:
|
||||
Global.control._on_PaletteOptionButton_item_selected(0)
|
||||
|
||||
func get_palette_files(path : String) -> Array:
|
||||
var dir := Directory.new()
|
||||
var results = []
|
||||
|
@ -207,9 +204,9 @@ func remove_current_palette() -> void:
|
|||
|
||||
func _delete_palette_file(file_name : String) -> void:
|
||||
var dir = Directory.new()
|
||||
dir.remove("user://palettes/custom/" + file_name)
|
||||
dir.remove(custom_palettes_path.plus_file(file_name))
|
||||
|
||||
func save_palette(palette_name : String, filename : String) -> void:
|
||||
var palette = Global.palettes[palette_name]
|
||||
|
||||
palette.save_to_file("user://palettes/custom/" + filename)
|
||||
palette.save_to_file(custom_palettes_path.plus_file(filename))
|
||||
|
|
Loading…
Reference in a new issue