1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-13 17:23:08 +00:00

Compare commits

...

2 commits

Author SHA1 Message Date
Emmanouil Papadeas 7eeb0b0cba Add a clear recently open file list option 2024-10-10 00:42:40 +03:00
Emmanouil Papadeas 2f24508dea Add a new Reset category in the Preferences 2024-10-09 21:20:17 +03:00
7 changed files with 179 additions and 8 deletions

View file

@ -2482,6 +2482,26 @@ msgstr ""
msgid "A default background color of a new image" msgid "A default background color of a new image"
msgstr "" msgstr ""
#. Found in the preferences, under the Reset category.
msgid "Reset all options available in the Preferences"
msgstr ""
#. Found in the preferences, under the Reset category.
msgid "Reset timeline options"
msgstr ""
#. Found in the preferences, under the Reset category.
msgid "Reset all tool options"
msgstr ""
#. Found in the preferences, under the Reset category.
msgid "Remove all extensions"
msgstr ""
#. Found in the preferences, under the Reset category.
msgid "Clear the recently opened file list"
msgstr ""
msgid "Lock aspect ratio" msgid "Lock aspect ratio"
msgstr "" msgstr ""

View file

@ -1,7 +1,9 @@
# gdlint: ignore=max-public-methods
extends Node extends Node
signal color_changed(color: Color, button: int) signal color_changed(color: Color, button: int)
signal flip_rotated(flip_x, flip_y, rotate_90, rotate_180, rotate_270) signal flip_rotated(flip_x, flip_y, rotate_90, rotate_180, rotate_270)
signal options_reset
enum Dynamics { NONE, PRESSURE, VELOCITY } enum Dynamics { NONE, PRESSURE, VELOCITY }
@ -315,6 +317,7 @@ class Slot:
func _ready() -> void: func _ready() -> void:
options_reset.connect(reset_options)
Global.cel_switched.connect(_cel_switched) Global.cel_switched.connect(_cel_switched)
_tool_buttons = Global.control.find_child("ToolButtons") _tool_buttons = Global.control.find_child("ToolButtons")
for t in tools: for t in tools:
@ -370,6 +373,12 @@ func _ready() -> void:
_show_relevant_tools(layer_type) _show_relevant_tools(layer_type)
func reset_options() -> void:
default_color()
assign_tool(get_tool(MOUSE_BUTTON_LEFT).tool_node.name, MOUSE_BUTTON_LEFT, true)
assign_tool(get_tool(MOUSE_BUTTON_RIGHT).tool_node.name, MOUSE_BUTTON_RIGHT, true)
func add_tool_button(t: Tool, insert_pos := -1) -> void: func add_tool_button(t: Tool, insert_pos := -1) -> void:
var tool_button: BaseButton = _tool_button_scene.instantiate() var tool_button: BaseButton = _tool_button_scene.instantiate()
tool_button.name = t.name tool_button.name = t.name
@ -414,12 +423,16 @@ func set_tool(tool_name: String, button: int) -> void:
_right_tools_per_layer_type[_curr_layer_type] = tool_name _right_tools_per_layer_type[_curr_layer_type] = tool_name
func assign_tool(tool_name: String, button: int) -> void: func get_tool(button: int) -> Slot:
return _slots[button]
func assign_tool(tool_name: String, button: int, allow_refresh := false) -> void:
var slot: Slot = _slots[button] var slot: Slot = _slots[button]
var panel: Node = _panels[button] var panel: Node = _panels[button]
if slot.tool_node != null: if slot.tool_node != null:
if slot.tool_node.name == tool_name: if slot.tool_node.name == tool_name and not allow_refresh:
return return
panel.remove_child(slot.tool_node) panel.remove_child(slot.tool_node)
slot.tool_node.queue_free() slot.tool_node.queue_free()

View file

