Merge pull request #102940 from bruvzg/tab_ed

Add editor setting to override tablet driver.
This commit is contained in:
Thaddeus Crews 2025-03-11 14:00:51 -05:00
commit c8ddbfbd38
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
5 changed files with 47 additions and 1 deletions

View File

@ -909,6 +909,9 @@
[b]Note:[/b] To query whether the editor can use multiple windows in an editor plugin, use [method EditorInterface.is_multi_window_enabled] instead of querying the value of this editor setting.
[b]Note:[/b] If [code]true[/code], game embedding is disabled.
</member>
<member name="interface/editor/tablet_driver" type="int" setter="" getter="">
Overrides the tablet driver used by the editor.
</member>
<member name="interface/editor/ui_layout_direction" type="int" setter="" getter="">
Editor UI default layout direction.
</member>

View File

@ -789,6 +789,19 @@ void EditorNode::_notification(int p_what) {
EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int());
}
if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/tablet_driver")) {
String tablet_driver = GLOBAL_GET("input_devices/pen_tablet/driver");
int tablet_driver_idx = EDITOR_GET("interface/editor/tablet_driver");
if (tablet_driver_idx != -1) {
tablet_driver = DisplayServer::get_singleton()->tablet_get_driver_name(tablet_driver_idx);
}
if (tablet_driver.is_empty()) {
tablet_driver = DisplayServer::get_singleton()->tablet_get_driver_name(0);
}
DisplayServer::get_singleton()->tablet_set_current_driver(tablet_driver);
print_verbose("Using \"" + DisplayServer::get_singleton()->tablet_get_current_driver() + "\" pen tablet driver...");
}
if (EDITOR_GET("interface/editor/import_resources_when_unfocused")) {
scan_changes_timer->start();
} else {

View File

@ -315,6 +315,8 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["webrtc"] = "WebRTC";
capitalize_string_remaps["websocket"] = "WebSocket";
capitalize_string_remaps["wine"] = "wine";
capitalize_string_remaps["wintab"] = "WinTab";
capitalize_string_remaps["winink"] = "Windows Ink";
capitalize_string_remaps["wifi"] = "Wi-Fi";
capitalize_string_remaps["x86"] = "x86";
capitalize_string_remaps["x86_32"] = "x86_32";

View File

@ -439,6 +439,20 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
}
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/editor_screen", EditorSettings::InitialScreen::INITIAL_SCREEN_AUTO, ed_screen_hints)
#ifdef WINDOWS_ENABLED
String tablet_hints = "Use Project Settings:-1";
for (int i = 0; i < DisplayServer::get_singleton()->tablet_get_driver_count(); i++) {
String drv_name = DisplayServer::get_singleton()->tablet_get_driver_name(i);
if (EditorPropertyNameProcessor::get_singleton()) {
drv_name = EditorPropertyNameProcessor::get_singleton()->process_name(drv_name, EditorPropertyNameProcessor::STYLE_CAPITALIZED); // Note: EditorPropertyNameProcessor is not available when doctool is used, but this value is not part of docs.
}
tablet_hints += vformat(",%s:%d", drv_name, i);
}
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/tablet_driver", -1, tablet_hints);
#else
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/tablet_driver", -1, "Default:-1");
#endif
String project_manager_screen_hints = "Screen With Mouse Pointer:-4,Screen With Keyboard Focus:-3,Primary Screen:-2";
for (int i = 0; i < DisplayServer::get_singleton()->get_screen_count(); i++) {
project_manager_screen_hints += ",Screen " + itos(i + 1) + ":" + itos(i);

View File

@ -2786,6 +2786,7 @@ Error Main::setup2(bool p_show_boot_logo) {
print_header(false);
#ifdef TOOLS_ENABLED
int tablet_driver_editor = -1;
if (editor || project_manager || cmdline_tool) {
OS::get_singleton()->benchmark_begin_measure("Startup", "Initialize Early Settings");
@ -2820,6 +2821,8 @@ Error Main::setup2(bool p_show_boot_logo) {
bool prefer_wayland_found = false;
bool prefer_wayland = false;
bool tablet_found = false;
if (editor) {
screen_property = "interface/editor/editor_screen";
} else if (project_manager) {
@ -2834,7 +2837,7 @@ Error Main::setup2(bool p_show_boot_logo) {
prefer_wayland_found = true;
}
while (!screen_found || !prefer_wayland_found) {
while (!screen_found || !prefer_wayland_found || !tablet_found) {
assign = Variant();
next_tag.fields.clear();
next_tag.name = String();
@ -2858,6 +2861,11 @@ Error Main::setup2(bool p_show_boot_logo) {
prefer_wayland = value;
prefer_wayland_found = true;
}
if (!tablet_found && assign == "interface/editor/tablet_driver") {
tablet_driver_editor = value;
tablet_found = true;
}
}
}
@ -3126,6 +3134,12 @@ Error Main::setup2(bool p_show_boot_logo) {
GLOBAL_DEF_RST_NOVAL("input_devices/pen_tablet/driver", "");
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "input_devices/pen_tablet/driver.windows", PROPERTY_HINT_ENUM, "auto,winink,wintab,dummy"), "");
#ifdef TOOLS_ENABLED
if (tablet_driver.is_empty() && tablet_driver_editor != -1) {
tablet_driver = DisplayServer::get_singleton()->tablet_get_driver_name(tablet_driver_editor);
}
#endif
if (tablet_driver.is_empty()) { // specified in project.godot
tablet_driver = GLOBAL_GET("input_devices/pen_tablet/driver");
if (tablet_driver.is_empty()) {