From f2ab6bd01cf54b760543d26c1de4103d85a3a41e Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 31 Aug 2021 16:17:56 +0200 Subject: [PATCH 01/22] Improve messages when compiling for Linux/*BSD - Don't display messages when enabling PulseAudio/ALSA/D-Bus/udev as these become noisy in incremental builds. - Improve warning and error messages to be more descriptive and consistent. (cherry picked from commit 4c5deea83e7e4d4b9b57446e1cabd3da2e0b2b0f) --- platform/x11/detect.py | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 542223ef964..4b02d0d7036 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -19,40 +19,42 @@ def can_build(): # Check the minimal dependencies x11_error = os.system("pkg-config --version > /dev/null") if x11_error: + print("Error: pkg-config not found. Aborting.") return False - x11_error = os.system("pkg-config x11 --modversion > /dev/null ") + x11_error = os.system("pkg-config x11 --modversion > /dev/null") if x11_error: + print("Error: X11 libraries not found. Aborting.") return False - x11_error = os.system("pkg-config xcursor --modversion > /dev/null ") + x11_error = os.system("pkg-config xcursor --modversion > /dev/null") if x11_error: - print("xcursor not found.. x11 disabled.") + print("Error: Xcursor library not found. Aborting.") return False - x11_error = os.system("pkg-config xinerama --modversion > /dev/null ") + x11_error = os.system("pkg-config xinerama --modversion > /dev/null") if x11_error: - print("xinerama not found.. x11 disabled.") + print("Error: Xinerama library not found. Aborting.") return False - x11_error = os.system("pkg-config xext --modversion > /dev/null ") + x11_error = os.system("pkg-config xext --modversion > /dev/null") if x11_error: - print("xext not found.. x11 disabled.") + print("Error: Xext library not found. Aborting.") return False - x11_error = os.system("pkg-config xrandr --modversion > /dev/null ") + x11_error = os.system("pkg-config xrandr --modversion > /dev/null") if x11_error: - print("xrandr not found.. x11 disabled.") + print("Error: XrandR library not found. Aborting.") return False - x11_error = os.system("pkg-config xrender --modversion > /dev/null ") + x11_error = os.system("pkg-config xrender --modversion > /dev/null") if x11_error: - print("xrender not found.. x11 disabled.") + print("Error: XRender library not found. Aborting.") return False - x11_error = os.system("pkg-config xi --modversion > /dev/null ") + x11_error = os.system("pkg-config xi --modversion > /dev/null") if x11_error: - print("xi not found.. Aborting.") + print("Error: Xi library not found. Aborting.") return False return True @@ -138,7 +140,7 @@ def configure(env): # A convenience so you don't need to write use_lto too when using SCons env["use_lto"] = True else: - print("Using LLD with GCC is not supported yet, try compiling with 'use_llvm=yes'.") + print("Using LLD with GCC is not supported yet. Try compiling with 'use_llvm=yes'.") sys.exit(255) if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]: @@ -318,28 +320,25 @@ def configure(env): ## Flags if os.system("pkg-config --exists alsa") == 0: # 0 means found - print("Enabling ALSA") env["alsa"] = True env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"]) else: - print("ALSA libraries not found, disabling driver") + print("Warning: ALSA libraries not found. Disabling the ALSA audio driver.") if env["pulseaudio"]: if os.system("pkg-config --exists libpulse") == 0: # 0 means found - print("Enabling PulseAudio") env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED"]) env.ParseConfig("pkg-config --cflags libpulse") else: - print("PulseAudio development libraries not found, disabling driver") + print("Warning: PulseAudio development libraries not found. Disabling the PulseAudio audio driver.") if platform.system() == "Linux": env.Append(CPPDEFINES=["JOYDEV_ENABLED"]) if env["udev"]: if os.system("pkg-config --exists libudev") == 0: # 0 means found - print("Enabling udev support") env.Append(CPPDEFINES=["UDEV_ENABLED"]) else: - print("libudev development libraries not found, disabling udev support") + print("Warning: libudev development libraries not found. Disabling controller hotplugging support.") else: env["udev"] = False # Linux specific @@ -368,7 +367,7 @@ def configure(env): gnu_ld_version = re.search("^GNU ld [^$]*(\d+\.\d+)$", linker_version_str, re.MULTILINE) if not gnu_ld_version: print( - "Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld" + "Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld, not gold or LLD." ) else: if float(gnu_ld_version.group(1)) >= 2.30: From b7f466012c5b471a2db8a09e2ff6edc7687f6450 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Tue, 14 Sep 2021 03:38:52 +0200 Subject: [PATCH 02/22] [HTML5] Fix bug in AudioWorklet when reading output buffer. Would attempt an out of bounds read, causing an exception. (cherry picked from commit ba08f39e47f12c6910388f41367305c93eaa06e4) --- platform/javascript/js/libs/audio.worklet.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/platform/javascript/js/libs/audio.worklet.js b/platform/javascript/js/libs/audio.worklet.js index 6b3f80c6a94..d109e4033df 100644 --- a/platform/javascript/js/libs/audio.worklet.js +++ b/platform/javascript/js/libs/audio.worklet.js @@ -66,17 +66,17 @@ class RingBuffer { const mw = this.buffer.length - this.wpos; if (mw >= to_write) { this.buffer.set(p_buffer, this.wpos); + this.wpos += to_write; + if (mw === to_write) { + this.wpos = 0; + } } else { - const high = p_buffer.subarray(0, to_write - mw); - const low = p_buffer.subarray(to_write - mw); + const high = p_buffer.subarray(0, mw); + const low = p_buffer.subarray(mw); this.buffer.set(high, this.wpos); this.buffer.set(low); + this.wpos = low.length; } - let diff = to_write; - if (this.wpos + diff >= this.buffer.length) { - diff -= this.buffer.length; - } - this.wpos += diff; Atomics.add(this.avail, 0, to_write); Atomics.notify(this.avail, 0); } From 210ab1164367e2b8661c6200ce24c54c1eb768f1 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 31 Aug 2021 17:06:18 +0200 Subject: [PATCH 03/22] Write node groups one a single line when saving a `.tscn` file This makes `.tscn` files more readable by ensuring sections are always written on a single line. (cherry picked from commit d33a7367b6748a3fac70bb90ebf930c7a663430f) --- scene/resources/resource_format_text.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 27a349d75c4..f22bcb8d101 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1635,10 +1635,16 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r } if (groups.size()) { + // Write all groups on the same line as they're part of a section header. + // This improves readability while not impacting VCS friendliness too much, + // since it's rare to have more than 5 groups assigned to a single node. groups.sort_custom(); - String sgroups = " groups=[\n"; + String sgroups = " groups=["; for (int j = 0; j < groups.size(); j++) { - sgroups += "\"" + String(groups[j]).c_escape() + "\",\n"; + sgroups += "\"" + String(groups[j]).c_escape() + "\""; + if (j < groups.size() - 1) { + sgroups += ", "; + } } sgroups += "]"; header += sgroups; From de3f454c27c4598961583b2ac86b67a159478ee6 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 1 Sep 2021 17:49:57 +0200 Subject: [PATCH 04/22] Tweak skeleton editor texts "Make Rest Pose" and "Set Bones to Rest Pose" The new terms are more descriptive of each button's actual function. (cherry picked from commit 16cfb97ca20ae04dc1d3a87dcc24cec5bb38266c) --- editor/plugins/skeleton_2d_editor_plugin.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp index c39b9f3167e..63251e5f2f6 100644 --- a/editor/plugins/skeleton_2d_editor_plugin.cpp +++ b/editor/plugins/skeleton_2d_editor_plugin.cpp @@ -99,9 +99,10 @@ Skeleton2DEditor::Skeleton2DEditor() { options->set_text(TTR("Skeleton2D")); options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Skeleton2D", "EditorIcons")); - options->get_popup()->add_item(TTR("Make Rest Pose (From Bones)"), MENU_OPTION_MAKE_REST); + options->get_popup()->add_item(TTR("Reset to Rest Pose"), MENU_OPTION_MAKE_REST); options->get_popup()->add_separator(); - options->get_popup()->add_item(TTR("Set Bones to Rest Pose"), MENU_OPTION_SET_REST); + // Use the "Overwrite" word to highlight that this is a destructive operation. + options->get_popup()->add_item(TTR("Overwrite Rest Pose"), MENU_OPTION_SET_REST); options->set_switch_on_hover(true); options->get_popup()->connect("id_pressed", this, "_menu_option"); From 1454d6c670fb763476915e409b0a1882d28840a1 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Wed, 1 Sep 2021 09:41:27 -0700 Subject: [PATCH 05/22] Add support for adding plugin views behind the main view on Android Doesn't change the default behavior, but allows plugins to add their view behind the main view, which gives more control over what happens with inputs and can be useful along with transparent rendering. (cherry picked from commit 0b681d58343e85d2ad63597a24fa6a9488fe8b42) --- .../java/lib/src/org/godotengine/godot/Godot.java | 6 +++++- .../org/godotengine/godot/plugin/GodotPlugin.java | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index 93f9db4d339..04cbdfe65c4 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -398,7 +398,11 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC for (GodotPlugin plugin : pluginRegistry.getAllPlugins()) { View pluginView = plugin.onMainCreate(activity); if (pluginView != null) { - containerLayout.addView(pluginView); + if (plugin.shouldBeOnTop()) { + containerLayout.addView(pluginView); + } else { + containerLayout.addView(pluginView, 0); + } } } } diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java index 48c56a6c6d0..f8a3a5d49df 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java @@ -190,6 +190,9 @@ public abstract class GodotPlugin { * The plugin can return a non-null {@link View} layout in order to add it to the Godot view * hierarchy. * + * Use shouldBeOnTop() to set whether the plugin's {@link View} should be added on top or behind + * the main Godot view. + * * @see Activity#onCreate(Bundle) * @return the plugin's view to be included; null if no views should be included. */ @@ -293,6 +296,17 @@ public abstract class GodotPlugin { return Collections.emptySet(); } + /** + * Returns whether the plugin's {@link View} returned in onMainCreate() should be placed on + * top of the main Godot view. + * + * Returning false causes the plugin's {@link View} to be placed behind, which can be useful + * when used with transparency in order to let the Godot view handle inputs. + */ + public boolean shouldBeOnTop() { + return true; + } + /** * Runs the specified action on the UI thread. If the current thread is the UI * thread, then the action is executed immediately. If the current thread is From 2cd626185c5ea0d0af4cebcc605301ae142e6c00 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 28 Oct 2019 00:38:44 +0100 Subject: [PATCH 06/22] Capitalize properties in the remote inspector This makes property casing consistent with the editor. If property capitalization is disabled in the Editor Settings, the remote inspector will also disable capitalization. (cherry picked from commit 854f3285179f34d93287cef514affc842834ea32) --- editor/editor_node.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 7788e6f448f..07508ffbdbb 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1985,7 +1985,6 @@ void EditorNode::_edit_current() { Object *prev_inspected_object = get_inspector()->get_edited_object(); - bool capitalize = bool(EDITOR_GET("interface/inspector/capitalize_properties")); bool disable_folding = bool(EDITOR_GET("interface/inspector/disable_folding")); bool is_resource = current_obj->is_class("Resource"); bool is_node = current_obj->is_class("Node"); @@ -2043,7 +2042,6 @@ void EditorNode::_edit_current() { if (current_obj->is_class("ScriptEditorDebuggerInspectedObject")) { editable_warning = TTR("This is a remote object, so changes to it won't be kept.\nPlease read the documentation relevant to debugging to better understand this workflow."); - capitalize = false; disable_folding = true; } else if (current_obj->is_class("MultiNodeEdit")) { Node *scene = get_edited_scene(); @@ -2080,10 +2078,6 @@ void EditorNode::_edit_current() { inspector_dock->set_warning(editable_warning); - if (get_inspector()->is_capitalize_paths_enabled() != capitalize) { - get_inspector()->set_enable_capitalize_paths(capitalize); - } - if (get_inspector()->is_using_folding() == disable_folding) { get_inspector()->set_use_folding(!disable_folding); } From ca2372164be14328275da03d164687547fd8d229 Mon Sep 17 00:00:00 2001 From: Daniel Kariv <38776931+danielkariv@users.noreply.github.com> Date: Fri, 3 Sep 2021 14:35:28 +0300 Subject: [PATCH 07/22] fix fullscreen issue on macOS adds a call for resize event. (cherry picked from commit 52b114bc78959ea20546ba644d0ab272ab285403) --- platform/osx/os_osx.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 3b435b55310..e4df51f983a 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -306,6 +306,8 @@ static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) { [OS_OSX::singleton->window_object setContentMinSize:NSMakeSize(0, 0)]; [OS_OSX::singleton->window_object setContentMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)]; + // Force window resize event. + [self windowDidResize:notification]; } - (void)windowDidExitFullScreen:(NSNotification *)notification { @@ -325,6 +327,9 @@ static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) { if (OS_OSX::singleton->on_top) [OS_OSX::singleton->window_object setLevel:NSFloatingWindowLevel]; + + // Force window resize event. + [self windowDidResize:notification]; } - (void)windowDidChangeBackingProperties:(NSNotification *)notification { From e1be41b2c658d3290ca7ed6da44a05934ac33bf3 Mon Sep 17 00:00:00 2001 From: Arthur Paulino Date: Fri, 3 Sep 2021 11:10:33 -0300 Subject: [PATCH 08/22] improving note on HTTPRequest class under the request method documentation (cherry picked from commit 1ed3d9a0b0a0a69070af59eee4325f69c4302dc7) --- doc/classes/HTTPRequest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index 69c01c934fe..ba0289f439f 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -110,7 +110,7 @@ Creates request on the underlying [HTTPClient]. If there is no configuration errors, it tries to connect using [method HTTPClient.connect_to_host] and passes parameters onto [method HTTPClient.request]. Returns [constant OK] if request is successfully created. (Does not imply that the server has responded), [constant ERR_UNCONFIGURED] if not in the tree, [constant ERR_BUSY] if still processing previous request, [constant ERR_INVALID_PARAMETER] if given string is not a valid URL format, or [constant ERR_CANT_CONNECT] if not using thread and the [HTTPClient] cannot connect to host. - [b]Note:[/b] The [code]request_data[/code] parameter is ignored if [code]method[/code] is [constant HTTPClient.METHOD_GET]. This is because GET methods can't contain request data. As a workaround, you can pass request data as a query string in the URL. See [method String.http_escape] for an example. + [b]Note:[/b] When [code]method[/code] is [constant HTTPClient.METHOD_GET], the payload sent via [code]request_data[/code] might be ignored by the server or even cause the server to reject the request (check [url=https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1]RFC 7231 section 4.3.1[/url] for more details). As a workaround, you can send data as a query string in the URL. See [method String.http_escape] for an example. From 59eafe4cd3a0eefb2202ec7d1169c46b82f808f1 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 31 Aug 2021 20:02:55 +0200 Subject: [PATCH 09/22] Remove `#ifdefs` for handling compilation with Visual Studio < 2015 Godot 3.3 and later require Visual Studio 2017 to be compiled. (cherry picked from commit fc0bfbb33b671ea03168d6cb39b83e0a3fb13c53) --- core/ustring.cpp | 6 +++--- modules/mono/utils/string_utils.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/ustring.cpp b/core/ustring.cpp index 0d0311f1721..eabc34dfd82 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -1394,13 +1394,13 @@ String String::num_scientific(double p_num) { #if defined(__GNUC__) || defined(_MSC_VER) -#if (defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900)) && defined(_TWO_DIGIT_EXPONENT) && !defined(_UCRT) - // MinGW and old MSC require _set_output_format() to conform to C99 output for printf +#if defined(__MINGW32__) && defined(_TWO_DIGIT_EXPONENT) && !defined(_UCRT) + // MinGW requires _set_output_format() to conform to C99 output for printf unsigned int old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT); #endif snprintf(buf, 256, "%lg", p_num); -#if (defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900)) && defined(_TWO_DIGIT_EXPONENT) && !defined(_UCRT) +#if defined(__MINGW32__) && defined(_TWO_DIGIT_EXPONENT) && !defined(_UCRT) _set_output_format(old_exponent_format); #endif diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp index 8f9d10b9510..050abae1526 100644 --- a/modules/mono/utils/string_utils.cpp +++ b/modules/mono/utils/string_utils.cpp @@ -206,7 +206,7 @@ String str_format(const char *p_format, ...) { #endif #endif -#if defined(MINGW_ENABLED) || defined(_MSC_VER) && _MSC_VER < 1900 +#if defined(MINGW_ENABLED) #define gd_vsnprintf(m_buffer, m_count, m_format, m_args_copy) vsnprintf_s(m_buffer, m_count, _TRUNCATE, m_format, m_args_copy) #define gd_vscprintf(m_format, m_args_copy) _vscprintf(m_format, m_args_copy) #else From fe745e2fff9b252dc51b50c858b1ae7b736ee106 Mon Sep 17 00:00:00 2001 From: kobewi Date: Tue, 7 Sep 2021 22:19:45 +0200 Subject: [PATCH 10/22] Close built-in script from any scene (cherry picked from commit 1a605096998ca33c84946eca0834e8a7963656a7) --- editor/editor_data.cpp | 4 ++++ editor/editor_node.cpp | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 75eddae76cb..3595e4cc54b 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -543,6 +543,10 @@ void EditorData::remove_scene(int p_idx) { current_edited_scene--; } + if (edited_scene[p_idx].path != String()) { + ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(edited_scene[p_idx].path); + } + edited_scene.remove(p_idx); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 07508ffbdbb..0caa57bf473 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3275,10 +3275,6 @@ void EditorNode::_remove_edited_scene(bool p_change_tab) { new_index = 1; } - if (editor_data.get_scene_path(old_index) != String()) { - ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(editor_data.get_scene_path(old_index)); - } - if (p_change_tab) { _scene_tab_changed(new_index); } From 92377f4b20fa1c9fac4e573a8baf86cd58363656 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Sun, 22 Aug 2021 00:23:55 +0300 Subject: [PATCH 11/22] [macOS] Request camera permission before session init. (cherry picked from commit e6801a098e49f7326b3b3601485d7ee9be96c4e4) --- modules/camera/camera_osx.mm | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/modules/camera/camera_osx.mm b/modules/camera/camera_osx.mm index 815b9d53402..f7cd419a3ce 100644 --- a/modules/camera/camera_osx.mm +++ b/modules/camera/camera_osx.mm @@ -33,6 +33,7 @@ #include "camera_osx.h" #include "servers/camera/camera_feed.h" + #import ////////////////////////////////////////////////////////////////////////// @@ -253,10 +254,25 @@ CameraFeedOSX::~CameraFeedOSX() { bool CameraFeedOSX::activate_feed() { if (capture_session) { - // already recording! + // Already recording! } else { - // start camera capture - capture_session = [[MyCaptureSession alloc] initForFeed:this andDevice:device]; + // Start camera capture, check permission. + if (@available(macOS 10.14, *)) { + AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; + if (status == AVAuthorizationStatusAuthorized) { + capture_session = [[MyCaptureSession alloc] initForFeed:this andDevice:device]; + } else if (status == AVAuthorizationStatusNotDetermined) { + // Request permission. + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo + completionHandler:^(BOOL granted) { + if (granted) { + capture_session = [[MyCaptureSession alloc] initForFeed:this andDevice:device]; + } + }]; + } + } else { + capture_session = [[MyCaptureSession alloc] initForFeed:this andDevice:device]; + } }; return true; From 520b2d822a544fa76013b6b581e85abeadd8f51e Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 1 Sep 2021 15:02:42 +0200 Subject: [PATCH 12/22] Display the node name in scene tree dock tooltips This makes long node names previewable without having to rename them. (cherry picked from commit c673aea1242a2fba2a0563c8503c6638f4e87d4a) --- editor/scene_tree_editor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index e5cb926a499..e408085537e 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -290,10 +290,12 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll } } + // Display the node name in all tooltips so that long node names can be previewed + // without having to rename them. if (p_node == get_scene_node() && p_node->get_scene_inherited_state().is_valid()) { item->add_button(0, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Open in Editor")); - String tooltip = TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path() + "\n" + TTR("Type:") + " " + p_node->get_class(); + String tooltip = String(p_node->get_name()) + "\n" + TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path() + "\n" + TTR("Type:") + " " + p_node->get_class(); if (p_node->get_editor_description() != String()) { tooltip += "\n\n" + p_node->get_editor_description(); } @@ -302,7 +304,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll } else if (p_node != get_scene_node() && p_node->get_filename() != "" && can_open_instance) { item->add_button(0, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Open in Editor")); - String tooltip = TTR("Instance:") + " " + p_node->get_filename() + "\n" + TTR("Type:") + " " + p_node->get_class(); + String tooltip = String(p_node->get_name()) + "\n" + TTR("Instance:") + " " + p_node->get_filename() + "\n" + TTR("Type:") + " " + p_node->get_class(); if (p_node->get_editor_description() != String()) { tooltip += "\n\n" + p_node->get_editor_description(); } @@ -314,7 +316,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll type = p_node->get_class(); } - String tooltip = TTR("Type:") + " " + type; + String tooltip = String(p_node->get_name()) + "\n" + TTR("Type:") + " " + type; if (p_node->get_editor_description() != String()) { tooltip += "\n\n" + p_node->get_editor_description(); } From cce7e6c9d6690c1ff0fac05ca06f0831432246cd Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Tue, 31 Aug 2021 11:02:59 +0100 Subject: [PATCH 13/22] Use current androidx Fragment library instead of legacy libraries (cherry picked from commit 23311a6ed3b9fc5bdddaeaf77a05a6d82692a779) --- platform/android/java/app/build.gradle | 3 +-- platform/android/java/app/config.gradle | 6 ++---- platform/android/java/lib/build.gradle | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/platform/android/java/app/build.gradle b/platform/android/java/app/build.gradle index 856f23ad8e8..043b09e106e 100644 --- a/platform/android/java/app/build.gradle +++ b/platform/android/java/app/build.gradle @@ -43,9 +43,8 @@ allprojects { } dependencies { - implementation libraries.supportCoreUtils implementation libraries.kotlinStdLib - implementation libraries.v4Support + implementation libraries.androidxFragment if (rootProject.findProject(":lib")) { implementation project(":lib") diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle index fad64c675fc..fcee54e493b 100644 --- a/platform/android/java/app/config.gradle +++ b/platform/android/java/app/config.gradle @@ -4,9 +4,8 @@ ext.versions = [ minSdk : 19, targetSdk : 30, buildTools : '30.0.3', - supportCoreUtils : '1.0.0', kotlinVersion : '1.5.10', - v4Support : '1.0.0', + fragmentVersion : '1.3.6', javaVersion : 1.8, ndkVersion : '21.4.7075529' // Also update 'platform/android/detect.py#get_project_ndk_version()' when this is updated. @@ -14,10 +13,9 @@ ext.versions = [ ext.libraries = [ androidGradlePlugin: "com.android.tools.build:gradle:$versions.androidGradlePlugin", - supportCoreUtils : "androidx.legacy:legacy-support-core-utils:$versions.supportCoreUtils", kotlinGradlePlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlinVersion", kotlinStdLib : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlinVersion", - v4Support : "androidx.legacy:legacy-support-v4:$versions.v4Support" + androidxFragment : "androidx.fragment:fragment:$versions.fragmentVersion", ] ext.getExportPackageName = { -> diff --git a/platform/android/java/lib/build.gradle b/platform/android/java/lib/build.gradle index 663ba73d406..fbed4ed0787 100644 --- a/platform/android/java/lib/build.gradle +++ b/platform/android/java/lib/build.gradle @@ -2,9 +2,8 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' dependencies { - implementation libraries.supportCoreUtils implementation libraries.kotlinStdLib - implementation libraries.v4Support + implementation libraries.androidxFragment } def pathToRootDir = "../../../../" From e1330418abe156b86776fbd04c2ae909cfee82cc Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 1 Sep 2021 15:36:51 +0200 Subject: [PATCH 14/22] Document that node groups don't have a guaranteed order (cherry picked from commit 0adf1a6683217b331d4ccf7f1d146781f6185dce) --- doc/classes/Node.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 235a57449c2..183c80a6c6c 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -138,6 +138,7 @@ Adds the node to a group. Groups are helpers to name and organize a subset of nodes, for example "enemies" or "collectables". A node can be in any number of groups. Nodes can be assigned a group at any time, but will not be added until they are inside the scene tree (see [method is_inside_tree]). See notes in the description, and the group methods in [SceneTree]. The [code]persistent[/code] option is used when packing node to [PackedScene] and saving to file. Non-persistent groups aren't stored. + [b]Note:[/b] For performance reasons, the order of node groups is [i]not[/i] guaranteed. The order of node groups should not be relied upon as it can vary across project runs. @@ -200,6 +201,7 @@ Returns an array listing the groups that the node is a member of. + [b]Note:[/b] For performance reasons, the order of node groups is [i]not[/i] guaranteed. The order of node groups should not be relied upon as it can vary across project runs. From af76e5fddc6cdda57962844d6648e06e927af1ac Mon Sep 17 00:00:00 2001 From: Austin Tasato Date: Wed, 1 Sep 2021 05:57:35 -0700 Subject: [PATCH 15/22] Add "Physics intro" docs link for State classes (cherry picked from commit ce8eb09a25874c46370541fbd9e91a198dabf04b) --- doc/classes/Physics2DDirectBodyState.xml | 3 ++- doc/classes/Physics2DDirectSpaceState.xml | 3 ++- doc/classes/PhysicsDirectBodyState.xml | 2 ++ doc/classes/PhysicsDirectSpaceState.xml | 3 ++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/classes/Physics2DDirectBodyState.xml b/doc/classes/Physics2DDirectBodyState.xml index 1202f77e1e7..ec85ae0cedc 100644 --- a/doc/classes/Physics2DDirectBodyState.xml +++ b/doc/classes/Physics2DDirectBodyState.xml @@ -7,7 +7,8 @@ Provides direct access to a physics body in the [Physics2DServer], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody2D._integrate_forces]. - https://docs.godotengine.org/en/3.4/tutorials/physics/ray-casting.html + https://docs.godotengine.org/en/3.4/tutorials/physics/physics_introduction.html + https://docs.godotengine.org/en/3.4/tutorials/physics/ray-casting.html diff --git a/doc/classes/Physics2DDirectSpaceState.xml b/doc/classes/Physics2DDirectSpaceState.xml index 5f64103f727..6cc61535f5b 100644 --- a/doc/classes/Physics2DDirectSpaceState.xml +++ b/doc/classes/Physics2DDirectSpaceState.xml @@ -7,7 +7,8 @@ Direct access object to a space in the [Physics2DServer]. It's used mainly to do queries against objects and areas residing in a given space. - https://docs.godotengine.org/en/3.4/tutorials/physics/ray-casting.html + https://docs.godotengine.org/en/3.4/tutorials/physics/physics_introduction.html + https://docs.godotengine.org/en/3.4/tutorials/physics/ray-casting.html diff --git a/doc/classes/PhysicsDirectBodyState.xml b/doc/classes/PhysicsDirectBodyState.xml index 4d3f77bb496..d4bc395305e 100644 --- a/doc/classes/PhysicsDirectBodyState.xml +++ b/doc/classes/PhysicsDirectBodyState.xml @@ -7,6 +7,8 @@ Provides direct access to a physics body in the [PhysicsServer], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody._integrate_forces]. + https://docs.godotengine.org/en/3.4/tutorials/physics/physics_introduction.html + https://docs.godotengine.org/en/3.4/tutorials/physics/ray-casting.html diff --git a/doc/classes/PhysicsDirectSpaceState.xml b/doc/classes/PhysicsDirectSpaceState.xml index 903b4ef998b..f8228230a4f 100644 --- a/doc/classes/PhysicsDirectSpaceState.xml +++ b/doc/classes/PhysicsDirectSpaceState.xml @@ -7,7 +7,8 @@ Direct access object to a space in the [PhysicsServer]. It's used mainly to do queries against objects and areas residing in a given space. - https://docs.godotengine.org/en/3.4/tutorials/physics/ray-casting.html + https://docs.godotengine.org/en/3.4/tutorials/physics/physics_introduction.html + https://docs.godotengine.org/en/3.4/tutorials/physics/ray-casting.html From cc04b4ceba24de712ca8763783c04aae502aadae Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 14 Jun 2021 12:44:32 -0400 Subject: [PATCH 16/22] Wrote JNISinglton docs I added a few descriptions and links to the empty JNISingleton class doc. (cherry picked from commit 4eff57d39bb608afdaae8b29f9226481a1520c0b) --- doc/classes/JNISingleton.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/classes/JNISingleton.xml b/doc/classes/JNISingleton.xml index 403c3f85564..e6f87bfb713 100644 --- a/doc/classes/JNISingleton.xml +++ b/doc/classes/JNISingleton.xml @@ -1,10 +1,13 @@ + Singleton that connects the engine with Android plugins to interface with native Android code. + The JNISingleton is implemented only in the Android export. It's used to call methods and connect signals from an Android plugin written in Java or Kotlin. Methods and signals can be called and connected to the JNISingleton as if it is a Node. See [url=https://en.wikipedia.org/wiki/Java_Native_Interface]Java Native Interface - Wikipedia[/url] for more information. + https://docs.godotengine.org/en/3.4/tutorials/plugins/android/android_plugin.html From fb17ac885ac33d2d1e0435be9583b2c8d1c50713 Mon Sep 17 00:00:00 2001 From: Zak Date: Thu, 4 Mar 2021 15:27:14 +0100 Subject: [PATCH 17/22] Improve docs for Thread An attempt to improve the documentation for Thread - Adds documentation on how and when the `wait_to_finish` should be used - Adds a note on what to be careful about when using `wait_to_finish` (cherry picked from commit 9e2882a98982e4d0a8550feca468b87120515bd2) --- doc/classes/Thread.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/classes/Thread.xml b/doc/classes/Thread.xml index 55771704107..6b588646554 100644 --- a/doc/classes/Thread.xml +++ b/doc/classes/Thread.xml @@ -40,6 +40,8 @@ Joins the [Thread] and waits for it to finish. Returns what the method called returned. + Should either be used when you want to retrieve the value returned from the method called by the [Thread] or before freeing the instance that contains the [Thread]. + [b]Note:[/b] After the [Thread] finishes joining it will be disposed. If you want to use it again you will have to create a new instance of it. From 723ad5ef6140b5dede22ab764b4646030e5029ee Mon Sep 17 00:00:00 2001 From: Ricardo Subtil Date: Thu, 9 Sep 2021 15:48:37 +0100 Subject: [PATCH 18/22] Fix path with multiple slashes not being corrected on templates (cherry picked from commit eef0327d1e1a19429157709fc15593a067b0f803) --- core/project_settings.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 540157d6e1f..1d381cdbab0 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -54,11 +54,7 @@ String ProjectSettings::get_resource_path() const { }; String ProjectSettings::localize_path(const String &p_path) const { - if (resource_path == "") { - return p_path; //not initialized yet - } - - if (p_path.begins_with("res://") || p_path.begins_with("user://") || + if (resource_path.empty() || p_path.begins_with("res://") || p_path.begins_with("user://") || (p_path.is_abs_path() && !p_path.begins_with(resource_path))) { return p_path.simplify_path(); } From 0da326c8b3ffc4ad72757e4e3e40a6d19c02a837 Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 9 Sep 2021 00:43:14 +0200 Subject: [PATCH 19/22] Save branch as scene by dropping to filesystem (cherry picked from commit d4f4cfbb40de69613a3dc4cfb1a974c237c93ef3) --- editor/filesystem_dock.cpp | 15 +++++++++++++++ editor/scene_tree_dock.cpp | 5 +++++ editor/scene_tree_dock.h | 1 + 3 files changed, 21 insertions(+) diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index e69fd345d3d..e82b589124d 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2127,6 +2127,14 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da return true; } + if (drag_data.has("type") && String(drag_data["type"]) == "nodes") { + // Save branch as scene. + String to_dir; + bool favorite; + _get_drag_target_folder(to_dir, favorite, p_point, p_from); + return !favorite && Array(drag_data["nodes"]).size() == 1; + } + return false; } @@ -2265,6 +2273,13 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, _update_tree(_compute_uncollapsed_paths()); } } + + if (drag_data.has("type") && String(drag_data["type"]) == "nodes") { + String to_dir; + bool favorite; + _get_drag_target_folder(to_dir, favorite, p_point, p_from); + EditorNode::get_singleton()->get_scene_tree_dock()->save_branch_to_file(to_dir); + } } void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favorites, const Point2 &p_point, Control *p_from) const { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 5fa3b2c6693..1c02cde1f5d 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -2841,6 +2841,11 @@ void SceneTreeDock::set_filter(const String &p_filter) { scene_tree->set_filter(p_filter); } +void SceneTreeDock::save_branch_to_file(String p_directory) { + new_scene_from_dialog->set_current_dir(p_directory); + _tool_selected(TOOL_NEW_SCENE_FROM); +} + void SceneTreeDock::_focus_node() { Node *node = scene_tree->get_selected(); ERR_FAIL_COND(!node); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index a84a8d8aed7..3905fb8f9a5 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -265,6 +265,7 @@ protected: public: String get_filter(); void set_filter(const String &p_filter); + void save_branch_to_file(String p_directory); void _focus_node(); From 0316d50ece15caef29c34e053dbf1df33bf418cc Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Sun, 29 Aug 2021 17:52:59 +0100 Subject: [PATCH 20/22] Improve Basis::get_quaternion error message The previous error message incorrectly suggested that any Basis could be fixed by calling get_rotation_quation() or orthonormalize(). This PR points out that only a valid rotation Basis can be fixed in this way. (cherry picked from commit d3a3b3aff376e759d821d38d9620b1c21c499e6b) --- core/math/basis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/math/basis.cpp b/core/math/basis.cpp index 97494d4be82..e95838a06a4 100644 --- a/core/math/basis.cpp +++ b/core/math/basis.cpp @@ -768,7 +768,7 @@ Basis::operator String() const { Quat Basis::get_quat() const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V_MSG(!is_rotation(), Quat(), "Basis must be normalized in order to be casted to a Quaternion. Use get_rotation_quat() or call orthonormalized() instead."); + ERR_FAIL_COND_V_MSG(!is_rotation(), Quat(), "Basis must be normalized in order to be casted to a Quaternion. Use get_rotation_quat() or call orthonormalized() if the Basis contains linearly independent vectors."); #endif /* Allow getting a quaternion from an unnormalized transform */ Basis m = *this; From a95b015968a74fa66a0fb1a7738059992c96202c Mon Sep 17 00:00:00 2001 From: Silc 'Tokage' Renew Date: Sat, 11 Sep 2021 02:25:47 +0900 Subject: [PATCH 21/22] fixed AnimationNodeTransition when xfade time is zero (cherry picked from commit 02d81664275c6559237216887a9703796ab4fe1a) --- scene/animation/animation_blend_tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 70552e2613f..3fc749d8f63 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -724,7 +724,7 @@ float AnimationNodeTransition::process(float p_time, bool p_seek) { } else { // cross-fading from prev to current - float blend = xfade ? (prev_xfading / xfade) : 1; + float blend = xfade == 0 ? 0 : (prev_xfading / xfade); if (!p_seek && switched) { //just switched, seek to start of current From 91482a00bb5e9635637fc69c193aca40ff0f6c68 Mon Sep 17 00:00:00 2001 From: "John J. Donna II" Date: Wed, 1 Sep 2021 18:56:19 -0400 Subject: [PATCH 22/22] LSP: Add support for custom host setting You can now configure host in the `language_server` settings in the editor settings. (cherry picked from commit be6da39b8af5f95d3086deeceb5d3c38f1ab1717) --- .../language_server/gdscript_language_server.cpp | 10 +++++++--- .../language_server/gdscript_language_server.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/gdscript/language_server/gdscript_language_server.cpp b/modules/gdscript/language_server/gdscript_language_server.cpp index 12ed56a5687..f121b01b299 100644 --- a/modules/gdscript/language_server/gdscript_language_server.cpp +++ b/modules/gdscript/language_server/gdscript_language_server.cpp @@ -38,9 +38,11 @@ GDScriptLanguageServer::GDScriptLanguageServer() { thread_running = false; started = false; - use_thread = false; + host = "127.0.0.1"; port = 6008; + + _EDITOR_DEF("network/language_server/remote_host", host); _EDITOR_DEF("network/language_server/remote_port", port); _EDITOR_DEF("network/language_server/enable_smart_resolve", true); _EDITOR_DEF("network/language_server/show_native_symbols_in_editor", false); @@ -61,9 +63,10 @@ void GDScriptLanguageServer::_notification(int p_what) { } } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + String host = String(_EDITOR_GET("network/language_server/remote_host")); int port = (int)_EDITOR_GET("network/language_server/remote_port"); bool use_thread = (bool)_EDITOR_GET("network/language_server/use_thread"); - if (port != this->port || use_thread != this->use_thread) { + if (host != this->host || port != this->port || use_thread != this->use_thread) { this->stop(); this->start(); } @@ -81,9 +84,10 @@ void GDScriptLanguageServer::thread_main(void *p_userdata) { } void GDScriptLanguageServer::start() { + host = String(_EDITOR_GET("network/language_server/remote_host")); port = (int)_EDITOR_GET("network/language_server/remote_port"); use_thread = (bool)_EDITOR_GET("network/language_server/use_thread"); - if (protocol.start(port, IP_Address("127.0.0.1")) == OK) { + if (protocol.start(port, IP_Address(host)) == OK) { EditorNode::get_log()->add_message("--- GDScript language server started ---", EditorLog::MSG_TYPE_EDITOR); if (use_thread) { thread_running = true; diff --git a/modules/gdscript/language_server/gdscript_language_server.h b/modules/gdscript/language_server/gdscript_language_server.h index 7b7837a4636..14c50909e07 100644 --- a/modules/gdscript/language_server/gdscript_language_server.h +++ b/modules/gdscript/language_server/gdscript_language_server.h @@ -44,6 +44,7 @@ class GDScriptLanguageServer : public EditorPlugin { bool thread_running; bool started; bool use_thread; + String host; int port; static void thread_main(void *p_userdata);