mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-30 23:19:49 +00:00
Minor config file section key re-organization
This commit is contained in:
parent
377c24c981
commit
491d81f393
|
@ -258,7 +258,7 @@ func open_pxo_file(path: String, untitled_backup := false, replace_empty := true
|
|||
Global.main_window.title = path.get_file() + " - Pixelorama " + Global.current_version
|
||||
Global.save_sprites_dialog.current_path = path
|
||||
# Set last opened project path and save
|
||||
Global.config_cache.set_value("preferences", "last_project_path", path)
|
||||
Global.config_cache.set_value("data", "last_project_path", path)
|
||||
Global.config_cache.save("user://cache.ini")
|
||||
new_project.directory_path = path.get_base_dir()
|
||||
new_project.file_name = path.get_file().trim_suffix(".pxo")
|
||||
|
@ -420,7 +420,7 @@ func save_pxo_file(
|
|||
Global.main_window.title = path.get_file() + " - Pixelorama " + Global.current_version
|
||||
|
||||
# Set last opened project path and save
|
||||
Global.config_cache.set_value("preferences", "last_project_path", path)
|
||||
Global.config_cache.set_value("data", "last_project_path", path)
|
||||
Global.config_cache.save("user://cache.ini")
|
||||
if !project.was_exported:
|
||||
project.file_name = path.get_file().trim_suffix(".pxo")
|
||||
|
|
|
@ -329,9 +329,10 @@ func _ready() -> void:
|
|||
set_tool(tool_name, MOUSE_BUTTON_RIGHT)
|
||||
update_tool_buttons()
|
||||
|
||||
horizontal_mirror = Global.config_cache.get_value("preferences", "horizontal_mirror", false)
|
||||
vertical_mirror = Global.config_cache.get_value("preferences", "vertical_mirror", false)
|
||||
pixel_perfect = Global.config_cache.get_value("preferences", "pixel_perfect", false)
|
||||
horizontal_mirror = Global.config_cache.get_value("tools", "horizontal_mirror", false)
|
||||
vertical_mirror = Global.config_cache.get_value("tools", "vertical_mirror", false)
|
||||
pixel_perfect = Global.config_cache.get_value("tools", "pixel_perfect", false)
|
||||
alpha_locked = Global.config_cache.get_value("tools", "alpha_locked", false)
|
||||
|
||||
# Yield is necessary for the color picker nodes to update their color values
|
||||
await get_tree().process_frame
|
||||
|
|
|
@ -251,9 +251,9 @@ func load_last_project() -> void:
|
|||
if OS.get_name() == "Web":
|
||||
return
|
||||
# Check if any project was saved or opened last time
|
||||
if Global.config_cache.has_section_key("preferences", "last_project_path"):
|
||||
if Global.config_cache.has_section_key("data", "last_project_path"):
|
||||
# Check if file still exists on disk
|
||||
var file_path = Global.config_cache.get_value("preferences", "last_project_path")
|
||||
var file_path = Global.config_cache.get_value("data", "last_project_path")
|
||||
if FileAccess.file_exists(file_path): # If yes then load the file
|
||||
OpenSave.open_pxo_file(file_path)
|
||||
# Sync file dialogs
|
||||
|
|
|
@ -29,14 +29,14 @@ var tool_count := 0:
|
|||
func _ready() -> void:
|
||||
updated.connect(queue_redraw)
|
||||
Global.project_switched.connect(reset)
|
||||
mode = Global.config_cache.get_value("preferences", "crop_mode", 0)
|
||||
locked_size = Global.config_cache.get_value("preferences", "crop_locked_size", false)
|
||||
mode = Global.config_cache.get_value("tools", "crop_mode", 0)
|
||||
locked_size = Global.config_cache.get_value("tools", "crop_locked_size", false)
|
||||
reset()
|
||||
|
||||
|
||||
func _exit_tree():
|
||||
Global.config_cache.set_value("preferences", "crop_mode", mode)
|
||||
Global.config_cache.set_value("preferences", "crop_locked_size", locked_size)
|
||||
Global.config_cache.set_value("tools", "crop_mode", mode)
|
||||
Global.config_cache.set_value("tools", "crop_locked_size", locked_size)
|
||||
|
||||
|
||||
func _draw() -> void:
|
||||
|
|
|
@ -62,7 +62,7 @@ func _on_resized() -> void:
|
|||
|
||||
func _on_Horizontal_toggled(button_pressed: bool) -> void:
|
||||
Tools.horizontal_mirror = button_pressed
|
||||
Global.config_cache.set_value("preferences", "horizontal_mirror", button_pressed)
|
||||
Global.config_cache.set_value("tools", "horizontal_mirror", button_pressed)
|
||||
Global.show_y_symmetry_axis = button_pressed
|
||||
Global.current_project.y_symmetry_axis.visible = (
|
||||
Global.show_y_symmetry_axis and Global.show_guides
|
||||
|
@ -77,7 +77,7 @@ func _on_Horizontal_toggled(button_pressed: bool) -> void:
|
|||
|
||||
func _on_Vertical_toggled(button_pressed: bool) -> void:
|
||||
Tools.vertical_mirror = button_pressed
|
||||
Global.config_cache.set_value("preferences", "vertical_mirror", button_pressed)
|
||||
Global.config_cache.set_value("tools", "vertical_mirror", button_pressed)
|
||||
Global.show_x_symmetry_axis = button_pressed
|
||||
# If the button is not pressed but another button is, keep the symmetry guide visible
|
||||
Global.current_project.x_symmetry_axis.visible = (
|
||||
|
@ -93,7 +93,7 @@ func _on_Vertical_toggled(button_pressed: bool) -> void:
|
|||
|
||||
func _on_PixelPerfect_toggled(button_pressed: bool) -> void:
|
||||
Tools.pixel_perfect = button_pressed
|
||||
Global.config_cache.set_value("preferences", "pixel_perfect", button_pressed)
|
||||
Global.config_cache.set_value("tools", "pixel_perfect", button_pressed)
|
||||
var texture_button: TextureRect = pixel_perfect.get_node("TextureRect")
|
||||
var file_name := "pixel_perfect_on.png"
|
||||
if !button_pressed:
|
||||
|
@ -103,7 +103,7 @@ func _on_PixelPerfect_toggled(button_pressed: bool) -> void:
|
|||
|
||||
func _on_alpha_lock_toggled(toggled_on: bool) -> void:
|
||||
Tools.alpha_locked = toggled_on
|
||||
Global.config_cache.set_value("preferences", "alpha_locked", toggled_on)
|
||||
Global.config_cache.set_value("tools", "alpha_locked", toggled_on)
|
||||
var texture_button: TextureRect = alpha_lock.get_node("TextureRect")
|
||||
var file_name := "alpha_lock_on.png"
|
||||
if not toggled_on:
|
||||
|
|
|
@ -453,7 +453,7 @@ func _open_project_file() -> void:
|
|||
|
||||
|
||||
func _on_open_last_project_file_menu_option_pressed() -> void:
|
||||
if Global.config_cache.has_section_key("preferences", "last_project_path"):
|
||||
if Global.config_cache.has_section_key("data", "last_project_path"):
|
||||
Global.control.load_last_project()
|
||||
else:
|
||||
Global.error_dialog.set_text("You haven't saved or opened any project in Pixelorama yet!")
|
||||
|
|
Loading…
Reference in a new issue