@ -198,6 +198,7 @@ var selected_item := 0
@onready var list: ItemList = $HSplitContainer/List @onready var list: ItemList = $HSplitContainer/List
@onready var right_side: VBoxContainer = $"%RightSide" @onready var right_side: VBoxContainer = $"%RightSide"
@onready var language: VBoxContainer = %Language @onready var language: VBoxContainer = %Language
@onready var system_language := language.get_node(^"System Language") as CheckBox
@onready var autosave_container: Container = right_side.get_node("Backup/AutosaveContainer") @onready var autosave_container: Container = right_side.get_node("Backup/AutosaveContainer")
@onready var autosave_interval: SpinBox = autosave_container.get_node("AutosaveInterval") @onready var autosave_interval: SpinBox = autosave_container.get_node("AutosaveInterval")
@onready var themes: BoxContainer = right_side.get_node("Interface/Themes") @onready var themes: BoxContainer = right_side.get_node("Interface/Themes")
@ -252,6 +253,7 @@ func _ready() -> void:
startup.queue_free() startup.queue_free()
right_side.get_node(^"Language").visible = true right_side.get_node(^"Language").visible = true
Global.open_last_project = false Global.open_last_project = false
%ClearRecentFiles.hide()
if OS.get_name() == "Windows": if OS.get_name() == "Windows":
tablet_driver_label.visible = true tablet_driver_label.visible = true
tablet_driver.visible = true tablet_driver.visible = true
@ -271,7 +273,6 @@ func _ready() -> void:
content_list.append(child.name) content_list.append(child.name)
# Create buttons for each language # Create buttons for each language
var system_language := language.get_node(^"System Language") as Button
var button_group: ButtonGroup = system_language.button_group var button_group: ButtonGroup = system_language.button_group
for locale in Global.loaded_locales: # Create radiobuttons for each language for locale in Global.loaded_locales: # Create radiobuttons for each language
var button := CheckBox.new() var button := CheckBox.new()
@ -424,3 +425,51 @@ func _on_language_pressed(index: int) -> void:
Tools.update_hint_tooltips() Tools.update_hint_tooltips()
list.clear() list.clear()
add_tabs(true) add_tabs(true)
func _on_reset_button_pressed() -> void:
$ResetOptionsConfirmation.popup_centered()
func _on_reset_options_confirmation_confirmed() -> void:
# Clear preferences
if %ResetPreferences.button_pressed:
system_language.button_pressed = true
_on_language_pressed(0)
themes.buttons_container.get_child(0).button_pressed = true
Themes.change_theme(0)
for pref in preferences:
var property_name := pref.prop_name
var default_value = pref.default_value
var node := right_side.get_node(pref.node_path)
if is_instance_valid(node):
node.set(pref.value_type, default_value)
Global.set(property_name, default_value)
_on_shrink_apply_button_pressed()
_on_font_size_apply_button_pressed()
Global.config_cache.erase_section("preferences")
# Clear timeline options
if %ResetTimelineOptions.button_pressed:
Global.animation_timeline.reset_settings()
Global.config_cache.erase_section("timeline")
# Clear tool options
if %ResetAllToolOptions.button_pressed:
Global.config_cache.erase_section("color_picker")
Global.config_cache.erase_section("tools")
Global.config_cache.erase_section("left_tool")
Global.config_cache.erase_section("right_tool")
Tools.options_reset.emit()
# Remove all extensions
if %RemoveAllExtensions.button_pressed:
var extensions_node := Global.control.get_node("Extensions") as Extensions
var extensions_list := extensions_node.extensions.duplicate()
for extension in extensions_list:
extensions_node.uninstall_extension(extension)
Global.config_cache.erase_section("extensions")
# Clear recent files list
if %ClearRecentFiles.button_pressed:
Global.config_cache.erase_section_key("data", "last_project_path")
Global.config_cache.erase_section_key("data", "recent_projects")
Global.top_menu_container.recent_projects_submenu.clear()
Global.config_cache.save(Global.CONFIG_PATH)

