From aeb3a73ffc78dd1a3fff2341e8305d5af6ef1866 Mon Sep 17 00:00:00 2001 From: Marcus Brummer Date: Sun, 5 Nov 2023 21:09:30 +0100 Subject: [PATCH] Added dotted grid pattern & ability to change patterns in the settings ...also removed the grid toggle from the toolbar --- docs/changelog.md | 5 +- lorien/Assets/I18n/de.txt | 3 +- lorien/Assets/I18n/en.txt | 5 +- lorien/Assets/I18n/es.txt | 1 - lorien/Assets/I18n/fr.txt | 1 - lorien/Assets/I18n/it.txt | 3 +- lorien/Assets/I18n/ko.txt | 1 - lorien/Assets/I18n/pt-BR.txt | 1 - lorien/Assets/I18n/ru.txt | 1 - lorien/Assets/I18n/tr.txt | 1 - lorien/Assets/I18n/zh-CN.txt | 1 - lorien/Assets/I18n/zh-TW.txt | 1 - lorien/Config.gd | 2 + lorien/InfiniteCanvas/InfiniteCanvasGrid.gd | 60 ++++++++++-------- lorien/Main.gd | 11 ++-- lorien/Misc/Settings.gd | 2 + lorien/Misc/Types.gd | 7 +++ lorien/UI/Dialogs/SettingsDialog.gd | 26 +++++++- lorien/UI/Dialogs/SettingsDialog.tscn | 67 ++++++++++++++------- lorien/UI/Toolbar.gd | 6 -- lorien/UI/Toolbar.tscn | 24 +------- 21 files changed, 133 insertions(+), 96 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 3cff9916..1b407ea7 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -9,17 +9,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - Rebindable keyboard shortcuts - Use eraser tool while tablet pen is inverted +- Dotted grid pattern; can be changed back to lines (or none at all) in the settings - Translations: Simplified Chinese, Traditional Chinese ### Fixed - Fixed blurry interface on some macOS devices - Fixed invisible cursor in some situations +- Fixed issue where moved brush strokes stayed in their original positions after exporting to SVG ### Changed - Changing the application language does not require a restart now - Improved translations: Spanish, Brasilian Portuguese - Improved UI auto scaling, especially for Windows and OSX -- Updated to Godot 3.5.2 +- Moved to grid toggle button from the toolbar to the settings +- Updated to Godot 3.5.3 ## [0.5.0] - 2022-06-12 diff --git a/lorien/Assets/I18n/de.txt b/lorien/Assets/I18n/de.txt index 32d5dfe4..ee2b8139 100644 --- a/lorien/Assets/I18n/de.txt +++ b/lorien/Assets/I18n/de.txt @@ -29,7 +29,6 @@ TOOLBAR_TOOLTIP_SELECT_TOOL Auswahl Werkzeug {{ shortcut_list("shortcut_sele TOOLBAR_TOOLTIP_BRUSH_COLOR Pinsel Farbe TOOLBAR_TOOLTIP_BRUSH_SIZE Pinsel Größe TOOLBAR_TOOLTIP_CANVAS_COLOR Canvas Farbe -TOOLBAR_TOOLTIP_GRID Gitter anzeigen # ----------------------------------------------------------------------------- # Color Palette Picker @@ -65,6 +64,8 @@ SETTINGS_CANVAS_COLOR Default Canvas Farbe SETTINGS_PROJECT_FOLDER Default Project Ordner SETTINGS_LANGUAGE Sprache SETTINGS_THEME Theme +SETTINGS_GRID_SIZE Grid Größe +SETTINGS_GRID_PATTERN Grid Pattern SETTINGS_AA_METHOD Anti Aliasing Methode SETTINGS_AA_METHOD_NONE Keine SETTINGS_FPS_FOREGROUND Vordergrund Fps diff --git a/lorien/Assets/I18n/en.txt b/lorien/Assets/I18n/en.txt index a654498b..280ccb86 100644 --- a/lorien/Assets/I18n/en.txt +++ b/lorien/Assets/I18n/en.txt @@ -30,7 +30,6 @@ TOOLBAR_TOOLTIP_SELECT_TOOL Selection Tool {{ shortcut_list("shortcut_select TOOLBAR_TOOLTIP_BRUSH_COLOR Brush Color TOOLBAR_TOOLTIP_BRUSH_SIZE Brush Size TOOLBAR_TOOLTIP_CANVAS_COLOR Canvas Color -TOOLBAR_TOOLTIP_GRID Show Grid TOOLBAR_FULLSCREEN_TOGGLE Toggle fullscreen # ----------------------------------------------------------------------------- @@ -70,7 +69,9 @@ SETTINGS_LANGUAGE Language SETTINGS_THEME Theme SETTINGS_UI_SCALE UI Scale SETTINGS_UI_SCALE_AUTO Auto -SETTINGS_UI_SCALE_CUSTOM Custom +SETTINGS_UI_SCALE_CUSTOM Custom +SETTINGS_GRID_SIZE Grid Size +SETTINGS_GRID_PATTERN Grid Pattern SETTINGS_AA_METHOD Anti Aliasing Method SETTINGS_AA_METHOD_NONE None SETTINGS_FPS_FOREGROUND Foreground Fps diff --git a/lorien/Assets/I18n/es.txt b/lorien/Assets/I18n/es.txt index 897f10a8..f85ce567 100644 --- a/lorien/Assets/I18n/es.txt +++ b/lorien/Assets/I18n/es.txt @@ -29,7 +29,6 @@ TOOLBAR_TOOLTIP_SELECT_TOOL Herramienta de Selección {{ shortcut_list("shor TOOLBAR_TOOLTIP_BRUSH_COLOR Color de Pincel TOOLBAR_TOOLTIP_BRUSH_SIZE Tamaño de Pincel TOOLBAR_TOOLTIP_CANVAS_COLOR Color de Canvas -TOOLBAR_TOOLTIP_GRID Mostrar cuadrícula # ----------------------------------------------------------------------------- # Color Palette Picker diff --git a/lorien/Assets/I18n/fr.txt b/lorien/Assets/I18n/fr.txt index 59f9a798..7e934611 100644 --- a/lorien/Assets/I18n/fr.txt +++ b/lorien/Assets/I18n/fr.txt @@ -29,7 +29,6 @@ TOOLBAR_TOOLTIP_SELECT_TOOL Outil de sélection {{ shortcut_list("shortcut_s TOOLBAR_TOOLTIP_BRUSH_COLOR Couleur de la brosse TOOLBAR_TOOLTIP_BRUSH_SIZE Épaisseur de la brosse TOOLBAR_TOOLTIP_CANVAS_COLOR Couleur du canevas -TOOLBAR_TOOLTIP_GRID Afficher la grille # ----------------------------------------------------------------------------- # Color Palette Picker diff --git a/lorien/Assets/I18n/it.txt b/lorien/Assets/I18n/it.txt index 5b73e279..4dddf9eb 100644 --- a/lorien/Assets/I18n/it.txt +++ b/lorien/Assets/I18n/it.txt @@ -28,8 +28,7 @@ TOOLBAR_TOOLTIP_ERASER_TOOL Gomma per cancellare {{ shortcut_list("shortcut_ TOOLBAR_TOOLTIP_SELECT_TOOL Seleziona strumento {{ shortcut_list("shortcut_select_tool") }} TOOLBAR_TOOLTIP_BRUSH_COLOR Colore Pennello TOOLBAR_TOOLTIP_BRUSH_SIZE Dimensione del Pennello -TOOLBAR_TOOLTIP_CANVAS_COLOR Colore della Tela -TOOLBAR_TOOLTIP_GRID Mostra Griglia +TOOLBAR_TOOLTIP_CANVAS_COLOR Colore della Tela TOOLBAR_FULLSCREEN_TOGGLE Commuta la modalità a schermo intero # ----------------------------------------------------------------------------- diff --git a/lorien/Assets/I18n/ko.txt b/lorien/Assets/I18n/ko.txt index 6095f865..29e81af8 100644 --- a/lorien/Assets/I18n/ko.txt +++ b/lorien/Assets/I18n/ko.txt @@ -30,7 +30,6 @@ TOOLBAR_TOOLTIP_SELECT_TOOL 범위 선택 {{ shortcut_list("shortcut_select_ TOOLBAR_TOOLTIP_BRUSH_COLOR 브러쉬 색깔 TOOLBAR_TOOLTIP_BRUSH_SIZE 브러쉬 크기 TOOLBAR_TOOLTIP_CANVAS_COLOR 배경 색깔 -TOOLBAR_TOOLTIP_GRID 눈금 TOOLBAR_FULLSCREEN_TOGGLE 전체화면/원래대로 # ----------------------------------------------------------------------------- diff --git a/lorien/Assets/I18n/pt-BR.txt b/lorien/Assets/I18n/pt-BR.txt index 0610d4f9..0db56574 100644 --- a/lorien/Assets/I18n/pt-BR.txt +++ b/lorien/Assets/I18n/pt-BR.txt @@ -30,7 +30,6 @@ TOOLBAR_TOOLTIP_SELECT_TOOL Ferramenta de Seleção {{ shortcut_list("shortc TOOLBAR_TOOLTIP_BRUSH_COLOR Cor do Pincel TOOLBAR_TOOLTIP_BRUSH_SIZE Tamanho do Pincel TOOLBAR_TOOLTIP_CANVAS_COLOR Cor da Área de Desenho -TOOLBAR_TOOLTIP_GRID Exibir Grade TOOLBAR_FULLSCREEN_TOGGLE (Des)ativar Tela Cheia # ----------------------------------------------------------------------------- diff --git a/lorien/Assets/I18n/ru.txt b/lorien/Assets/I18n/ru.txt index 364f61d6..08bb3501 100644 --- a/lorien/Assets/I18n/ru.txt +++ b/lorien/Assets/I18n/ru.txt @@ -29,7 +29,6 @@ TOOLBAR_TOOLTIP_SELECT_TOOL Выделить {{ shortcut_list("shortcut_sel TOOLBAR_TOOLTIP_BRUSH_COLOR Цвет кисти TOOLBAR_TOOLTIP_BRUSH_SIZE Размер кисти TOOLBAR_TOOLTIP_CANVAS_COLOR Цвет холста -TOOLBAR_TOOLTIP_GRID Show Grid # TODO # ----------------------------------------------------------------------------- # Color Palette Picker diff --git a/lorien/Assets/I18n/tr.txt b/lorien/Assets/I18n/tr.txt index 12b5c9ce..64e1307f 100644 --- a/lorien/Assets/I18n/tr.txt +++ b/lorien/Assets/I18n/tr.txt @@ -30,7 +30,6 @@ TOOLBAR_TOOLTIP_SELECT_TOOL Seçim Aracı {{ shortcut_list("shortcut_select_ TOOLBAR_TOOLTIP_BRUSH_COLOR Fırça Rengi TOOLBAR_TOOLTIP_BRUSH_SIZE Fırça Boyutu TOOLBAR_TOOLTIP_CANVAS_COLOR Tuval Rengi -TOOLBAR_TOOLTIP_GRID Izgarayı Göster TOOLBAR_FULLSCREEN_TOGGLE Tam Ekran # ----------------------------------------------------------------------------- diff --git a/lorien/Assets/I18n/zh-CN.txt b/lorien/Assets/I18n/zh-CN.txt index 6c0348f5..71ca04a1 100644 --- a/lorien/Assets/I18n/zh-CN.txt +++ b/lorien/Assets/I18n/zh-CN.txt @@ -30,7 +30,6 @@ TOOLBAR_TOOLTIP_SELECT_TOOL 选择工具 {{ shortcut_list("shortcut_select_t TOOLBAR_TOOLTIP_BRUSH_COLOR 画笔颜色 TOOLBAR_TOOLTIP_BRUSH_SIZE 画笔大小 TOOLBAR_TOOLTIP_CANVAS_COLOR 画布颜色 -TOOLBAR_TOOLTIP_GRID 显示网格 TOOLBAR_FULLSCREEN_TOGGLE 切换全屏 # ----------------------------------------------------------------------------- diff --git a/lorien/Assets/I18n/zh-TW.txt b/lorien/Assets/I18n/zh-TW.txt index 1541428c..87281904 100644 --- a/lorien/Assets/I18n/zh-TW.txt +++ b/lorien/Assets/I18n/zh-TW.txt @@ -30,7 +30,6 @@ TOOLBAR_TOOLTIP_SELECT_TOOL 選擇工具 {{ shortcut_list("shortcut_select_t TOOLBAR_TOOLTIP_BRUSH_COLOR 畫筆顏色 TOOLBAR_TOOLTIP_BRUSH_SIZE 畫筆大小 TOOLBAR_TOOLTIP_CANVAS_COLOR 畫布底色 -TOOLBAR_TOOLTIP_GRID 顯示格線 TOOLBAR_FULLSCREEN_TOGGLE 全螢幕切換 # ----------------------------------------------------------------------------- diff --git a/lorien/Config.gd b/lorien/Config.gd index ba5fe59c..e6324c51 100644 --- a/lorien/Config.gd +++ b/lorien/Config.gd @@ -22,4 +22,6 @@ const DEFAULT_BACKGROUND_FPS := 10 const DEFAULT_BRUSH_ROUNDING := Types.BrushRoundingType.ROUNDED const DEFAULT_UI_SCALE_MODE := Types.UIScale.AUTO const DEFAULT_UI_SCALE := 1.0 +const DEFAULT_GRID_PATTERN := Types.GridPattern.DOTS const DEFAULT_GRID_SIZE := 25.0 + diff --git a/lorien/InfiniteCanvas/InfiniteCanvasGrid.gd b/lorien/InfiniteCanvas/InfiniteCanvasGrid.gd index fcd677df..6cff1ff9 100644 --- a/lorien/InfiniteCanvas/InfiniteCanvasGrid.gd +++ b/lorien/InfiniteCanvas/InfiniteCanvasGrid.gd @@ -1,18 +1,19 @@ class_name InfiniteCanvasGrid extends Node2D -# ------------------------------------------------------------------------------------------------- -const COLOR := Color.red - # ------------------------------------------------------------------------------------------------- export var camera_path: NodePath var _enabled: bool +var _pattern: int = Types.GridPattern.DOTS var _camera: Camera2D var _grid_size := Config.DEFAULT_GRID_SIZE var _grid_color: Color # ------------------------------------------------------------------------------------------------- func _ready(): + _grid_size = Settings.get_value(Settings.APPEARANCE_GRID_SIZE, Config.DEFAULT_GRID_SIZE) + _pattern = Settings.get_value(Settings.APPEARANCE_GRID_PATTERN, Config.DEFAULT_GRID_PATTERN) + _camera = get_node(camera_path) _camera.connect("zoom_changed", self, "_on_zoom_changed") _camera.connect("position_changed", self, "_on_position_changed") @@ -33,6 +34,11 @@ func set_grid_size(size: int) -> void: _grid_size = size update() +# ------------------------------------------------------------------------------------------------- +func set_grid_pattern(pattern: int) -> void: + _pattern = pattern + update() + # ------------------------------------------------------------------------------------------------- func set_canvas_color(c: Color) -> void: _grid_color = c * 1.25 @@ -47,25 +53,29 @@ func _draw() -> void: var size = get_viewport().size * _camera.zoom var zoom = _camera.zoom.x var offset = _camera.offset - - var grid_size = _grid_size - if zoom > 50: - grid_size *= 50 - elif zoom > 25: - grid_size *= 25 - elif zoom > 10: - grid_size *= 10 - elif zoom > 5: - grid_size *= 5 - - # Vertical lines - var start_index := int((offset.x - size.x) / grid_size) - 1 - var end_index := int((size.x + offset.x) / grid_size) + 1 - for i in range(start_index, end_index): - draw_line(Vector2(i * grid_size, offset.y + size.y), Vector2(i * grid_size, offset.y - size.y), _grid_color) - - # Horizontal lines - start_index = int((offset.y - size.y) / grid_size) - 1 - end_index = int((size.y + offset.y) / grid_size) + 1 - for i in range(start_index, end_index): - draw_line(Vector2(offset.x + size.x, i * grid_size), Vector2(offset.x - size.x, i * grid_size), _grid_color) + var grid_size := int(ceil((_grid_size * pow(zoom, 0.75)))) + + match _pattern: + Types.GridPattern.DOTS: + var dot_size := int(ceil(grid_size * 0.12)) + var x_start := int(offset.x / grid_size) - 1 + var x_end := int((size.x + offset.x) / grid_size) + 1 + var y_start := int(offset.y / grid_size) - 1 + var y_end = int((size.y + offset.y) / grid_size) + 1 + + for x in range(x_start, x_end): + for y in range(y_start, y_end): + var pos := Vector2(x, y) * grid_size + draw_rect(Rect2(pos.x, pos.y, dot_size, dot_size), _grid_color) + Types.GridPattern.LINES: + # Vertical lines + var start_index := int(offset.x / grid_size) - 1 + var end_index := int((size.x + offset.x) / grid_size) + 1 + for i in range(start_index, end_index): + draw_line(Vector2(i * grid_size, offset.y + size.y), Vector2(i * grid_size, offset.y - size.y), _grid_color) + + # Horizontal lines + start_index = int(offset.y / grid_size) - 1 + end_index = int((size.y + offset.y) / grid_size) + 1 + for i in range(start_index, end_index): + draw_line(Vector2(offset.x + size.x, i * grid_size), Vector2(offset.x - size.x, i * grid_size), _grid_color) diff --git a/lorien/Main.gd b/lorien/Main.gd index cbc5dc67..a4fb0a9d 100644 --- a/lorien/Main.gd +++ b/lorien/Main.gd @@ -49,7 +49,6 @@ func _ready(): _toolbar.connect("brush_size_changed", self, "_on_brush_size_changed") _toolbar.connect("canvas_background_changed", self, "_on_canvas_background_changed") _toolbar.connect("tool_changed", self, "_on_tool_changed") - _toolbar.connect("grid_enabled", self, "_on_grid_enabled") _menubar.connect("create_new_project", self, "_on_create_new_project") _menubar.connect("project_selected", self, "_on_project_selected") @@ -72,7 +71,7 @@ func _ready(): _settings_dialog.connect("ui_scale_changed", self, "_on_scale_changed") _settings_dialog.connect("grid_size_changed", self, "_on_grid_size_changed") - + _settings_dialog.connect("grid_pattern_changed", self, "_on_grid_pattern_changed") # Initialize scale _on_scale_changed() @@ -336,6 +335,10 @@ func _on_brush_size_changed(size: int) -> void: func _on_grid_size_changed(size: int) -> void: _canvas_grid.set_grid_size(size) +# ------------------------------------------------------------------------------------------------- +func _on_grid_pattern_changed(pattern: int) -> void: + _canvas_grid.set_grid_pattern(pattern) + # ------------------------------------------------------------------------------------------------- func _on_clear_canvas() -> void: _canvas.clear() @@ -410,10 +413,6 @@ func _on_canvas_background_changed(color: Color) -> void: project.meta_data[ProjectMetadata.CANVAS_COLOR] = color.to_html() project.dirty = true -# ------------------------------------------------------------------------------------------------- -func _on_grid_enabled(enabled: bool) -> void: - _canvas.enable_grid(enabled) - # ------------------------------------------------------------------------------------------------- func _on_undo_action() -> void: var project: Project = ProjectManager.get_active_project() diff --git a/lorien/Misc/Settings.gd b/lorien/Misc/Settings.gd index 85bf744e..2e623482 100644 --- a/lorien/Misc/Settings.gd +++ b/lorien/Misc/Settings.gd @@ -11,6 +11,8 @@ const GENERAL_LANGUAGE := "general_language" const APPEARANCE_THEME := "appearance_theme" const APPEARANCE_UI_SCALE_MODE := "appearance_ui_scale_mode" const APPEARANCE_UI_SCALE := "appearance_ui_scale" +const APPEARANCE_GRID_PATTERN := "appearance_grid_pattern" +const APPEARANCE_GRID_SIZE := "appearance_grid_size" const RENDERING_AA_MODE := "rendering_aa_mode" const RENDERING_FOREGROUND_FPS := "rendering_foreground_fps" const RENDERING_BACKGROUND_FPS := "rendering_background_fps" diff --git a/lorien/Misc/Types.gd b/lorien/Misc/Types.gd index e4276df5..26a72271 100644 --- a/lorien/Misc/Types.gd +++ b/lorien/Misc/Types.gd @@ -18,6 +18,13 @@ enum AAMode { TEXTURE_FILL } +# ------------------------------------------------------------------------------------------------- +enum GridPattern { + DOTS, + LINES, + NONE +} + # ------------------------------------------------------------------------------------------------- enum UITheme { DARK, diff --git a/lorien/UI/Dialogs/SettingsDialog.gd b/lorien/UI/Dialogs/SettingsDialog.gd index 36e14f25..d32a1c72 100644 --- a/lorien/UI/Dialogs/SettingsDialog.gd +++ b/lorien/UI/Dialogs/SettingsDialog.gd @@ -4,6 +4,10 @@ extends WindowDialog const THEME_DARK_INDEX := 0 const THEME_LIGHT_INDEX := 1 +const GRID_PATTERN_DOTS_INDEX := 0 +const GRID_PATTERN_LINES_INDEX := 1 +const GRID_PATTERN_NONE_INDEX := 2 + const AA_NONE_INDEX := 0 const AA_OPENGL_HINT_INDEX := 1 const AA_TEXTURE_FILL_INDEX := 2 @@ -14,6 +18,7 @@ const UI_SCALE_CUSTOM_INDEX := 1 # ------------------------------------------------------------------------------------------------- signal ui_scale_changed signal grid_size_changed(size) +signal grid_pattern_changed(pattern) # ------------------------------------------------------------------------------------------------- onready var _tab_container: TabContainer = $MarginContainer/TabContainer @@ -36,6 +41,7 @@ onready var _brush_rounding_options: OptionButton = $MarginContainer/TabContaine onready var _ui_scale_options: OptionButton = $MarginContainer/TabContainer/Appearance/VBoxContainer/UIScale/HBoxContainer/UIScaleOptions onready var _ui_scale: SpinBox = $MarginContainer/TabContainer/Appearance/VBoxContainer/UIScale/HBoxContainer/UIScale onready var _grid_size: SpinBox = $MarginContainer/TabContainer/Appearance/VBoxContainer/GridSize/GridSize +onready var _grid_pattern: OptionButton = $MarginContainer/TabContainer/Appearance/VBoxContainer/GridPattern/GridPattern # ------------------------------------------------------------------------------------------------- func _ready(): @@ -54,7 +60,6 @@ func _apply_language() -> void: func _set_values() -> void: var brush_size = Settings.get_value(Settings.GENERAL_DEFAULT_BRUSH_SIZE, Config.DEFAULT_BRUSH_SIZE) var canvas_color = Settings.get_value(Settings.GENERAL_DEFAULT_CANVAS_COLOR, Config.DEFAULT_CANVAS_COLOR) - var grid_size = Config.DEFAULT_GRID_SIZE var project_dir = Settings.get_value(Settings.GENERAL_DEFAULT_PROJECT_DIR, "") var theme = Settings.get_value(Settings.APPEARANCE_THEME, Types.UITheme.DARK) var aa_mode = Settings.get_value(Settings.RENDERING_AA_MODE, Config.DEFAULT_AA_MODE) @@ -64,6 +69,8 @@ func _set_values() -> void: var pressure_sensitivity = Settings.get_value(Settings.GENERAL_PRESSURE_SENSITIVITY, Config.DEFAULT_PRESSURE_SENSITIVITY) var ui_scale_mode = Settings.get_value(Settings.APPEARANCE_UI_SCALE_MODE, Config.DEFAULT_UI_SCALE_MODE) var ui_scale = Settings.get_value(Settings.APPEARANCE_UI_SCALE, Config.DEFAULT_UI_SCALE) + var grid_pattern = Settings.get_value(Settings.APPEARANCE_GRID_PATTERN, Config.DEFAULT_GRID_PATTERN) + var grid_size = Settings.get_value(Settings.APPEARANCE_GRID_SIZE, Config.DEFAULT_GRID_SIZE) match theme: Types.UITheme.DARK: _theme.selected = THEME_DARK_INDEX @@ -86,6 +93,10 @@ func _set_values() -> void: _brush_size.value = brush_size _canvas_color.color = canvas_color _grid_size.value = grid_size + match grid_pattern: + Types.GridPattern.DOTS: _grid_pattern.selected = GRID_PATTERN_DOTS_INDEX + Types.GridPattern.LINES: _grid_pattern.selected = GRID_PATTERN_LINES_INDEX + Types.GridPattern.NONE: _grid_pattern.selected = GRID_PATTERN_NONE_INDEX _project_dir.text = project_dir _foreground_fps.value = foreground_fps _background_fps.value = background_fps @@ -137,12 +148,21 @@ func _on_DefaultBrushSize_value_changed(value: int) -> void: # ------------------------------------------------------------------------------------------------- func _on_DefaultCanvasColor_color_changed(color: Color) -> void: Settings.set_value(Settings.GENERAL_DEFAULT_CANVAS_COLOR, color) - # ------------------------------------------------------------------------------------------------- func _on_GridSize_value_changed(value: int) -> void: - emit_signal("grid_size_changed", int(value)) + Settings.set_value(Settings.APPEARANCE_GRID_SIZE, value) + emit_signal("grid_size_changed", value) +# ------------------------------------------------------------------------------------------------- +func _on_GridPattern_item_selected(index: int) -> void: + var pattern: int = Types.GridPattern.NONE + match index: + GRID_PATTERN_DOTS_INDEX: pattern = Types.GridPattern.DOTS + GRID_PATTERN_LINES_INDEX: pattern = Types.GridPattern.LINES + Settings.set_value(Settings.APPEARANCE_GRID_PATTERN, pattern) + emit_signal("grid_pattern_changed", pattern) + # ------------------------------------------------------------------------------------------------- func _on_PressureSensitivity_value_changed(value: float): Settings.set_value(Settings.GENERAL_PRESSURE_SENSITIVITY, value) diff --git a/lorien/UI/Dialogs/SettingsDialog.tscn b/lorien/UI/Dialogs/SettingsDialog.tscn index c9d6c30c..8f2c5ad9 100644 --- a/lorien/UI/Dialogs/SettingsDialog.tscn +++ b/lorien/UI/Dialogs/SettingsDialog.tscn @@ -139,9 +139,9 @@ color = Color( 0.12549, 0.129412, 0.141176, 1 ) edit_alpha = false [node name="DefaultSaveDir" type="HBoxContainer" parent="MarginContainer/TabContainer/General/VBoxContainer"] -margin_top = 112.0 +margin_top = 87.0 margin_right = 496.0 -margin_bottom = 133.0 +margin_bottom = 108.0 size_flags_horizontal = 3 [node name="Label" type="Label" parent="MarginContainer/TabContainer/General/VBoxContainer/DefaultSaveDir"] @@ -162,15 +162,15 @@ placeholder_text = "e.g. C:/Users/me/Lorien" placeholder_alpha = 0.5 [node name="HSeparator4" type="HSeparator" parent="MarginContainer/TabContainer/General/VBoxContainer"] -margin_top = 137.0 +margin_top = 112.0 margin_right = 496.0 -margin_bottom = 161.0 +margin_bottom = 136.0 custom_constants/separation = 24 [node name="Language" type="HBoxContainer" parent="MarginContainer/TabContainer/General/VBoxContainer"] -margin_top = 165.0 +margin_top = 140.0 margin_right = 496.0 -margin_bottom = 190.0 +margin_bottom = 165.0 size_flags_horizontal = 3 [node name="Label" type="Label" parent="MarginContainer/TabContainer/General/VBoxContainer/Language"] @@ -189,9 +189,9 @@ size_flags_horizontal = 3 text = "English" [node name="HSeparator" type="HSeparator" parent="MarginContainer/TabContainer/General/VBoxContainer"] -margin_top = 194.0 +margin_top = 169.0 margin_right = 496.0 -margin_bottom = 206.0 +margin_bottom = 181.0 custom_constants/separation = 12 custom_styles/separator = SubResource( 3 ) @@ -288,26 +288,34 @@ step = 0.1 value = 1.0 script = ExtResource( 3 ) -[node name="HSeparator5" type="HSeparator" parent="MarginContainer/TabContainer/Appearance/VBoxContainer"] +[node name="GridPattern" type="HBoxContainer" parent="MarginContainer/TabContainer/Appearance/VBoxContainer"] margin_top = 74.0 margin_right = 496.0 -margin_bottom = 86.0 -custom_constants/separation = 12 -custom_styles/separator = SubResource( 1 ) +margin_bottom = 99.0 +size_flags_horizontal = 3 -[node name="RestartLabel" type="Label" parent="MarginContainer/TabContainer/Appearance/VBoxContainer"] -visible = false -margin_top = 61.0 +[node name="Label" type="Label" parent="MarginContainer/TabContainer/Appearance/VBoxContainer/GridPattern"] +margin_top = 4.0 +margin_right = 246.0 +margin_bottom = 21.0 +size_flags_horizontal = 3 +size_flags_vertical = 6 +text = "SETTINGS_GRID_PATTERN" + +[node name="GridPattern" type="OptionButton" parent="MarginContainer/TabContainer/Appearance/VBoxContainer/GridPattern"] +margin_left = 250.0 margin_right = 496.0 -margin_bottom = 78.0 -custom_colors/font_color = Color( 1, 0.470588, 0.470588, 1 ) -text = "SETTINGS_RESTART_NOTICE" -align = 1 +margin_bottom = 25.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Dots" +items = [ "Dots", null, false, 0, null, "Lines", null, false, 1, null, "None", null, false, 2, null ] +selected = 0 [node name="GridSize" type="HBoxContainer" parent="MarginContainer/TabContainer/Appearance/VBoxContainer"] -margin_top = 90.0 +margin_top = 103.0 margin_right = 496.0 -margin_bottom = 111.0 +margin_bottom = 124.0 size_flags_horizontal = 3 [node name="Label" type="Label" parent="MarginContainer/TabContainer/Appearance/VBoxContainer/GridSize"] @@ -329,6 +337,22 @@ max_value = 256.0 value = 12.0 allow_greater = true +[node name="HSeparator5" type="HSeparator" parent="MarginContainer/TabContainer/Appearance/VBoxContainer"] +margin_top = 128.0 +margin_right = 496.0 +margin_bottom = 140.0 +custom_constants/separation = 12 +custom_styles/separator = SubResource( 1 ) + +[node name="RestartLabel" type="Label" parent="MarginContainer/TabContainer/Appearance/VBoxContainer"] +visible = false +margin_top = 90.0 +margin_right = 496.0 +margin_bottom = 107.0 +custom_colors/font_color = Color( 1, 0.470588, 0.470588, 1 ) +text = "SETTINGS_RESTART_NOTICE" +align = 1 + [node name="Rendering" type="Control" parent="MarginContainer/TabContainer"] visible = false anchor_right = 1.0 @@ -492,6 +516,7 @@ dialog_autowrap = true [connection signal="item_selected" from="MarginContainer/TabContainer/Appearance/VBoxContainer/UIScale/HBoxContainer/UIScaleOptions" to="." method="_on_UIScaleOptions_item_selected"] [connection signal="gui_input" from="MarginContainer/TabContainer/Appearance/VBoxContainer/UIScale/HBoxContainer/UIScale" to="MarginContainer/TabContainer/Appearance/VBoxContainer/UIScale/HBoxContainer/UIScale" method="_on_UIScale_gui_input"] [connection signal="value_changed" from="MarginContainer/TabContainer/Appearance/VBoxContainer/UIScale/HBoxContainer/UIScale" to="." method="_on_UIScale_value_changed"] +[connection signal="item_selected" from="MarginContainer/TabContainer/Appearance/VBoxContainer/GridPattern/GridPattern" to="." method="_on_GridPattern_item_selected"] [connection signal="value_changed" from="MarginContainer/TabContainer/Appearance/VBoxContainer/GridSize/GridSize" to="." method="_on_GridSize_value_changed"] [connection signal="item_selected" from="MarginContainer/TabContainer/Rendering/VBoxContainer/AntiAliasing/AntiAliasing" to="." method="_on_AntiAliasing_item_selected"] [connection signal="item_selected" from="MarginContainer/TabContainer/Rendering/VBoxContainer/BrushRounding/OptionButton" to="." method="_on_Brush_rounding_item_selected"] diff --git a/lorien/UI/Toolbar.gd b/lorien/UI/Toolbar.gd index af6cca75..93010c7e 100644 --- a/lorien/UI/Toolbar.gd +++ b/lorien/UI/Toolbar.gd @@ -8,7 +8,6 @@ signal clear_canvas signal undo_action signal redo_action signal toggle_brush_color_picker -signal grid_enabled(enabled) signal brush_size_changed(size) signal canvas_background_changed(color) signal tool_changed(t) @@ -33,7 +32,6 @@ onready var _brush_size_label: Label = $Console/Left/BrushSizeLabel onready var _brush_size_slider: HSlider = $Console/Left/BrushSizeSlider onready var _background_color_picker: ColorPicker = get_node(background_color_picker_path) onready var _background_color_picker_popup: Popup = get_node(background_color_picker_path).get_parent().get_parent() # meh... -onready var _grid_button: TextureButton = $Console/Right/GridButton onready var _fullscreen_btn: TextureButton = $Console/Right/FullscreenButton onready var _tool_btn_brush: TextureButton = $Console/Left/BrushToolButton onready var _tool_btn_rectangle: TextureButton = $Console/Left/RectangleToolButton @@ -169,10 +167,6 @@ func _on_BackgroundColorButton_pressed(): func _on_window_resized() -> void: if _background_color_picker_popup.visible: _background_color_picker_popup.rect_position.x = rect_size.x - _background_color_picker_popup.rect_size.x - -# ------------------------------------------------------------------------------------------------- -func _on_GridButton_toggled(toggled: bool): - emit_signal("grid_enabled", toggled) # ------------------------------------------------------------------------------------------------- func _on_FullscreenButton_toggled(button_pressed): diff --git a/lorien/UI/Toolbar.tscn b/lorien/UI/Toolbar.tscn index 7ca96525..6c2a707f 100644 --- a/lorien/UI/Toolbar.tscn +++ b/lorien/UI/Toolbar.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=2] +[gd_scene load_steps=22 format=2] [ext_resource path="res://Assets/Icons/save_file.png" type="Texture" id=1] [ext_resource path="res://Assets/Icons/open_file.png" type="Texture" id=2] @@ -16,7 +16,6 @@ [ext_resource path="res://Assets/Fonts/font_small.tres" type="DynamicFont" id=14] [ext_resource path="res://UI/Themes/theme_dark.tres" type="Theme" id=15] [ext_resource path="res://Assets/Icons/selection_tool.png" type="Texture" id=16] -[ext_resource path="res://Assets/Icons/grid.png" type="Texture" id=17] [ext_resource path="res://Assets/Icons/fullscreen.png" type="Texture" id=18] [ext_resource path="res://Assets/Icons/circle_tool.png" type="Texture" id=19] @@ -313,31 +312,15 @@ __meta__ = { } [node name="BackgroundColorButton" type="TextureButton" parent="Console/Right"] -margin_left = 868.0 -margin_top = 12.0 -margin_right = 884.0 -margin_bottom = 28.0 -hint_tooltip = "TOOLBAR_TOOLTIP_CANVAS_COLOR" -size_flags_horizontal = 4 -size_flags_vertical = 4 -action_mode = 0 -texture_normal = ExtResource( 12 ) -script = ExtResource( 13 ) -hover_tint = Color( 0.662745, 0.945098, 0.87451, 1 ) -pressed_tint = Color( 0.572549, 1, 0.894118, 1 ) - -[node name="GridButton" type="TextureButton" parent="Console/Right"] margin_left = 896.0 margin_top = 12.0 margin_right = 912.0 margin_bottom = 28.0 -hint_tooltip = "TOOLBAR_TOOLTIP_GRID" +hint_tooltip = "TOOLBAR_TOOLTIP_CANVAS_COLOR" size_flags_horizontal = 4 size_flags_vertical = 4 -toggle_mode = true -pressed = true action_mode = 0 -texture_normal = ExtResource( 17 ) +texture_normal = ExtResource( 12 ) script = ExtResource( 13 ) hover_tint = Color( 0.662745, 0.945098, 0.87451, 1 ) pressed_tint = Color( 0.572549, 1, 0.894118, 1 ) @@ -378,5 +361,4 @@ custom_styles/separator = SubResource( 2 ) [connection signal="pressed" from="Console/Left/ColorButton" to="." method="_on_ColorButton_pressed"] [connection signal="value_changed" from="Console/Left/BrushSizeSlider" to="." method="_on_BrushSizeSlider_value_changed"] [connection signal="pressed" from="Console/Right/BackgroundColorButton" to="." method="_on_BackgroundColorButton_pressed"] -[connection signal="toggled" from="Console/Right/GridButton" to="." method="_on_GridButton_toggled"] [connection signal="toggled" from="Console/Right/FullscreenButton" to="." method="_on_FullscreenButton_toggled"]