mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Add a new Reset category in the Preferences
This commit is contained in:
parent
0551b23a19
commit
2f24508dea
|
@ -2482,6 +2482,22 @@ msgstr ""
|
|||
msgid "A default background color of a new image"
|
||||
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 ""
|
||||
|
||||
msgid "Lock aspect ratio"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# gdlint: ignore=max-public-methods
|
||||
extends Node
|
||||
|
||||
signal color_changed(color: Color, button: int)
|
||||
signal flip_rotated(flip_x, flip_y, rotate_90, rotate_180, rotate_270)
|
||||
signal options_reset
|
||||
|
||||
enum Dynamics { NONE, PRESSURE, VELOCITY }
|
||||
|
||||
|
@ -315,6 +317,7 @@ class Slot:
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
options_reset.connect(reset_options)
|
||||
Global.cel_switched.connect(_cel_switched)
|
||||
_tool_buttons = Global.control.find_child("ToolButtons")
|
||||
for t in tools:
|
||||
|
@ -370,6 +373,12 @@ func _ready() -> void:
|
|||
_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:
|
||||
var tool_button: BaseButton = _tool_button_scene.instantiate()
|
||||
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
|
||||
|
||||
|
||||
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 panel: Node = _panels[button]
|
||||
|
||||
if slot.tool_node != null:
|
||||
if slot.tool_node.name == tool_name:
|
||||
if slot.tool_node.name == tool_name and not allow_refresh:
|
||||
return
|
||||
panel.remove_child(slot.tool_node)
|
||||
slot.tool_node.queue_free()
|
||||
|
|
|
@ -198,6 +198,7 @@ var selected_item := 0
|
|||
@onready var list: ItemList = $HSplitContainer/List
|
||||
@onready var right_side: VBoxContainer = $"%RightSide"
|
||||
@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_interval: SpinBox = autosave_container.get_node("AutosaveInterval")
|
||||
@onready var themes: BoxContainer = right_side.get_node("Interface/Themes")
|
||||
|
@ -271,7 +272,6 @@ func _ready() -> void:
|
|||
content_list.append(child.name)
|
||||
|
||||
# Create buttons for each language
|
||||
var system_language := language.get_node(^"System Language") as Button
|
||||
var button_group: ButtonGroup = system_language.button_group
|
||||
for locale in Global.loaded_locales: # Create radiobuttons for each language
|
||||
var button := CheckBox.new()
|
||||
|
@ -424,3 +424,46 @@ func _on_language_pressed(index: int) -> void:
|
|||
Tools.update_hint_tooltips()
|
||||
list.clear()
|
||||
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")
|
||||
|
||||
Global.config_cache.save(Global.CONFIG_PATH)
|
||||
|
|
|
@ -1344,6 +1344,53 @@ tooltip_text = "A default background color of a new image"
|
|||
mouse_default_cursor_shape = 2
|
||||
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="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"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
@ -1379,6 +1426,9 @@ ok_button_text = "Delete Permanently"
|
|||
dialog_text = "Are you sure you want to delete this extension?"
|
||||
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="visibility_changed" from="." to="." method="_on_PreferencesDialog_visibility_changed"]
|
||||
[connection signal="item_selected" from="HSplitContainer/List" to="." method="_on_List_item_selected"]
|
||||
|
@ -1392,6 +1442,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/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/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="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="confirmed" from="ResetOptionsConfirmation" to="." method="_on_reset_options_confirmation_confirmed"]
|
||||
|
|
|
@ -21,6 +21,7 @@ var color_sliders_vbox: VBoxContainer
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
Tools.options_reset.connect(reset_options)
|
||||
Tools.color_changed.connect(update_color)
|
||||
_average(left_color_rect.color, right_color_rect.color)
|
||||
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)
|
||||
|
||||
|
||||
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:
|
||||
if Tools.picking_color_for == button:
|
||||
color_picker.color = color
|
||||
|
|
|
@ -10,11 +10,20 @@ extends PanelContainer
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
Tools.options_reset.connect(reset_options)
|
||||
# Resize tools panel when window gets resized
|
||||
get_tree().get_root().size_changed.connect(_on_resized)
|
||||
horizontal_mirror.button_pressed = Tools.horizontal_mirror
|
||||
vertical_mirror.button_pressed = Tools.vertical_mirror
|
||||
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:
|
||||
|
|
|
@ -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"
|
||||
|
||||
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 first_frame := 0
|
||||
var last_frame := 0
|
||||
|
@ -28,7 +28,7 @@ var global_layer_visibility := true
|
|||
var global_layer_lock := false
|
||||
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 layer_settings_container := %LayerSettingsContainer 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
|
||||
fps_spinbox.value = Global.current_project.fps
|
||||
_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_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
|
||||
|
@ -94,13 +94,13 @@ func _ready() -> void:
|
|||
var onion_skinning_opacity = Global.config_cache.get_value(
|
||||
"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
|
||||
%FutureOnionSkinning.value = future_rate
|
||||
%BlueRedMode.button_pressed = blue_red
|
||||
%PastPlacement.select(0 if past_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)
|
||||
%FuturePlacement.item_selected.emit(0 if future_above else 1)
|
||||
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")))
|
||||
|
||||
|
||||
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:
|
||||
# X targets enough to see layers, 1 frame, vertical scrollbar, and padding
|
||||
# Y targets enough to see 1 layer
|
||||
|
|
Loading…
Reference in a new issue