diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 05f6201dc9c..23c317949c7 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -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. + + Overrides the tablet driver used by the editor. + Editor UI default layout direction. diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 5afe2f5c267..e9bcf8c1d37 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -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 { diff --git a/editor/editor_property_name_processor.cpp b/editor/editor_property_name_processor.cpp index f2e7161fca5..3055dc494da 100644 --- a/editor/editor_property_name_processor.cpp +++ b/editor/editor_property_name_processor.cpp @@ -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"; diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index bc1cd247f0b..1326353f92d 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -439,6 +439,20 @@ void EditorSettings::_load_defaults(Ref 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); diff --git a/main/main.cpp b/main/main.cpp index 2b49e4ccfad..7011d7fd4be 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -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()) {