View file

@ -1344,6 +1344,59 @@ tooltip_text = "A default background color of a new image"
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
color = Color(0, 0, 0, 0) color = Color(0, 0, 0, 0)
[node name="Reset" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide"]
visible = false
layout_mode = 2
[node name="ResetHeader" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Reset"]
layout_mode = 2
theme_override_constants/separation = 0
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Reset/ResetHeader"]
layout_mode = 2
theme_type_variation = &"HeaderSmall"
text = "Reset"
[node name="HSeparator" type="HSeparator" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Reset/ResetHeader"]
layout_mode = 2
size_flags_horizontal = 3
[node name="ResetPreferences" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Reset"]
unique_name_in_owner = true
layout_mode = 2
mouse_default_cursor_shape = 2
button_pressed = true
text = "Reset all options available in the Preferences"
[node name="ResetTimelineOptions" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Reset"]
unique_name_in_owner = true
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Reset timeline options"
[node name="ResetAllToolOptions" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Reset"]
unique_name_in_owner = true
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Reset all tool options"
[node name="RemoveAllExtensions" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Reset"]
unique_name_in_owner = true
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Remove all extensions"
[node name="ClearRecentFiles" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Reset"]
unique_name_in_owner = true
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Clear the recently opened file list"
[node name="ResetButton" type="Button" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Reset"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Reset"
[node name="MustRestart" type="HBoxContainer" parent="HSplitContainer/VBoxContainer"] [node name="MustRestart" type="HBoxContainer" parent="HSplitContainer/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
visible = false visible = false
@ -1379,6 +1432,9 @@ ok_button_text = "Delete Permanently"
dialog_text = "Are you sure you want to delete this extension?" dialog_text = "Are you sure you want to delete this extension?"
dialog_autowrap = true dialog_autowrap = true
[node name="ResetOptionsConfirmation" type="ConfirmationDialog" parent="."]
dialog_text = "Are you sure you want to reset the selected options? There will be no way to undo this."
[connection signal="about_to_popup" from="." to="." method="_on_PreferencesDialog_about_to_show"] [connection signal="about_to_popup" from="." to="." method="_on_PreferencesDialog_about_to_show"]
[connection signal="visibility_changed" from="." to="." method="_on_PreferencesDialog_visibility_changed"] [connection signal="visibility_changed" from="." to="." method="_on_PreferencesDialog_visibility_changed"]
[connection signal="item_selected" from="HSplitContainer/List" to="." method="_on_List_item_selected"] [connection signal="item_selected" from="HSplitContainer/List" to="." method="_on_List_item_selected"]
@ -1392,6 +1448,8 @@ dialog_autowrap = true
[connection signal="pressed" from="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions/HBoxContainer/EnableButton" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_EnableButton_pressed"] [connection signal="pressed" from="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions/HBoxContainer/EnableButton" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_EnableButton_pressed"]
[connection signal="pressed" from="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions/HBoxContainer/UninstallButton" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_UninstallButton_pressed"] [connection signal="pressed" from="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions/HBoxContainer/UninstallButton" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_UninstallButton_pressed"]
[connection signal="pressed" from="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions/HBoxContainer/OpenFolderButton" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_OpenFolderButton_pressed"] [connection signal="pressed" from="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions/HBoxContainer/OpenFolderButton" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_OpenFolderButton_pressed"]
[connection signal="pressed" from="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Reset/ResetButton" to="." method="_on_reset_button_pressed"]
[connection signal="files_selected" from="AddExtensionFileDialog" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_AddExtensionFileDialog_files_selected"] [connection signal="files_selected" from="AddExtensionFileDialog" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_AddExtensionFileDialog_files_selected"]
[connection signal="confirmed" from="DeleteExtensionConfirmation" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_delete_confirmation_confirmed"] [connection signal="confirmed" from="DeleteExtensionConfirmation" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_delete_confirmation_confirmed"]
[connection signal="custom_action" from="DeleteExtensionConfirmation" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_delete_confirmation_custom_action"] [connection signal="custom_action" from="DeleteExtensionConfirmation" to="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Extensions" method="_on_delete_confirmation_custom_action"]
[connection signal="confirmed" from="ResetOptionsConfirmation" to="." method="_on_reset_options_confirmation_confirmed"]

View file

@ -21,6 +21,7 @@ var color_sliders_vbox: VBoxContainer
func _ready() -> void: func _ready() -> void:
Tools.options_reset.connect(reset_options)
Tools.color_changed.connect(update_color) Tools.color_changed.connect(update_color)
_average(left_color_rect.color, right_color_rect.color) _average(left_color_rect.color, right_color_rect.color)
color_picker.color_mode = Global.config_cache.get_value( color_picker.color_mode = Global.config_cache.get_value(
@ -121,6 +122,12 @@ func _on_left_color_button_toggled(toggled_on: bool) -> void:
_average(left_color_rect.color, right_color_rect.color) _average(left_color_rect.color, right_color_rect.color)
func reset_options() -> void:
color_picker.color_mode = ColorPicker.MODE_RGB
color_picker.picker_shape = ColorPicker.SHAPE_HSV_RECTANGLE
expand_button.button_pressed = false
func update_color(color: Color, button: int) -> void: func update_color(color: Color, button: int) -> void:
if Tools.picking_color_for == button: if Tools.picking_color_for == button:
color_picker.color = color color_picker.color = color

View file

@ -10,11 +10,20 @@ extends PanelContainer
func _ready() -> void: func _ready() -> void:
Tools.options_reset.connect(reset_options)
# Resize tools panel when window gets resized # Resize tools panel when window gets resized
get_tree().get_root().size_changed.connect(_on_resized) get_tree().get_root().size_changed.connect(_on_resized)
horizontal_mirror.button_pressed = Tools.horizontal_mirror horizontal_mirror.button_pressed = Tools.horizontal_mirror
vertical_mirror.button_pressed = Tools.vertical_mirror vertical_mirror.button_pressed = Tools.vertical_mirror
pixel_perfect.button_pressed = Tools.pixel_perfect pixel_perfect.button_pressed = Tools.pixel_perfect
alpha_lock.button_pressed = Tools.alpha_locked
func reset_options() -> void:
horizontal_mirror.button_pressed = false
vertical_mirror.button_pressed = false
pixel_perfect.button_pressed = false
alpha_lock.button_pressed = false
func _on_resized() -> void: func _on_resized() -> void:

View file

@ -7,7 +7,7 @@ const FRAME_BUTTON_TSCN := preload("res://src/UI/Timeline/FrameButton.tscn")
const LAYER_FX_SCENE_PATH := "res://src/UI/Timeline/LayerEffects/LayerEffectsSettings.tscn" const LAYER_FX_SCENE_PATH := "res://src/UI/Timeline/LayerEffects/LayerEffectsSettings.tscn"
var is_animation_running := false var is_animation_running := false
var animation_loop := 1 ## 0 is no loop, 1 is cycle loop, 2 is ping-pong loop var animation_loop := 1 ## 0 is no loop, 1 is cycle loop, 2 is ping-pong loop.
var animation_forward := true var animation_forward := true
var first_frame := 0 var first_frame := 0
var last_frame := 0 var last_frame := 0
@ -28,7 +28,7 @@ var global_layer_visibility := true
var global_layer_lock := false var global_layer_lock := false
var global_layer_expand := true var global_layer_expand := true
@onready var old_scroll := 0 ## The previous scroll state of $ScrollContainer @onready var old_scroll := 0 ## The previous scroll state of $ScrollContainer.
@onready var tag_spacer := %TagSpacer as Control @onready var tag_spacer := %TagSpacer as Control
@onready var layer_settings_container := %LayerSettingsContainer as VBoxContainer @onready var layer_settings_container := %LayerSettingsContainer as VBoxContainer
@onready var layer_container := %LayerContainer as VBoxContainer @onready var layer_container := %LayerContainer as VBoxContainer
@ -72,7 +72,7 @@ func _ready() -> void:
Global.animation_timer.wait_time = 1 / Global.current_project.fps Global.animation_timer.wait_time = 1 / Global.current_project.fps
fps_spinbox.value = Global.current_project.fps fps_spinbox.value = Global.current_project.fps
_fill_blend_modes_option_button() _fill_blend_modes_option_button()
# Config loading # Config loading.
layer_frame_h_split.split_offset = Global.config_cache.get_value("timeline", "layer_size", 0) layer_frame_h_split.split_offset = Global.config_cache.get_value("timeline", "layer_size", 0)
layer_frame_header_h_split.split_offset = layer_frame_h_split.split_offset layer_frame_header_h_split.split_offset = layer_frame_h_split.split_offset
cel_size = Global.config_cache.get_value("timeline", "cel_size", cel_size) # Call setter cel_size = Global.config_cache.get_value("timeline", "cel_size", cel_size) # Call setter
@ -94,13 +94,13 @@ func _ready() -> void:
var onion_skinning_opacity = Global.config_cache.get_value( var onion_skinning_opacity = Global.config_cache.get_value(
"timeline", "onion_skinning_opacity", 0.6 "timeline", "onion_skinning_opacity", 0.6
) )
get_node("%OnionSkinningOpacity").value = onion_skinning_opacity * 100.0 %OnionSkinningOpacity.value = onion_skinning_opacity * 100.0
%PastOnionSkinning.value = past_rate %PastOnionSkinning.value = past_rate
%FutureOnionSkinning.value = future_rate %FutureOnionSkinning.value = future_rate
%BlueRedMode.button_pressed = blue_red %BlueRedMode.button_pressed = blue_red
%PastPlacement.select(0 if past_above else 1) %PastPlacement.select(0 if past_above else 1)
%FuturePlacement.select(0 if future_above else 1) %FuturePlacement.select(0 if future_above else 1)
# emit signals that were supposed to be emitted (Check if it's still required in godot 4) # Emit signals that were supposed to be emitted.
%PastPlacement.item_selected.emit(0 if past_above else 1) %PastPlacement.item_selected.emit(0 if past_above else 1)
%FuturePlacement.item_selected.emit(0 if future_above else 1) %FuturePlacement.item_selected.emit(0 if future_above else 1)
Global.cel_switched.connect(_cel_switched) Global.cel_switched.connect(_cel_switched)
@ -140,6 +140,21 @@ func _input(event: InputEvent) -> void:
cel_size += (2 * int(event.is_action("zoom_in")) - 2 * int(event.is_action("zoom_out"))) cel_size += (2 * int(event.is_action("zoom_in")) - 2 * int(event.is_action("zoom_out")))
func reset_settings() -> void:
cel_size = 36
%OnionSkinningOpacity.value = 60.0
%PastOnionSkinning.value = 1
%FutureOnionSkinning.value = 1
%BlueRedMode.button_pressed = false
%PastPlacement.select(0)
%FuturePlacement.select(0)
%PastPlacement.item_selected.emit(0)
%FuturePlacement.item_selected.emit(0)
for onion_skinning_node: Node2D in get_tree().get_nodes_in_group("canvas_onion_skinning"):
onion_skinning_node.opacity = 0.6
onion_skinning_node.queue_redraw()
func _get_minimum_size() -> Vector2: func _get_minimum_size() -> Vector2:
# X targets enough to see layers, 1 frame, vertical scrollbar, and padding # X targets enough to see layers, 1 frame, vertical scrollbar, and padding
# Y targets enough to see 1 layer # Y targets enough to see 1 layer