Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tablet driver settings and made wintab default on Windows #307

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lorien/Assets/I18n/ar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ SETTINGS_BRUSH_SIZE مقاس الفرشاة الافتراضي
SETTINGS_CANVAS_COLOR لون اللوحة الافتراضي
SETTINGS_PROJECT_FOLDER ملف المشروع الافتراضي
SETTINGS_LANGUAGE اللغة
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME الشكل
SETTINGS_UI_SCALE حجم واجهة المستخدم
SETTINGS_UI_SCALE_AUTO تلقائي
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/de.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ SETTINGS_PRESSURE_SENSITIVITY Druckempfindlichkeit
SETTINGS_BRUSH_SIZE Default Pinsel Größe
SETTINGS_PROJECT_FOLDER Default Project Ordner
SETTINGS_LANGUAGE Sprache
SETTINGS_TABLET_DRIVER Tablet Treiber
SETTINGS_THEME Theme
SETTINGS_GRID_SIZE Grid Größe
SETTINGS_GRID_PATTERN Grid Pattern
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ SETTINGS_BRUSH_SIZE Default Brush Size
SETTINGS_PROJECT_FOLDER Default save/load folder
SETTINGS_GRID_SIZE Grid Size
SETTINGS_LANGUAGE Language
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME Theme
SETTINGS_UI_SCALE UI Scale
SETTINGS_UI_SCALE_AUTO Auto
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/es.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ SETTINGS_BRUSH_SIZE Tamaño de Pincel Predeterminado
SETTINGS_CANVAS_COLOR Color de Canvas
SETTINGS_PROJECT_FOLDER Carpeta de Proyectos Predeterminada
SETTINGS_LANGUAGE Idioma
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME Tema
SETTINGS_FPS_FOREGROUND Color de texto de FPS
SETTINGS_FPS_BACKGROUND Color de fondo de FPS
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/fr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ SETTINGS_PRESSURE_SENSITIVITY Sensibilité de la pression
SETTINGS_BRUSH_SIZE Épaisseur par défaut de la brosse
SETTINGS_PROJECT_FOLDER Dossier par défaut du projet
SETTINGS_LANGUAGE Langue
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME Thème
SETTINGS_FPS_FOREGROUND Fps lorsque actif
SETTINGS_FPS_BACKGROUND Fps lorsque inactif
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/it.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ SETTINGS_PRESSURE_SENSITIVITY Sensibilità alla pressione
SETTINGS_BRUSH_SIZE Dimensione Pennello Predefinita
SETTINGS_PROJECT_FOLDER Cartella di Progetto Predefinita
SETTINGS_LANGUAGE Lingua
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME Tema
SETTINGS_FPS_FOREGROUND Fps in primo piano
SETTINGS_FPS_BACKGROUND Fps sullo sfondo
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/ko.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ SETTINGS_PRESSURE_SENSITIVITY 필압 민감도
SETTINGS_BRUSH_SIZE 기본 브러쉬 크기
SETTINGS_PROJECT_FOLDER 기본 프로젝트 풀더
SETTINGS_LANGUAGE 언어
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME 테마
SETTINGS_UI_SCALE UI 표시 배율
SETTINGS_UI_SCALE_AUTO 자동
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/pt-BR.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ SETTINGS_BRUSH_SIZE Tamanho Padrão do Pincel
SETTINGS_CANVAS_COLOR Cor da Área de Desenho
SETTINGS_PROJECT_FOLDER Pasta Padrão do Projeto
SETTINGS_LANGUAGE Idioma
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME Tema
SETTINGS_UI_SCALE Escala da Interface
SETTINGS_UI_SCALE_AUTO Automática
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/ru.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ SETTINGS_BRUSH_SIZE Размер кисти по умолчанию
SETTINGS_CANVAS_COLOR Цвет кисти
SETTINGS_PROJECT_FOLDER Папка проекта по умолчанию
SETTINGS_LANGUAGE Язык
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME Тема
SETTINGS_FPS_FOREGROUND Foreground Fps # TODO
SETTINGS_FPS_BACKGROUND Background Fps # TODO
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/tr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ SETTINGS_CANVAS_COLOR Tuval Rengi
SETTINGS_PROJECT_FOLDER Varsayılan Proje Klasörü
SETTINGS_GRID_SIZE Izgara Boyutu
SETTINGS_LANGUAGE Dil
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME Tema
SETTINGS_UI_SCALE UI Boyutu
SETTINGS_UI_SCALE_AUTO Otomatik
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/uk.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ SETTINGS_BRUSH_SIZE Розмір Пензлика за замовч
SETTINGS_PROJECT_FOLDER Папка Проекту за замовчуванням
SETTINGS_GRID_SIZE Розмір сітки
SETTINGS_LANGUAGE Мова
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME Тема
SETTINGS_UI_SCALE Розмір UI
SETTINGS_UI_SCALE_AUTO Авто
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/zh-CN.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ SETTINGS_BRUSH_SIZE 默认画笔大小
SETTINGS_CANVAS_COLOR 画布颜色
SETTINGS_PROJECT_FOLDER 默认项目路径
SETTINGS_LANGUAGE 语言
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME 主题
SETTINGS_UI_SCALE UI 缩放
SETTINGS_UI_SCALE_AUTO 自动
Expand Down
1 change: 1 addition & 0 deletions lorien/Assets/I18n/zh-TW.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ SETTINGS_BRUSH_SIZE 預設畫筆大小
SETTINGS_CANVAS_COLOR 畫布底色
SETTINGS_PROJECT_FOLDER 預設專案目錄
SETTINGS_LANGUAGE 語言
SETTINGS_TABLET_DRIVER Tablet Driver
SETTINGS_THEME 佈景主題
SETTINGS_UI_SCALE UI 縮放
SETTINGS_UI_SCALE_AUTO 自動
Expand Down
4 changes: 4 additions & 0 deletions lorien/Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func _ready() -> void:
_file_dialog.current_dir = Settings.get_value(Settings.GENERAL_DEFAULT_PROJECT_DIR, docs_folder)
_export_dialog.current_dir = Settings.get_value(Settings.GENERAL_DEFAULT_PROJECT_DIR, docs_folder)

