mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-07 10:59:49 +00:00
Fixed issue where Brushes and Palettes wouldn't load if you opened Pixelorama from a file
It now uses "OS.get_executable_path().get_base_dir()" to find the root directory of Pixelorama, instead of just "."
This commit is contained in:
parent
9e7a3059f2
commit
a6d129526c
|
@ -68,7 +68,7 @@ func _on_AboutDialog_about_to_show() -> void:
|
||||||
translators.create_item(translators_root).set_text(0, " Andreev Andrei - " + tr("Russian"))
|
translators.create_item(translators_root).set_text(0, " Andreev Andrei - " + tr("Russian"))
|
||||||
translators.create_item(translators_root).set_text(0, " ax trifonov (ax34) - " + tr("Russian"))
|
translators.create_item(translators_root).set_text(0, " ax trifonov (ax34) - " + tr("Russian"))
|
||||||
translators.create_item(translators_root).set_text(0, " JunYouIntrovert - " + tr("Chinese Traditional"))
|
translators.create_item(translators_root).set_text(0, " JunYouIntrovert - " + tr("Chinese Traditional"))
|
||||||
translators.create_item(translators_root).set_text(0, " Chenxu Wang (wcxu21) - " + tr("Chinese Simplified"))
|
translators.create_item(translators_root).set_text(0, " Chenxu Wang - " + tr("Chinese Simplified"))
|
||||||
translators.create_item(translators_root).set_text(0, " Marco Galli (Gaarco) - " + tr("Italian"))
|
translators.create_item(translators_root).set_text(0, " Marco Galli (Gaarco) - " + tr("Italian"))
|
||||||
translators.create_item(translators_root).set_text(0, " azagaya - " + tr("Spanish"))
|
translators.create_item(translators_root).set_text(0, " azagaya - " + tr("Spanish"))
|
||||||
translators.create_item(translators_root).set_text(0, " Lilly And (KatieAnd) - " + tr("Spanish"))
|
translators.create_item(translators_root).set_text(0, " Lilly And (KatieAnd) - " + tr("Spanish"))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
var root_directory := "."
|
||||||
var config_cache := ConfigFile.new()
|
var config_cache := ConfigFile.new()
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
var loaded_locales : Array
|
var loaded_locales : Array
|
||||||
|
@ -243,6 +244,8 @@ var error_dialog : AcceptDialog
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
randomize()
|
randomize()
|
||||||
|
if OS.has_feature("standalone"):
|
||||||
|
root_directory = OS.get_executable_path().get_base_dir()
|
||||||
# Load settings from the config file
|
# Load settings from the config file
|
||||||
config_cache.load("user://cache.ini")
|
config_cache.load("user://cache.ini")
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ extends Node
|
||||||
|
|
||||||
func import_brushes(path : String) -> void:
|
func import_brushes(path : String) -> void:
|
||||||
var brushes_dir := Directory.new()
|
var brushes_dir := Directory.new()
|
||||||
brushes_dir.open(".")
|
brushes_dir.open(Global.root_directory)
|
||||||
if !brushes_dir.dir_exists(path):
|
if !brushes_dir.dir_exists(path):
|
||||||
brushes_dir.make_dir(path)
|
brushes_dir.make_dir(path)
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ func import_brushes(path : String) -> void:
|
||||||
func find_brushes(brushes_dir : Directory, path : String) -> Array:
|
func find_brushes(brushes_dir : Directory, path : String) -> Array:
|
||||||
var subdirectories := []
|
var subdirectories := []
|
||||||
var found_random_brush := 0
|
var found_random_brush := 0
|
||||||
|
path = Global.root_directory.plus_file(path)
|
||||||
brushes_dir.open(path)
|
brushes_dir.open(path)
|
||||||
brushes_dir.list_dir_begin(true)
|
brushes_dir.list_dir_begin(true)
|
||||||
var file := brushes_dir.get_next()
|
var file := brushes_dir.get_next()
|
||||||
|
|
|
@ -154,7 +154,6 @@ func _ready() -> void:
|
||||||
|
|
||||||
if OS.get_cmdline_args():
|
if OS.get_cmdline_args():
|
||||||
for arg in OS.get_cmdline_args():
|
for arg in OS.get_cmdline_args():
|
||||||
print(arg)
|
|
||||||
if arg.get_extension().to_lower() == "pxo":
|
if arg.get_extension().to_lower() == "pxo":
|
||||||
_on_OpenSprite_file_selected(arg)
|
_on_OpenSprite_file_selected(arg)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -101,7 +101,7 @@ func _on_EditPaletteSaveButton_pressed() -> void:
|
||||||
if palette_name_edit.text != current_palette:
|
if palette_name_edit.text != current_palette:
|
||||||
Global.palettes.erase(current_palette)
|
Global.palettes.erase(current_palette)
|
||||||
var dir := Directory.new()
|
var dir := Directory.new()
|
||||||
dir.open(".")
|
dir.open(Global.root_directory)
|
||||||
dir.rename("Palettes".plus_file(current_palette + ".json"), "Palettes".plus_file(palette_name_edit.text + ".json"))
|
dir.rename("Palettes".plus_file(current_palette + ".json"), "Palettes".plus_file(palette_name_edit.text + ".json"))
|
||||||
current_palette = palette_name_edit.text
|
current_palette = palette_name_edit.text
|
||||||
working_palette.name = current_palette
|
working_palette.name = current_palette
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
extends GridContainer
|
extends GridContainer
|
||||||
|
|
||||||
const palette_button = preload("res://Prefabs/PaletteButton.tscn");
|
const palette_button = preload("res://Prefabs/PaletteButton.tscn")
|
||||||
const palettes_path := "Palettes"
|
|
||||||
|
|
||||||
|
var palettes_path := "Palettes"
|
||||||
var current_palette = "Default"
|
var current_palette = "Default"
|
||||||
var from_palette : Palette
|
var from_palette : Palette
|
||||||
|
|
||||||
|
@ -150,8 +150,9 @@ func on_color_select(index : int) -> void:
|
||||||
Global.update_right_custom_brush()
|
Global.update_right_custom_brush()
|
||||||
|
|
||||||
func _load_palettes() -> void:
|
func _load_palettes() -> void:
|
||||||
|
palettes_path = Global.root_directory.plus_file(palettes_path)
|
||||||
var dir := Directory.new()
|
var dir := Directory.new()
|
||||||
dir.open(".")
|
dir.open(Global.root_directory)
|
||||||
if not dir.dir_exists(palettes_path):
|
if not dir.dir_exists(palettes_path):
|
||||||
dir.make_dir(palettes_path)
|
dir.make_dir(palettes_path)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue