2019-12-18 16:12:44 +00:00
|
|
|
extends AcceptDialog
|
|
|
|
|
2022-02-17 23:03:08 +00:00
|
|
|
# Array of Preference(s)
|
|
|
|
var preferences := [
|
|
|
|
Preference.new("open_last_project", "Startup/StartupContainer/OpenLastProject", "pressed"),
|
|
|
|
Preference.new("quit_confirmation", "Startup/StartupContainer/QuitConfirmation", "pressed"),
|
2022-10-03 16:28:47 +00:00
|
|
|
Preference.new("shrink", "%ShrinkSlider", "value"),
|
|
|
|
Preference.new("dim_on_popup", "Interface/InterfaceOptions/DimCheckBox", "pressed"),
|
2022-09-19 21:16:01 +00:00
|
|
|
Preference.new("icon_color_from", "Interface/ButtonOptions/IconColorOptionButton", "selected"),
|
|
|
|
Preference.new("custom_icon_color", "Interface/ButtonOptions/IconColorButton", "color"),
|
|
|
|
Preference.new("left_tool_color", "Interface/ButtonOptions/LeftToolColorButton", "color"),
|
|
|
|
Preference.new("right_tool_color", "Interface/ButtonOptions/RightToolColorButton", "color"),
|
2022-02-17 23:03:08 +00:00
|
|
|
Preference.new(
|
2022-09-19 21:16:01 +00:00
|
|
|
"tool_button_size", "Interface/ButtonOptions/ToolButtonSizeOptionButton", "selected"
|
2022-02-17 23:03:08 +00:00
|
|
|
),
|
|
|
|
Preference.new(
|
|
|
|
"show_left_tool_icon", "Cursors/CursorsContainer/LeftToolIconCheckbox", "pressed"
|
|
|
|
),
|
|
|
|
Preference.new(
|
|
|
|
"show_right_tool_icon", "Cursors/CursorsContainer/RightToolIconCheckbox", "pressed"
|
|
|
|
),
|
|
|
|
Preference.new(
|
|
|
|
"left_square_indicator_visible", "Cursors/CursorsContainer/LeftIndicatorCheckbox", "pressed"
|
|
|
|
),
|
|
|
|
Preference.new(
|
2021-11-25 12:48:30 +00:00
|
|
|
"right_square_indicator_visible",
|
2022-02-10 20:32:55 +00:00
|
|
|
"Cursors/CursorsContainer/RightIndicatorCheckbox",
|
2022-02-17 23:03:08 +00:00
|
|
|
"pressed"
|
|
|
|
),
|
|
|
|
Preference.new("native_cursors", "Cursors/CursorsContainer/NativeCursorsCheckbox", "pressed"),
|
|
|
|
Preference.new("cross_cursor", "Cursors/CursorsContainer/CrossCursorCheckbox", "pressed"),
|
|
|
|
Preference.new("autosave_interval", "Backup/AutosaveContainer/AutosaveInterval", "value"),
|
|
|
|
Preference.new("enable_autosave", "Backup/AutosaveContainer/EnableAutosave", "pressed"),
|
|
|
|
Preference.new("default_width", "Image/ImageOptions/ImageDefaultWidth", "value"),
|
|
|
|
Preference.new("default_height", "Image/ImageOptions/ImageDefaultHeight", "value"),
|
|
|
|
Preference.new("default_fill_color", "Image/ImageOptions/DefaultFillColor", "color"),
|
|
|
|
Preference.new("smooth_zoom", "Canvas/ZoomOptions/SmoothZoom", "pressed"),
|
2023-04-18 14:20:13 +00:00
|
|
|
Preference.new("snapping_distance", "Canvas/SnappingOptions/DistanceValue", "value"),
|
2022-02-17 23:03:08 +00:00
|
|
|
Preference.new("grid_type", "Canvas/GridOptions/GridType", "selected"),
|
2023-04-18 13:38:55 +00:00
|
|
|
Preference.new("grid_size", "Canvas/GridOptions/GridSizeValue", "value"),
|
|
|
|
Preference.new("isometric_grid_size", "Canvas/GridOptions/IsometricGridSizeValue", "value"),
|
|
|
|
Preference.new("grid_offset", "Canvas/GridOptions/GridOffsetValue", "value"),
|
2022-02-17 23:03:08 +00:00
|
|
|
Preference.new(
|
|
|
|
"grid_draw_over_tile_mode", "Canvas/GridOptions/GridDrawOverTileMode", "pressed"
|
|
|
|
),
|
|
|
|
Preference.new("grid_color", "Canvas/GridOptions/GridColor", "color"),
|
|
|
|
Preference.new("pixel_grid_show_at_zoom", "Canvas/PixelGridOptions/ShowAtZoom", "value"),
|
|
|
|
Preference.new("pixel_grid_color", "Canvas/PixelGridOptions/GridColor", "color"),
|
|
|
|
Preference.new("guide_color", "Canvas/GuideOptions/GuideColor", "color"),
|
|
|
|
Preference.new("checker_size", "Canvas/CheckerOptions/CheckerSizeValue", "value"),
|
|
|
|
Preference.new("checker_color_1", "Canvas/CheckerOptions/CheckerColor1", "color"),
|
|
|
|
Preference.new("checker_color_2", "Canvas/CheckerOptions/CheckerColor2", "color"),
|
|
|
|
Preference.new(
|
|
|
|
"checker_follow_movement", "Canvas/CheckerOptions/CheckerFollowMovement", "pressed"
|
|
|
|
),
|
|
|
|
Preference.new("checker_follow_scale", "Canvas/CheckerOptions/CheckerFollowScale", "pressed"),
|
|
|
|
Preference.new("tilemode_opacity", "Canvas/CheckerOptions/TileModeOpacity", "value"),
|
2022-09-09 23:58:13 +00:00
|
|
|
Preference.new("clear_color_from", "Canvas/BackgroundOptions/ColorOptionButton", "selected"),
|
|
|
|
Preference.new("modulate_clear_color", "Canvas/BackgroundOptions/BackgroundColor", "color"),
|
2022-02-17 23:03:08 +00:00
|
|
|
Preference.new("selection_animated_borders", "Selection/SelectionOptions/Animate", "pressed"),
|
|
|
|
Preference.new("selection_border_color_1", "Selection/SelectionOptions/BorderColor1", "color"),
|
|
|
|
Preference.new("selection_border_color_2", "Selection/SelectionOptions/BorderColor2", "color"),
|
|
|
|
Preference.new("fps_limit", "Performance/PerformanceContainer/SetFPSLimit", "value"),
|
|
|
|
Preference.new(
|
|
|
|
"pause_when_unfocused", "Performance/PerformanceContainer/PauseAppFocus", "pressed"
|
|
|
|
),
|
2022-11-29 17:58:24 +00:00
|
|
|
Preference.new(
|
|
|
|
"renderer", "Drivers/DriversContainer/Renderer", "selected", true, OS.VIDEO_DRIVER_GLES2
|
2022-11-29 19:10:49 +00:00
|
|
|
),
|
2022-11-30 00:09:06 +00:00
|
|
|
Preference.new("tablet_driver", "Drivers/DriversContainer/TabletDriver", "selected", true, 0)
|
2020-05-31 20:04:59 +00:00
|
|
|
]
|
2020-05-01 17:47:10 +00:00
|
|
|
|
2022-02-17 23:03:08 +00:00
|
|
|
var content_list := []
|
2020-06-25 19:27:08 +00:00
|
|
|
var selected_item := 0
|
2022-07-09 23:55:18 +00:00
|
|
|
var restore_default_button_tcsn := preload("res://src/Preferences/RestoreDefaultButton.tscn")
|
2020-06-25 19:27:08 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
onready var list: ItemList = $HSplitContainer/List
|
2022-11-29 17:58:24 +00:00
|
|
|
onready var right_side: VBoxContainer = $"%RightSide"
|
2022-02-17 23:03:08 +00:00
|
|
|
onready var autosave_container: Container = right_side.get_node("Backup/AutosaveContainer")
|
|
|
|
onready var autosave_interval: SpinBox = autosave_container.get_node("AutosaveInterval")
|
2022-10-03 16:28:47 +00:00
|
|
|
onready var shrink_slider: ValueSlider = $"%ShrinkSlider"
|
2021-11-25 12:48:30 +00:00
|
|
|
onready var themes: BoxContainer = right_side.get_node("Interface/Themes")
|
2022-09-20 16:39:15 +00:00
|
|
|
onready var shortcuts: Control = right_side.get_node("Shortcuts/ShortcutEdit")
|
2022-11-29 19:10:49 +00:00
|
|
|
onready var tablet_driver_label: Label = $"%TabletDriverLabel"
|
|
|
|
onready var tablet_driver: OptionButton = $"%TabletDriver"
|
Implement a basic extension system
Importing .pck or .zip Godot resource pack files into Pixelorama is now possible. This needs to be documented properly, but here's the basic idea, for now at least. This is super early work and I haven't tested it with a proper extension yet, so all of this could be a subject of change. I tested it with a custom theme extension though and it seems to be working perfectly.
Importing resource pack files, either by dragging and dropping them into the app window or by going to Edit>Preferences>Extensions>Add Extension, copies the files into user://extensions/. Extensions can be enabled/disabled and uninstalled. Uninstalling them deletes the resource pack files from user://extensions/.
The extension project source files need to be in a folder inside src/Extensions/ with the same name as the .pck or .zip file. **This is required for now, otherwise it will not work.** Inside that folder there also needs to be an extension.json file, with a structure similar to this:
{
"name": "ExtensionName",
"display_name": "Extension Name",
"description": "A Pixelorama extension",
"author": "Orama Interactive",
"version": "0.1",
"license": "MIT",
"nodes": [
"ExtensionExample.tscn"
]
}
The `nodes` array leads to the packed scene files with the nodes that are to be instantiated. **The root nodes of these scenes need to have the same name as the .tscn files they belong to.** The scripts of these nodes should have _enter_tree() and _exit_tree() methods to handle the extension enabling/disabling (or even uninstalling) logic. Note that .json files need to be included in the export options while exporting the extension from Godot.
Enabling an extension means that the scenes found in the extension.json's "nodes" array get instantiated, and disabling gets rid of these nodes from Pixelorama's SceneTree.
2022-02-19 01:21:08 +00:00
|
|
|
onready var extensions: BoxContainer = right_side.get_node("Extensions")
|
2022-11-29 17:58:24 +00:00
|
|
|
onready var must_restart: BoxContainer = $"%MustRestart"
|
2020-05-31 21:44:53 +00:00
|
|
|
|
|
|
|
|
2022-02-17 23:03:08 +00:00
|
|
|
class Preference:
|
|
|
|
var prop_name: String
|
|
|
|
var node_path: String
|
|
|
|
var value_type: String
|
2022-11-29 17:58:24 +00:00
|
|
|
var require_restart := false
|
2022-02-17 23:03:08 +00:00
|
|
|
var default_value
|
|
|
|
|
2022-11-29 17:58:24 +00:00
|
|
|
func _init(
|
|
|
|
_prop_name: String,
|
|
|
|
_node_path: String,
|
|
|
|
_value_type: String,
|
|
|
|
_require_restart := false,
|
|
|
|
_default_value = null
|
|
|
|
) -> void:
|
2022-02-17 23:03:08 +00:00
|
|
|
prop_name = _prop_name
|
|
|
|
node_path = _node_path
|
|
|
|
value_type = _value_type
|
2022-11-29 17:58:24 +00:00
|
|
|
require_restart = _require_restart
|
2022-11-30 00:09:06 +00:00
|
|
|
if _default_value != null:
|
2022-11-29 17:58:24 +00:00
|
|
|
default_value = _default_value
|
|
|
|
else:
|
|
|
|
default_value = Global.get(prop_name)
|
2022-02-17 23:03:08 +00:00
|
|
|
|
|
|
|
|
2019-12-20 14:36:23 +00:00
|
|
|
func _ready() -> void:
|
2021-11-25 12:48:30 +00:00
|
|
|
# Replace OK since preference changes are being applied immediately, not after OK confirmation
|
2022-09-22 13:40:53 +00:00
|
|
|
get_ok().text = "Close"
|
2022-11-29 17:58:24 +00:00
|
|
|
get_ok().size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
2022-10-03 16:28:47 +00:00
|
|
|
shrink_slider.value = Global.shrink # In case shrink is not equal to 1
|
Implement the Keychain Plugin (#700)
* Start implementing the godot_better_input plugin
* Update ShortcutEdit.gd
* Load & save preset option
* Add some groups and fix action events not being deleted on load
* Add MenuInputAction class for multiple menu accelerators
* Create a proper plugin and a BetterInput autoload
* Update menu accelerators
* Move settings to BetterInput
* Move menu enums to Global, make more MenuInputActions
* Add more menu events
* Add new groups
* Optimize BetterInput _input() method
* Remove a lot of lines of code
* Change some previous events, add ignore actions and a View menu group
* Change update_item_accelerator to update_ui
* Move MenuInputAction initialization to BetterInput.gd
* Update hint tooltips when a shortcut changes
Temporarily comment out some code regarding the configurable modifiers
* Some MenuInputAction variable name changes
* Add handle_input() to InputAction
* Update the shortcuts of buttons
* Fix shortcut selector menu position
* Change plugin name into Keychain
* Fix keyboard input dialog exiting when Enter or Space is being pressed
* Add two more groups
* Make groups folded by default
* Temporarily make tool modifier shortcuts not configurable
A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other.
* Add license for Keychain
* Fix issue where a key event would be added in other input types
* Fix bug where the assigned state was not updated when the dialog appeared again
* Update Main.tscn
* Add a disabled line edit in keyboard shortcut selector to grab focus
* Load presets in the Keychain autoload
This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene.
WARNING, this currently causes crashes if the menu items have no shortcut binded to them.
* Move custom settings away from Keychain.gd
To keep it the same as the upstream plugin
* Change menu enum names
* Made action_get_first_key() more general
* Use arrays for menu items instead of dictionaries, fixes crash
* Move moveable panels to Window menu
* Format
* Optimize hint tooltip updating
* Add support for translations in Keychain
* Translation changes
* Made tool modifiers configurable
Needs more testing.
* Made camera arrow key movement configurable & joypad axis support
This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level.
The right joypad analog stick is configured to move the camera by default.
* Rename presets into shortcut profiles, use Resources and let users create their own
* [skip ci] Update addons README
* Update Global.gd
2022-05-16 12:07:51 +00:00
|
|
|
|
|
|
|
for child in shortcuts.get_children():
|
|
|
|
if not child is AcceptDialog:
|
|
|
|
continue
|
|
|
|
child.connect("confirmed", Global, "update_hint_tooltips")
|
|
|
|
|
2022-02-17 23:03:08 +00:00
|
|
|
for child in right_side.get_children():
|
|
|
|
content_list.append(child.name)
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2020-06-25 20:25:46 +00:00
|
|
|
if OS.get_name() == "HTML5":
|
2022-02-17 23:03:08 +00:00
|
|
|
content_list.erase("Startup")
|
2020-07-28 22:54:15 +00:00
|
|
|
right_side.get_node("Startup").queue_free()
|
2022-02-17 23:03:08 +00:00
|
|
|
right_side.get_node("Language").visible = true
|
2020-06-25 20:25:46 +00:00
|
|
|
Global.open_last_project = false
|
2022-11-29 19:10:49 +00:00
|
|
|
elif OS.get_name() == "Windows":
|
|
|
|
tablet_driver_label.visible = true
|
|
|
|
tablet_driver.visible = true
|
|
|
|
for driver in OS.get_tablet_driver_count():
|
|
|
|
var driver_name := OS.get_tablet_driver_name(driver)
|
|
|
|
tablet_driver.add_item(driver_name, driver)
|
2020-06-25 20:25:46 +00:00
|
|
|
|
2020-05-31 20:04:59 +00:00
|
|
|
for pref in preferences:
|
2022-02-17 23:03:08 +00:00
|
|
|
var node: Node = right_side.get_node(pref.node_path)
|
2021-11-25 12:48:30 +00:00
|
|
|
var restore_default_button: BaseButton = restore_default_button_tcsn.instance()
|
2022-02-17 23:03:08 +00:00
|
|
|
restore_default_button.setting_name = pref.prop_name
|
|
|
|
restore_default_button.value_type = pref.value_type
|
|
|
|
restore_default_button.default_value = pref.default_value
|
2022-11-29 17:58:24 +00:00
|
|
|
restore_default_button.require_restart = pref.require_restart
|
2020-07-29 00:16:02 +00:00
|
|
|
restore_default_button.node = node
|
2022-10-03 16:28:47 +00:00
|
|
|
if pref.node_path == "%ShrinkSlider":
|
|
|
|
# Add the default button to the shrink slider's grandparent
|
|
|
|
var node_position := node.get_parent().get_index()
|
|
|
|
node.get_parent().get_parent().add_child(restore_default_button)
|
|
|
|
node.get_parent().get_parent().move_child(restore_default_button, node_position)
|
|
|
|
else:
|
|
|
|
var node_position := node.get_index()
|
|
|
|
node.get_parent().add_child(restore_default_button)
|
|
|
|
node.get_parent().move_child(restore_default_button, node_position)
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2022-02-17 23:03:08 +00:00
|
|
|
match pref.value_type:
|
2020-05-31 20:04:59 +00:00
|
|
|
"pressed":
|
2021-11-25 12:48:30 +00:00
|
|
|
node.connect(
|
2022-11-29 18:17:39 +00:00
|
|
|
"toggled", self, "_on_Preference_value_changed", [pref, restore_default_button]
|
2021-11-25 12:48:30 +00:00
|
|
|
)
|
2020-05-31 20:04:59 +00:00
|
|
|
"value":
|
2021-11-25 12:48:30 +00:00
|
|
|
node.connect(
|
|
|
|
"value_changed",
|
|
|
|
self,
|
|
|
|
"_on_Preference_value_changed",
|
2022-11-29 17:58:24 +00:00
|
|
|
[pref, restore_default_button]
|
2021-11-25 12:48:30 +00:00
|
|
|
)
|
2020-05-31 20:04:59 +00:00
|
|
|
"color":
|
|
|
|
node.get_picker().presets_visible = false
|
2021-11-25 12:48:30 +00:00
|
|
|
node.connect(
|
|
|
|
"color_changed",
|
|
|
|
self,
|
2022-11-29 18:17:39 +00:00
|
|
|
"_on_Preference_value_changed",
|
2022-11-29 17:58:24 +00:00
|
|
|
[pref, restore_default_button]
|
2021-11-25 12:48:30 +00:00
|
|
|
)
|
2020-05-31 20:04:59 +00:00
|
|
|
"selected":
|
2021-11-25 12:48:30 +00:00
|
|
|
node.connect(
|
|
|
|
"item_selected",
|
|
|
|
self,
|
2022-11-29 18:17:39 +00:00
|
|
|
"_on_Preference_value_changed",
|
2022-11-29 17:58:24 +00:00
|
|
|
[pref, restore_default_button]
|
2021-11-25 12:48:30 +00:00
|
|
|
)
|
2020-05-31 20:04:59 +00:00
|
|
|
|
2022-11-29 17:58:24 +00:00
|
|
|
var global_value = Global.get(pref.prop_name)
|
2022-02-17 23:03:08 +00:00
|
|
|
if Global.config_cache.has_section_key("preferences", pref.prop_name):
|
|
|
|
var value = Global.config_cache.get_value("preferences", pref.prop_name)
|
|
|
|
Global.set(pref.prop_name, value)
|
|
|
|
node.set(pref.value_type, value)
|
2022-11-29 18:17:39 +00:00
|
|
|
global_value = Global.get(pref.prop_name)
|
2020-04-11 02:36:51 +00:00
|
|
|
|
2020-07-29 00:16:02 +00:00
|
|
|
# This is needed because color_changed doesn't fire if the color changes in code
|
2023-04-18 13:38:55 +00:00
|
|
|
if typeof(value) == TYPE_VECTOR2 or typeof(value) == TYPE_COLOR:
|
2022-11-29 17:58:24 +00:00
|
|
|
preference_update(pref.prop_name, pref.require_restart)
|
2021-11-25 12:48:30 +00:00
|
|
|
disable_restore_default_button(
|
2022-02-17 23:03:08 +00:00
|
|
|
restore_default_button, global_value.is_equal_approx(pref.default_value)
|
2021-11-25 12:48:30 +00:00
|
|
|
)
|
2022-02-17 23:03:08 +00:00
|
|
|
elif pref.value_type == "selected":
|
2022-11-29 17:58:24 +00:00
|
|
|
preference_update(pref.prop_name, pref.require_restart)
|
2021-11-25 12:48:30 +00:00
|
|
|
disable_restore_default_button(
|
2022-02-17 23:03:08 +00:00
|
|
|
restore_default_button, global_value == pref.default_value
|
2021-11-25 12:48:30 +00:00
|
|
|
)
|
2022-11-29 17:58:24 +00:00
|
|
|
else:
|
|
|
|
node.set(pref.value_type, global_value)
|
|
|
|
disable_restore_default_button(
|
|
|
|
restore_default_button, global_value == pref.default_value
|
|
|
|
)
|
2020-07-29 00:16:02 +00:00
|
|
|
|
2020-02-11 17:45:36 +00:00
|
|
|
|
2022-11-29 18:17:39 +00:00
|
|
|
func _on_Preference_value_changed(value, pref: Preference, restore_default: BaseButton) -> void:
|
2022-11-29 17:58:24 +00:00
|
|
|
var prop := pref.prop_name
|
|
|
|
var default_value = pref.default_value
|
2020-05-31 20:04:59 +00:00
|
|
|
Global.set(prop, value)
|
2022-11-29 17:58:24 +00:00
|
|
|
if not pref.require_restart:
|
|
|
|
Global.config_cache.set_value("preferences", prop, value)
|
|
|
|
preference_update(prop, pref.require_restart)
|
2022-11-29 18:17:39 +00:00
|
|
|
var disable: bool = Global.get(prop) == default_value
|
|
|
|
if typeof(value) == TYPE_COLOR:
|
|
|
|
disable = Global.get(prop).is_equal_approx(default_value)
|
|
|
|
disable_restore_default_button(restore_default, disable)
|
2020-04-20 16:12:22 +00:00
|
|
|
|
2020-05-31 20:04:59 +00:00
|
|
|
|
2022-11-29 17:58:24 +00:00
|
|
|
func preference_update(prop: String, require_restart := false) -> void:
|
|
|
|
if require_restart:
|
|
|
|
must_restart.visible = true
|
|
|
|
return
|
2020-05-31 20:04:59 +00:00
|
|
|
if prop in ["autosave_interval", "enable_autosave"]:
|
|
|
|
OpenSave.update_autosave()
|
2020-07-28 22:54:15 +00:00
|
|
|
autosave_interval.editable = Global.enable_autosave
|
|
|
|
if autosave_interval.editable:
|
|
|
|
autosave_interval.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
|
|
|
else:
|
|
|
|
autosave_interval.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif "grid" in prop:
|
2020-08-17 19:54:33 +00:00
|
|
|
Global.canvas.grid.update()
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif prop in ["pixel_grid_show_at_zoom", "pixel_grid_color"]:
|
2021-01-16 18:24:46 +00:00
|
|
|
Global.canvas.pixel_grid.update()
|
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif "checker" in prop:
|
2021-11-25 12:48:30 +00:00
|
|
|
Global.transparent_checker.update_rect()
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif prop in ["guide_color"]:
|
2020-06-02 23:14:24 +00:00
|
|
|
for guide in Global.canvas.get_children():
|
2021-11-16 23:48:21 +00:00
|
|
|
if guide is SymmetryGuide:
|
|
|
|
# Add a subtle difference to the normal guide color by mixing in some blue
|
2022-02-17 23:03:08 +00:00
|
|
|
guide.default_color = Global.guide_color.linear_interpolate(Color(.2, .2, .65), .6)
|
2021-11-16 23:48:21 +00:00
|
|
|
elif guide is Guide:
|
2020-06-02 23:14:24 +00:00
|
|
|
guide.default_color = Global.guide_color
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif prop in ["fps_limit"]:
|
2021-01-05 18:01:50 +00:00
|
|
|
Engine.set_target_fps(Global.fps_limit)
|
2021-10-02 12:08:58 +00:00
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif "selection" in prop:
|
2022-02-17 23:03:08 +00:00
|
|
|
var marching_ants: Sprite = Global.canvas.selection.marching_ants_outline
|
|
|
|
marching_ants.material.set_shader_param("animated", Global.selection_animated_borders)
|
|
|
|
marching_ants.material.set_shader_param("first_color", Global.selection_border_color_1)
|
|
|
|
marching_ants.material.set_shader_param("second_color", Global.selection_border_color_2)
|
2021-05-28 00:46:16 +00:00
|
|
|
Global.canvas.selection.update()
|
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif prop in ["icon_color_from", "custom_icon_color"]:
|
2022-09-09 23:58:13 +00:00
|
|
|
if Global.icon_color_from == Global.ColorFrom.THEME:
|
2022-02-17 18:36:10 +00:00
|
|
|
var current_theme: Theme = themes.themes[themes.theme_index]
|
|
|
|
Global.modulate_icon_color = current_theme.get_color("modulate_color", "Icons")
|
2021-06-04 18:44:05 +00:00
|
|
|
else:
|
|
|
|
Global.modulate_icon_color = Global.custom_icon_color
|
|
|
|
themes.change_icon_colors()
|
|
|
|
|
2022-09-09 23:58:13 +00:00
|
|
|
elif prop in ["modulate_clear_color", "clear_color_from"]:
|
|
|
|
themes.change_clear_color()
|
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif prop == "left_tool_color":
|
2022-07-08 00:25:17 +00:00
|
|
|
for child in Tools._tool_buttons.get_children():
|
|
|
|
var left_background: NinePatchRect = child.get_node("BackgroundLeft")
|
|
|
|
left_background.modulate = Global.left_tool_color
|
2022-09-19 21:58:39 +00:00
|
|
|
Tools._slots[BUTTON_LEFT].tool_node.color_rect.color = Global.left_tool_color
|
2022-07-08 00:25:17 +00:00
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif prop == "right_tool_color":
|
2022-07-08 00:25:17 +00:00
|
|
|
for child in Tools._tool_buttons.get_children():
|
|
|
|
var left_background: NinePatchRect = child.get_node("BackgroundRight")
|
|
|
|
left_background.modulate = Global.right_tool_color
|
2022-09-19 21:58:39 +00:00
|
|
|
Tools._slots[BUTTON_RIGHT].tool_node.color_rect.color = Global.right_tool_color
|
2022-07-08 00:25:17 +00:00
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif prop == "tool_button_size":
|
2021-06-13 23:14:31 +00:00
|
|
|
Tools.set_button_size(Global.tool_button_size)
|
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif prop == "native_cursors":
|
2022-02-10 20:32:55 +00:00
|
|
|
if Global.native_cursors:
|
2022-03-21 00:24:13 +00:00
|
|
|
Input.set_custom_mouse_cursor(null, Input.CURSOR_CROSS, Vector2(15, 15))
|
2022-02-10 20:32:55 +00:00
|
|
|
else:
|
2022-03-21 00:24:13 +00:00
|
|
|
Global.control.set_custom_cursor()
|
2022-02-10 20:32:55 +00:00
|
|
|
|
2022-07-09 23:55:18 +00:00
|
|
|
elif prop == "cross_cursor":
|
2022-02-10 20:32:55 +00:00
|
|
|
if Global.cross_cursor:
|
|
|
|
Global.main_viewport.mouse_default_cursor_shape = Control.CURSOR_CROSS
|
|
|
|
else:
|
|
|
|
Global.main_viewport.mouse_default_cursor_shape = Control.CURSOR_ARROW
|
|
|
|
|
2020-05-31 20:04:59 +00:00
|
|
|
Global.config_cache.save("user://cache.ini")
|
2020-02-15 05:34:42 +00:00
|
|
|
|
2020-04-07 22:56:05 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func disable_restore_default_button(button: BaseButton, disable: bool) -> void:
|
2020-07-29 00:16:02 +00:00
|
|
|
button.disabled = disable
|
|
|
|
if disable:
|
|
|
|
button.mouse_default_cursor_shape = Control.CURSOR_ARROW
|
|
|
|
button.hint_tooltip = ""
|
|
|
|
else:
|
|
|
|
button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
|
|
|
button.hint_tooltip = "Restore default value"
|
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func _on_PreferencesDialog_about_to_show() -> void:
|
|
|
|
add_tabs(false)
|
|
|
|
|
|
|
|
|
|
|
|
func add_tabs(changed_language := false) -> void:
|
2022-02-17 23:03:08 +00:00
|
|
|
for item in content_list:
|
|
|
|
list.add_item(" " + tr(item))
|
|
|
|
|
|
|
|
var language_index := content_list.find("Language")
|
|
|
|
list.select(language_index if changed_language else selected_item)
|
2020-07-28 22:54:15 +00:00
|
|
|
autosave_interval.suffix = tr("minute(s)")
|
2020-05-05 13:03:32 +00:00
|
|
|
|
2019-12-27 00:12:26 +00:00
|
|
|
|
2019-12-31 23:27:34 +00:00
|
|
|
func _on_PreferencesDialog_popup_hide() -> void:
|
2020-05-31 20:04:59 +00:00
|
|
|
list.clear()
|
2019-12-20 14:36:23 +00:00
|
|
|
|
2020-04-07 22:56:05 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func _on_List_item_selected(index: int) -> void:
|
2020-06-25 19:27:08 +00:00
|
|
|
selected_item = index
|
2019-12-26 23:02:36 +00:00
|
|
|
for child in right_side.get_children():
|
2020-07-28 22:54:15 +00:00
|
|
|
child.visible = child.name == content_list[index]
|
2020-11-07 01:57:35 +00:00
|
|
|
|
|
|
|
|
2020-11-09 23:32:27 +00:00
|
|
|
func _on_ShrinkApplyButton_pressed() -> void:
|
2021-11-25 12:48:30 +00:00
|
|
|
get_tree().set_screen_stretch(
|
|
|
|
SceneTree.STRETCH_MODE_DISABLED,
|
|
|
|
SceneTree.STRETCH_ASPECT_IGNORE,
|
|
|
|
Vector2(1024, 576),
|
|
|
|
Global.shrink
|
|
|
|
)
|
2022-03-21 00:24:13 +00:00
|
|
|
Global.control.set_custom_cursor()
|
2020-11-09 23:32:27 +00:00
|
|
|
hide()
|
2022-09-22 14:04:20 +00:00
|
|
|
popup_centered(Vector2(600, 400))
|
2020-11-09 23:32:27 +00:00
|
|
|
Global.dialog_open(true)
|
2022-07-09 23:55:18 +00:00
|
|
|
yield(get_tree(), "idle_frame")
|
2020-11-09 23:32:27 +00:00
|
|
|
Global.camera.fit_to_frame(Global.current_project.size)
|