# Set tablet driver
var driver: String = Settings.get_value(Settings.GENERAL_TABLET_DRIVER, DisplayServer.tablet_get_current_driver())
DisplayServer.tablet_set_current_driver(driver)

# Signals
get_window().files_dropped.connect(_on_files_dropped)

Expand Down
1 change: 1 addition & 0 deletions lorien/Misc/Settings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const GENERAL_DEFAULT_BRUSH_SIZE := "general_default_brush_size"
const GENERAL_DEFAULT_PROJECT_DIR := "general_default_project_dir"
const GENERAL_LANGUAGE := "general_language"
const GENERAL_TOOL_PRESSURE := "general_tool_pressure"
const GENERAL_TABLET_DRIVER := "general_tablet_driver"
const COLOR_PALETTE_UUID_LAST_USED := "general_color_palette_uuid_last_used" # TODO: move this to state.cfg

# -------------------------------------------------------------------------------------------------
Expand Down
19 changes: 19 additions & 0 deletions lorien/UI/Dialogs/SettingsDialog.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ signal constant_pressure_changed(state: bool)
@onready var _stabilizer_strength: SpinBox = %StabilizerStrength
@onready var _project_dir: LineEdit = %DefaultProjectDir
@onready var _language: OptionButton = %Language
@onready var _tablet_driver: OptionButton = %TabletDriver
@onready var _theme: OptionButton = %Theme
@onready var _canvas_color: ColorPickerButton= %CanvasColor
@onready var _ui_scale_mode: OptionButton = %UIScaleOptions
Expand All @@ -67,6 +68,7 @@ func _ready() -> void:
_tool_pressure.value_changed.connect(_on_default_tool_pressure_changed)
_project_dir.text_changed.connect(_on_default_project_dir_changed)
_language.item_selected.connect(_on_language_selected)
_tablet_driver.item_selected.connect(_on_tablet_driver_selected)
_theme.item_selected.connect(_on_theme_selected)
_ui_scale_mode.item_selected.connect(_on_ui_scale_mode_selected)
_ui_scale.value_changed.connect(_on_ui_scale_changed)
Expand All @@ -87,6 +89,7 @@ func _set_values() -> void:
var brush_size: int = Settings.get_value(Settings.GENERAL_DEFAULT_BRUSH_SIZE, Config.DEFAULT_BRUSH_SIZE)
var project_dir: String = Settings.get_value(Settings.GENERAL_DEFAULT_PROJECT_DIR, "")
var locale: String = Settings.get_value(Settings.GENERAL_LANGUAGE, "en")
var driver: String = Settings.get_value(Settings.GENERAL_TABLET_DRIVER, DisplayServer.tablet_get_current_driver())
var tool_pressure: float = Settings.get_value(Settings.GENERAL_TOOL_PRESSURE, Config.DEFAULT_TOOL_PRESSURE)
var pressure_sensitivity: float = Settings.get_value(Settings.GENERAL_PRESSURE_SENSITIVITY, Config.DEFAULT_PRESSURE_SENSITIVITY)
var constant_pressure: bool = Settings.get_value(Settings.GENERAL_CONSTANT_PRESSURE, Config.DEFAULT_CONSTANT_PRESSURE)
Expand Down Expand Up @@ -114,6 +117,7 @@ func _set_values() -> void:
_ui_scale.set_editable(true)

_set_languages(locale)
_set_tablet_drivers(driver)
_set_rounding()
_set_keybindings()
_set_ui_scale_range()
Expand Down Expand Up @@ -176,6 +180,15 @@ func _set_languages(current_locale: String) -> void:
var id := Array(Settings.locales).find(current_locale)
_language.selected = _language.get_item_index(id)

#--------------------------------------------------------------------------------------------------
func _set_tablet_drivers(current_driver: String) -> void:
for i: int in DisplayServer.tablet_get_driver_count():
var driver := DisplayServer.tablet_get_driver_name(i)
if driver != "dummy":
_tablet_driver.add_item(driver)
if current_driver == driver:
_tablet_driver.selected = i

#--------------------------------------------------------------------------------------------------
func _set_keybindings() -> void:
for action: KeybindingsManager.Action in KeybindingsManager.get_actions():
Expand Down Expand Up @@ -278,6 +291,12 @@ func _on_language_selected(idx: int) -> void:
GlobalSignals.language_changed.emit()
_restart_label.show()

# -------------------------------------------------------------------------------------------------
func _on_tablet_driver_selected(idx: int) -> void:
var driver := _tablet_driver.get_item_text(idx)
Settings.set_value(Settings.GENERAL_TABLET_DRIVER, driver)
DisplayServer.tablet_set_current_driver(driver)

# -------------------------------------------------------------------------------------------------
func _on_ui_scale_mode_selected(index: int) -> void:
match index:
Expand Down
15 changes: 15 additions & 0 deletions lorien/UI/Dialogs/SettingsDialog.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,21 @@ placeholder_text = "e.g. C:/Users/me/Lorien"
layout_mode = 2
theme_override_constants/separation = 24

[node name="TabletDriver" type="HBoxContainer" parent="VBoxContainer/MarginContainer/VBoxContainer/GeneralContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3

[node name="Label" type="Label" parent="VBoxContainer/MarginContainer/VBoxContainer/GeneralContainer/VBoxContainer/TabletDriver"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 6
text = "SETTINGS_TABLET_DRIVER"

[node name="TabletDriver" type="OptionButton" parent="VBoxContainer/MarginContainer/VBoxContainer/GeneralContainer/VBoxContainer/TabletDriver"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3

[node name="Language" type="HBoxContainer" parent="VBoxContainer/MarginContainer/VBoxContainer/GeneralContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
Expand Down
4 changes: 4 additions & 0 deletions lorien/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ canvas_pan_key={
]
}

[input_devices]

pen_tablet/driver.windows="wintab"

[locale]

translation_remaps={
Expand Down