From 71d58272286e431074528bc4e7cb02f4a043792f Mon Sep 17 00:00:00 2001 From: Daylily-Zeleen Date: Thu, 6 Jul 2023 13:14:08 +0800 Subject: [PATCH 01/77] Fixed the fallback logic of OS::shell_show_in_file_manager (cherry picked from commit 9dd9818c8860cd1719ca73f7ce878b9078de4af9) --- core/os/os.cpp | 10 ++++++---- doc/classes/OS.xml | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/os/os.cpp b/core/os/os.cpp index 5704ef7a40d4..67423128a3f4 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -295,12 +295,14 @@ Error OS::shell_open(String p_uri) { } Error OS::shell_show_in_file_manager(String p_path, bool p_open_folder) { - if (!p_path.begins_with("file://")) { - p_path = String("file://") + p_path; - } - if (!p_path.ends_with("/")) { + p_path = p_path.trim_prefix("file://"); + + if (!DirAccess::dir_exists_absolute(p_path)) { p_path = p_path.get_base_dir(); } + + p_path = String("file://") + p_path; + return shell_open(p_path); } // implement these with the canvas? diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 0696ae224a65..f3cc3d07e595 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -657,7 +657,7 @@ Requests the OS to open the file manager, then navigate to the given [param file_or_dir_path] and select the target file or folder. If [param file_or_dir_path] is a valid directory path, and [param open_folder] is [code]true[/code], the method will open the file manager and enter the target folder without selecting anything. Use [method ProjectSettings.globalize_path] to convert a [code]res://[/code] or [code]user://[/code] path into a system path for use with this method. - [b]Note:[/b] Currently this method is only implemented on Windows. On other platforms, it will fallback to [method shell_open] with a directory path for [param file_or_dir_path]. + [b]Note:[/b] Currently this method is only implemented on Windows and macOS. On other platforms, it will fallback to [method shell_open] with a directory path of [param file_or_dir_path] with prefix [code]file://[/code]. From 0ec599473d6204784b83f46d637c2f583a70ff06 Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Thu, 6 Jul 2023 01:04:16 +0200 Subject: [PATCH 02/77] Revert "Fix focusloss of non-exclusive `AcceptDialog` with `close_on_escape`" This reverts commit 7f547fcf09e7af0e2443356fe7a003c3c8335cd6. (cherry picked from commit bfa7497c1bf1073a2fcaaa9badd6f312a7e9bc28) --- scene/gui/dialogs.cpp | 35 ++++++++++++++++++++++++++++++++--- scene/gui/dialogs.h | 3 +++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 9e99bda60b4b..0860bf39682b 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -44,6 +44,12 @@ void AcceptDialog::_input_from_window(const Ref &p_event) { } } +void AcceptDialog::_parent_focused() { + if (close_on_escape && !is_exclusive()) { + _cancel_pressed(); + } +} + void AcceptDialog::_update_theme_item_cache() { Window::_update_theme_item_cache(); @@ -64,6 +70,16 @@ void AcceptDialog::_notification(int p_what) { get_ok_button()->grab_focus(); } _update_child_rects(); + + parent_visible = get_parent_visible_window(); + if (parent_visible) { + parent_visible->connect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused)); + } + } else { + if (parent_visible) { + parent_visible->disconnect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused)); + parent_visible = nullptr; + } } } break; @@ -76,9 +92,10 @@ void AcceptDialog::_notification(int p_what) { } } break; - case NOTIFICATION_WM_WINDOW_FOCUS_OUT: { - if (close_on_escape && !is_exclusive()) { - _cancel_pressed(); + case NOTIFICATION_EXIT_TREE: { + if (parent_visible) { + parent_visible->disconnect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused)); + parent_visible = nullptr; } } break; @@ -112,9 +129,21 @@ void AcceptDialog::_ok_pressed() { } void AcceptDialog::_cancel_pressed() { + Window *parent_window = parent_visible; + if (parent_visible) { + parent_visible->disconnect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused)); + parent_visible = nullptr; + } + call_deferred(SNAME("hide")); + emit_signal(SNAME("canceled")); + cancel_pressed(); + + if (parent_window) { + //parent_window->grab_focus(); + } set_input_as_handled(); } diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h index ebe5ce326a65..1821a886c069 100644 --- a/scene/gui/dialogs.h +++ b/scene/gui/dialogs.h @@ -44,6 +44,8 @@ class LineEdit; class AcceptDialog : public Window { GDCLASS(AcceptDialog, Window); + Window *parent_visible = nullptr; + Panel *bg_panel = nullptr; Label *message_label = nullptr; HBoxContainer *buttons_hbox = nullptr; @@ -63,6 +65,7 @@ class AcceptDialog : public Window { static bool swap_cancel_ok; void _input_from_window(const Ref &p_event); + void _parent_focused(); protected: virtual Size2 _get_contents_minimum_size() const override; From bc9bc236c0dccea63eec1ca3c612498e8e95c176 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Thu, 29 Jun 2023 13:24:40 -0700 Subject: [PATCH 03/77] Initialize particles instance buffer in case it is used before being updated (cherry picked from commit 35ed7c770bd7616bdd43b32c1ea433d574452de5) --- drivers/gles3/storage/particles_storage.cpp | 19 ++++++++----------- .../storage_rd/particles_storage.cpp | 5 ++++- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gles3/storage/particles_storage.cpp b/drivers/gles3/storage/particles_storage.cpp index c50d2c48cc0a..b7ebe055f550 100644 --- a/drivers/gles3/storage/particles_storage.cpp +++ b/drivers/gles3/storage/particles_storage.cpp @@ -820,12 +820,11 @@ void ParticlesStorage::_particles_update_buffers(Particles *particles) { particles->num_attrib_arrays_cache = 5 + userdata_count + (xform_size - 2); particles->process_buffer_stride_cache = sizeof(float) * 4 * particles->num_attrib_arrays_cache; - int process_data_amount = 4 * particles->num_attrib_arrays_cache * total_amount; - float *data = memnew_arr(float, process_data_amount); + PackedByteArray data; + data.resize_zeroed(particles->process_buffer_stride_cache * total_amount); - for (int i = 0; i < process_data_amount; i++) { - data[i] = 0; - } + PackedByteArray instance_data; + instance_data.resize_zeroed(particles->instance_buffer_size_cache); { glGenVertexArrays(1, &particles->front_vertex_array); @@ -834,7 +833,7 @@ void ParticlesStorage::_particles_update_buffers(Particles *particles) { glGenBuffers(1, &particles->front_instance_buffer); glBindBuffer(GL_ARRAY_BUFFER, particles->front_process_buffer); - GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ARRAY_BUFFER, particles->front_process_buffer, particles->process_buffer_stride_cache * total_amount, data, GL_DYNAMIC_COPY, "Particles front process buffer"); + GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ARRAY_BUFFER, particles->front_process_buffer, particles->process_buffer_stride_cache * total_amount, data.ptr(), GL_DYNAMIC_COPY, "Particles front process buffer"); for (uint32_t j = 0; j < particles->num_attrib_arrays_cache; j++) { glEnableVertexAttribArray(j); @@ -843,7 +842,7 @@ void ParticlesStorage::_particles_update_buffers(Particles *particles) { glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER, particles->front_instance_buffer); - GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ARRAY_BUFFER, particles->front_instance_buffer, particles->instance_buffer_size_cache, nullptr, GL_DYNAMIC_COPY, "Particles front instance buffer"); + GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ARRAY_BUFFER, particles->front_instance_buffer, particles->instance_buffer_size_cache, instance_data.ptr(), GL_DYNAMIC_COPY, "Particles front instance buffer"); } { @@ -853,7 +852,7 @@ void ParticlesStorage::_particles_update_buffers(Particles *particles) { glGenBuffers(1, &particles->back_instance_buffer); glBindBuffer(GL_ARRAY_BUFFER, particles->back_process_buffer); - GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ARRAY_BUFFER, particles->back_process_buffer, particles->process_buffer_stride_cache * total_amount, data, GL_DYNAMIC_COPY, "Particles back process buffer"); + GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ARRAY_BUFFER, particles->back_process_buffer, particles->process_buffer_stride_cache * total_amount, data.ptr(), GL_DYNAMIC_COPY, "Particles back process buffer"); for (uint32_t j = 0; j < particles->num_attrib_arrays_cache; j++) { glEnableVertexAttribArray(j); @@ -862,11 +861,9 @@ void ParticlesStorage::_particles_update_buffers(Particles *particles) { glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER, particles->back_instance_buffer); - GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ARRAY_BUFFER, particles->back_instance_buffer, particles->instance_buffer_size_cache, nullptr, GL_DYNAMIC_COPY, "Particles back instance buffer"); + GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ARRAY_BUFFER, particles->back_instance_buffer, particles->instance_buffer_size_cache, instance_data.ptr(), GL_DYNAMIC_COPY, "Particles back instance buffer"); } glBindBuffer(GL_ARRAY_BUFFER, 0); - - memdelete_arr(data); } } diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp index b36e027f0769..1500c902c6c5 100644 --- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp @@ -1288,7 +1288,10 @@ void ParticlesStorage::_particles_update_buffers(Particles *particles) { particles->userdata_count = userdata_count; - particles->particle_instance_buffer = RD::get_singleton()->storage_buffer_create(sizeof(float) * 4 * (xform_size + 1 + 1) * total_amount); + PackedByteArray data; + data.resize_zeroed(sizeof(float) * 4 * (xform_size + 1 + 1) * total_amount); + + particles->particle_instance_buffer = RD::get_singleton()->storage_buffer_create(sizeof(float) * 4 * (xform_size + 1 + 1) * total_amount, data); //needs to clear it { From 6255a64e033e016b66f085f841d827b03fdb63b8 Mon Sep 17 00:00:00 2001 From: Yuri Roubinski Date: Sat, 1 Jul 2023 14:26:05 +0300 Subject: [PATCH 04/77] Fix using uint suffix at the hex number declaration in shaders (cherry picked from commit 1994c25701b9f51f5891a0a5e1cbaba913303383) --- servers/rendering/shader_language.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index ca41cc8d51f5..cb05063e0605 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -659,7 +659,7 @@ ShaderLanguage::Token ShaderLanguage::_get_token() { char t = char(i); suffix_lut[CASE_ALL][i] = t == '.' || t == 'x' || t == 'e' || t == 'f' || t == 'u' || t == '-' || t == '+'; - suffix_lut[CASE_HEXA_PERIOD][i] = t == 'e' || t == 'f'; + suffix_lut[CASE_HEXA_PERIOD][i] = t == 'e' || t == 'f' || t == 'u'; suffix_lut[CASE_EXPONENT][i] = t == 'f' || t == '-' || t == '+'; suffix_lut[CASE_SIGN_AFTER_EXPONENT][i] = t == 'f'; suffix_lut[CASE_NONE][i] = false; @@ -738,6 +738,13 @@ ShaderLanguage::Token ShaderLanguage::_get_token() { char32_t last_char = str[str.length() - 1]; if (hexa_found) { // Integer (hex). + if (uint_suffix_found) { + // Strip the suffix. + str = str.left(str.length() - 1); + + // Compensate reading cursor position. + char_idx += 1; + } if (str.size() > 11 || !str.is_valid_hex_number(true)) { // > 0xFFFFFFFF return _make_token(TK_ERROR, "Invalid (hexadecimal) numeric constant"); } From da1e511f115f4db4e1f31929ba104eed921399d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 6 Jul 2023 14:46:34 +0200 Subject: [PATCH 05/77] Linux: Allow unbundling brotli to use system library (cherry picked from commit 153c4a4c4fd9ab142004d3448d1de4923a15a871) --- SConstruct | 1 + core/SCsub | 2 +- core/io/compression.cpp | 8 ++++---- platform/linuxbsd/detect.py | 3 +++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/SConstruct b/SConstruct index f65e6bab04b2..7e706e8e73de 100644 --- a/SConstruct +++ b/SConstruct @@ -222,6 +222,7 @@ opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise e opts.Add(BoolVariable("scu_build", "Use single compilation unit build", False)) # Thirdparty libraries +opts.Add(BoolVariable("builtin_brotli", "Use the built-in Brotli library", True)) opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True)) opts.Add(BoolVariable("builtin_embree", "Use the built-in Embree library", True)) opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True)) diff --git a/core/SCsub b/core/SCsub index a0176f6c3345..7e9cd97351b2 100644 --- a/core/SCsub +++ b/core/SCsub @@ -65,7 +65,7 @@ thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_mis env_thirdparty.add_source_files(thirdparty_obj, thirdparty_misc_sources) # Brotli -if env["brotli"]: +if env["brotli"] and env["builtin_brotli"]: thirdparty_brotli_dir = "#thirdparty/brotli/" thirdparty_brotli_sources = [ "common/constants.c", diff --git a/core/io/compression.cpp b/core/io/compression.cpp index ac4a63759738..e36fb0afa4fd 100644 --- a/core/io/compression.cpp +++ b/core/io/compression.cpp @@ -35,13 +35,13 @@ #include "thirdparty/misc/fastlz.h" -#ifdef BROTLI_ENABLED -#include "thirdparty/brotli/include/brotli/decode.h" -#endif - #include #include +#ifdef BROTLI_ENABLED +#include +#endif + int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode) { switch (p_mode) { case MODE_BROTLI: { diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 9faa73d6d240..6bde9233c26f 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -240,6 +240,9 @@ def configure(env: "Environment"): if not env["builtin_zstd"]: env.ParseConfig("pkg-config libzstd --cflags --libs") + if env["brotli"] and not env["builtin_brotli"]: + env.ParseConfig("pkg-config libbrotlicommon libbrotlidec --cflags --libs") + # Sound and video libraries # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) From 89e64da028c1437610e40d1e6d4f667427122b0f Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Wed, 5 Jul 2023 15:38:40 +1000 Subject: [PATCH 06/77] Take eye offset into account for depth in StandardMaterial3D (cherry picked from commit 581d081deda4404cbbc645c8c8f9c4150ad409c5) --- scene/resources/material.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 372b9fea55e0..a2aab8e7b45d 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1139,7 +1139,7 @@ void BaseMaterial3D::_update_shader() { if (!RenderingServer::get_singleton()->is_low_end() && features[FEATURE_HEIGHT_MAPPING] && !flags[FLAG_UV1_USE_TRIPLANAR]) { //heightmap not supported with triplanar code += " {\n"; - code += " vec3 view_dir = normalize(normalize(-VERTEX)*mat3(TANGENT*heightmap_flip.x,-BINORMAL*heightmap_flip.y,NORMAL));\n"; // binormal is negative due to mikktspace, flip 'unflips' it ;-) + code += " vec3 view_dir = normalize(normalize(-VERTEX + EYE_OFFSET) * mat3(TANGENT * heightmap_flip.x, -BINORMAL * heightmap_flip.y, NORMAL));\n"; // binormal is negative due to mikktspace, flip 'unflips' it ;-) if (deep_parallax) { code += " float num_layers = mix(float(heightmap_max_layers),float(heightmap_min_layers), abs(dot(vec3(0.0, 0.0, 1.0), view_dir)));\n"; From 03e82be50322e7bd6d9aca1eeb8a71e92dc16e9d Mon Sep 17 00:00:00 2001 From: RedworkDE <10944644+RedworkDE@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:39:23 +0200 Subject: [PATCH 07/77] Fix export options of scripted EditorExportPlugins (cherry picked from commit fa84d09542cfd60f7a881c7d5655a2a74de39c9f) --- editor/export/editor_export.cpp | 38 ++++++++++++++---------- editor/export/editor_export.h | 1 + editor/export/editor_export_platform.cpp | 7 +++-- editor/export/editor_export_preset.cpp | 12 ++++---- editor/export/editor_export_preset.h | 5 ++-- editor/export/project_export.cpp | 4 +-- 6 files changed, 38 insertions(+), 29 deletions(-) diff --git a/editor/export/editor_export.cpp b/editor/export/editor_export.cpp index 106f7932102c..6c4fb480d707 100644 --- a/editor/export/editor_export.cpp +++ b/editor/export/editor_export.cpp @@ -90,11 +90,12 @@ void EditorExport::_save() { String option_section = "preset." + itos(i) + ".options"; - for (const PropertyInfo &E : preset->get_properties()) { - if (E.usage & PROPERTY_USAGE_SECRET) { - credentials->set_value(option_section, E.name, preset->get(E.name)); + for (const KeyValue &E : preset->values) { + PropertyInfo *prop = preset->properties.getptr(E.key); + if (prop && prop->usage & PROPERTY_USAGE_SECRET) { + credentials->set_value(option_section, E.key, E.value); } else { - config->set_value(option_section, E.name, preset->get(E.name)); + config->set_value(option_section, E.key, E.value); } } } @@ -116,6 +117,7 @@ void EditorExport::_bind_methods() { void EditorExport::add_export_platform(const Ref &p_platform) { export_platforms.push_back(p_platform); + should_update_presets = true; } int EditorExport::get_export_platform_count() { @@ -169,11 +171,13 @@ void EditorExport::remove_export_preset(int p_idx) { void EditorExport::add_export_plugin(const Ref &p_plugin) { if (!export_plugins.has(p_plugin)) { export_plugins.push_back(p_plugin); + should_update_presets = true; } } void EditorExport::remove_export_plugin(const Ref &p_plugin) { export_plugins.erase(p_plugin); + should_update_presets = true; } Vector> EditorExport::get_export_plugins() { @@ -314,8 +318,11 @@ void EditorExport::load_config() { credentials->get_section_keys(option_section, &options); for (const String &E : options) { - Variant value = credentials->get_value(option_section, E); - preset->set(E, value); + // Drop values for secret properties that no longer exist, or during the next save they would end up in the regular config file. + if (preset->get_properties().has(E)) { + Variant value = credentials->get_value(option_section, E); + preset->set(E, value); + } } } @@ -332,7 +339,8 @@ void EditorExport::update_export_presets() { for (int i = 0; i < export_platforms.size(); i++) { Ref platform = export_platforms[i]; - bool should_update = platform->should_update_export_options(); + bool should_update = should_update_presets; + should_update |= platform->should_update_export_options(); for (int j = 0; j < export_plugins.size(); j++) { should_update |= export_plugins.write[j]->_should_update_export_options(platform); } @@ -342,12 +350,13 @@ void EditorExport::update_export_presets() { platform->get_export_options(&options); for (int j = 0; j < export_plugins.size(); j++) { - export_plugins.write[j]->_get_export_options(platform, &options); + export_plugins[j]->_get_export_options(platform, &options); } platform_options[platform->get_name()] = options; } } + should_update_presets = false; bool export_presets_updated = false; for (int i = 0; i < export_presets.size(); i++) { @@ -357,19 +366,16 @@ void EditorExport::update_export_presets() { List options = platform_options[preset->get_platform()->get_name()]; - // Copy the previous preset values - HashMap previous_values = preset->values; - - // Clear the preset properties and values prior to reloading + // Clear the preset properties prior to reloading, keep the values to preserve options from plugins that may be currently disabled. preset->properties.clear(); - preset->values.clear(); preset->update_visibility.clear(); for (const EditorExportPlatform::ExportOption &E : options) { - preset->properties.push_back(E.option); - StringName option_name = E.option.name; - preset->values[option_name] = previous_values.has(option_name) ? previous_values[option_name] : E.default_value; + preset->properties[option_name] = E.option; + if (!preset->has(option_name)) { + preset->values[option_name] = E.default_value; + } preset->update_visibility[option_name] = E.update_visibility; } } diff --git a/editor/export/editor_export.h b/editor/export/editor_export.h index 343686a4cf25..55dee0c468cc 100644 --- a/editor/export/editor_export.h +++ b/editor/export/editor_export.h @@ -45,6 +45,7 @@ class EditorExport : public Node { Timer *save_timer = nullptr; bool block_save = false; + bool should_update_presets = false; static EditorExport *singleton; diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index 00fbd851660e..d04eeafd0798 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -329,9 +329,10 @@ Ref EditorExportPlatform::create_preset() { } for (const ExportOption &E : options) { - preset->properties.push_back(E.option); - preset->values[E.option.name] = E.default_value; - preset->update_visibility[E.option.name] = E.update_visibility; + StringName option_name = E.option.name; + preset->properties[option_name] = E.option; + preset->values[option_name] = E.default_value; + preset->update_visibility[option_name] = E.update_visibility; } return preset; diff --git a/editor/export/editor_export_preset.cpp b/editor/export/editor_export_preset.cpp index 2aca19a2ad57..a7dc44e3a81b 100644 --- a/editor/export/editor_export_preset.cpp +++ b/editor/export/editor_export_preset.cpp @@ -31,9 +31,9 @@ #include "editor_export.h" bool EditorExportPreset::_set(const StringName &p_name, const Variant &p_value) { - if (values.has(p_name)) { - values[p_name] = p_value; - EditorExport::singleton->save_presets(); + values[p_name] = p_value; + EditorExport::singleton->save_presets(); + if (update_visibility.has(p_name)) { if (update_visibility[p_name]) { notify_property_list_changed(); } @@ -61,9 +61,9 @@ String EditorExportPreset::_get_property_warning(const StringName &p_name) const } void EditorExportPreset::_get_property_list(List *p_list) const { - for (const PropertyInfo &E : properties) { - if (platform->get_export_option_visibility(this, E.name)) { - p_list->push_back(E); + for (const KeyValue &E : properties) { + if (platform->get_export_option_visibility(this, E.key)) { + p_list->push_back(E.value); } } } diff --git a/editor/export/editor_export_preset.h b/editor/export/editor_export_preset.h index 194858b4e879..8b59da06ddc3 100644 --- a/editor/export/editor_export_preset.h +++ b/editor/export/editor_export_preset.h @@ -70,7 +70,7 @@ class EditorExportPreset : public RefCounted { friend class EditorExport; friend class EditorExportPlatform; - List properties; + HashMap properties; HashMap values; HashMap update_visibility; @@ -154,7 +154,8 @@ class EditorExportPreset : public RefCounted { Variant get_or_env(const StringName &p_name, const String &p_env_var, bool *r_valid = nullptr) const; - const List &get_properties() const { return properties; } + const HashMap &get_properties() const { return properties; } + const HashMap &get_values() const { return values; } EditorExportPreset(); }; diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index 8009b3038cef..7c7762e0fd74 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -577,8 +577,8 @@ void ProjectExportDialog::_duplicate_preset() { preset->set_exclude_filter(current->get_exclude_filter()); preset->set_custom_features(current->get_custom_features()); - for (const PropertyInfo &E : current->get_properties()) { - preset->set(E.name, current->get(E.name)); + for (const KeyValue &E : current->get_values()) { + preset->set(E.key, E.value); } EditorExport::get_singleton()->add_export_preset(preset); From 7a8ac69862032324108a5600ecd34d137532de79 Mon Sep 17 00:00:00 2001 From: Amir-Rasteg <127231771+Amir-Rasteg@users.noreply.github.com> Date: Mon, 3 Jul 2023 12:09:19 -0400 Subject: [PATCH 08/77] Fix a typo in the `String.to_float` description (cherry picked from commit 9744657bb8410ecfaa462a2c575a68c9b40cfbad) --- doc/classes/String.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 7283dc689cb0..d2493c237b7a 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -920,11 +920,11 @@ Converts the string representing a decimal number into a [float]. This method stops on the first non-number character, except the first decimal point ([code].[/code]) and the exponent letter ([code]e[/code]). See also [method is_valid_float]. [codeblock] - var a = "12.35".to_float() # a is 12.35 - var b = "1.2.3".to_float() # b is 1.2 - var c = "12xy3".to_float() # c is 12.0 - var d = "1e3".to_float() # d is 1000.0 - var e = "Hello!".to_int() # e is 0.0 + var a = "12.35".to_float() # a is 12.35 + var b = "1.2.3".to_float() # b is 1.2 + var c = "12xy3".to_float() # c is 12.0 + var d = "1e3".to_float() # d is 1000.0 + var e = "Hello!".to_float() # e is 0.0 [/codeblock] From 371b31c85fc27f7307093a473452136b155bc0c3 Mon Sep 17 00:00:00 2001 From: Ben Rog-Wilhelm Date: Sat, 1 Jul 2023 07:57:47 -0500 Subject: [PATCH 09/77] Fix: Incorrect property names in FontFile::_get_property_list(). (cherry picked from commit 7ee916a2591e9c548665e95335fe1bd30f8cfba8) --- scene/resources/font.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 0047f443d00f..d07d9913a6bc 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -1266,9 +1266,9 @@ void FontFile::_get_property_list(List *p_list) const { String prefix = "cache/" + itos(i) + "/"; TypedArray sizes = get_size_cache_list(i); p_list->push_back(PropertyInfo(Variant::DICTIONARY, prefix + "variation_coordinates", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::INT, "face_index", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::FLOAT, "embolden", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::TRANSFORM2D, "transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); + p_list->push_back(PropertyInfo(Variant::INT, prefix + "face_index", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); + p_list->push_back(PropertyInfo(Variant::FLOAT, prefix + "embolden", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); + p_list->push_back(PropertyInfo(Variant::TRANSFORM2D, prefix + "transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); for (int j = 0; j < sizes.size(); j++) { Vector2i sz = sizes[j]; From a8bfdd8bea4ccd6df9a6737f72affa52159fd75b Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sun, 2 Jul 2023 15:04:00 +0800 Subject: [PATCH 10/77] Fix error when non-ASCII characters in resource pack path (cherry picked from commit df5c68af99993002c927b4cc33bc85f67900579d) --- core/io/file_access_zip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index 064353476f27..c7f1a73f9718 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -47,7 +47,7 @@ static void *godot_open(voidpf opaque, const char *p_fname, int mode) { return nullptr; } - Ref f = FileAccess::open(p_fname, FileAccess::READ); + Ref f = FileAccess::open(String::utf8(p_fname), FileAccess::READ); ERR_FAIL_COND_V(f.is_null(), nullptr); ZipData *zd = memnew(ZipData); From 545e37cf7758f434cf54b851014972542e53022f Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sun, 2 Jul 2023 16:48:37 +0800 Subject: [PATCH 11/77] Translate "No match" message in FindReplaceBar (cherry picked from commit ac454ce2a75fb4a10ea23681d450e4d7605ba050) --- editor/code_editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index b48bd4ab5fae..70fd73801989 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -410,7 +410,7 @@ void FindReplaceBar::_update_matches_label() { matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor"))); if (results_count == 0) { - matches_label->set_text("No match"); + matches_label->set_text(TTR("No match")); } else if (results_count_to_current == -1) { matches_label->set_text(vformat(TTRN("%d match", "%d matches", results_count), results_count)); } else { From 92040e85e20953dc5ff6362e9a4fc077682a64d8 Mon Sep 17 00:00:00 2001 From: nklbdev Date: Fri, 30 Jun 2023 17:17:37 +0500 Subject: [PATCH 12/77] Fix wrong type casting for octahedral tangents (cherry picked from commit c022f52f11e2df5ab051f3ad201efb33b2fe2ade) --- servers/rendering_server.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 0c5c263265c2..4c6b76515731 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -402,9 +402,9 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint const Vector3 *src = array.ptr(); for (int i = 0; i < p_vertex_array_len; i++) { Vector2 res = src[i].octahedron_encode(); - int16_t vector[2] = { - (int16_t)CLAMP(res.x * 65535, 0, 65535), - (int16_t)CLAMP(res.y * 65535, 0, 65535), + uint16_t vector[2] = { + (uint16_t)CLAMP(res.x * 65535, 0, 65535), + (uint16_t)CLAMP(res.y * 65535, 0, 65535), }; memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, 4); @@ -422,9 +422,9 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint for (int i = 0; i < p_vertex_array_len; i++) { const Vector3 src(src_ptr[i * 4 + 0], src_ptr[i * 4 + 1], src_ptr[i * 4 + 2]); Vector2 res = src.octahedron_tangent_encode(src_ptr[i * 4 + 3]); - int16_t vector[2] = { - (int16_t)CLAMP(res.x * 65535, 0, 65535), - (int16_t)CLAMP(res.y * 65535, 0, 65535), + uint16_t vector[2] = { + (uint16_t)CLAMP(res.x * 65535, 0, 65535), + (uint16_t)CLAMP(res.y * 65535, 0, 65535), }; memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, 4); @@ -437,9 +437,9 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint for (int i = 0; i < p_vertex_array_len; i++) { const Vector3 src(src_ptr[i * 4 + 0], src_ptr[i * 4 + 1], src_ptr[i * 4 + 2]); Vector2 res = src.octahedron_tangent_encode(src_ptr[i * 4 + 3]); - int16_t vector[2] = { - (int16_t)CLAMP(res.x * 65535, 0, 65535), - (int16_t)CLAMP(res.y * 65535, 0, 65535), + uint16_t vector[2] = { + (uint16_t)CLAMP(res.x * 65535, 0, 65535), + (uint16_t)CLAMP(res.y * 65535, 0, 65535), }; memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, 4); From 2bfeb29bc61da242da5cb2a6775c857794d79b94 Mon Sep 17 00:00:00 2001 From: nklbdev Date: Sat, 1 Jul 2023 18:46:52 +0500 Subject: [PATCH 13/77] Potencially fix nan's on octahedral tangents in RenderingServer (cherry picked from commit 1d16704faf220bf9535c380450348dccf0fb2ca7) --- scene/3d/sprite_3d.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 9f7ff05924ab..6e44696fe4d9 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -647,11 +647,11 @@ SpriteBase3D::SpriteBase3D() { // Create basic mesh and store format information. for (int i = 0; i < 4; i++) { - mesh_normals.write[i] = Vector3(0.0, 0.0, 0.0); - mesh_tangents.write[i * 4 + 0] = 0.0; + mesh_normals.write[i] = Vector3(0.0, 0.0, 1.0); + mesh_tangents.write[i * 4 + 0] = 1.0; mesh_tangents.write[i * 4 + 1] = 0.0; mesh_tangents.write[i * 4 + 2] = 0.0; - mesh_tangents.write[i * 4 + 3] = 0.0; + mesh_tangents.write[i * 4 + 3] = 1.0; mesh_colors.write[i] = Color(1.0, 1.0, 1.0, 1.0); mesh_uvs.write[i] = Vector2(0.0, 0.0); mesh_vertices.write[i] = Vector3(0.0, 0.0, 0.0); From 80105226c2c386b1ee519b7e6b4bd578c5608912 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Thu, 6 Jul 2023 12:43:23 +0200 Subject: [PATCH 14/77] C#: Compare symbol names without null flow state (cherry picked from commit 671a5b4ea57359d6a2281992a5012f7b6b170e64) --- .../Godot.SourceGenerators/ExtensionMethods.cs | 14 +++++++------- .../ScriptPropertiesGenerator.cs | 2 +- .../ExtensionMethods.cs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs index 38af1cbadede..b2a3c046e5b8 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs @@ -37,7 +37,7 @@ public static bool InheritsFrom(this INamedTypeSymbol? symbol, string assemblyNa while (symbol != null) { if (symbol.ContainingAssembly?.Name == assemblyName && - symbol.ToString() == typeFullName) + symbol.FullQualifiedNameOmitGlobal() == typeFullName) { return true; } @@ -230,22 +230,22 @@ public static string SanitizeQualifiedNameForUniqueHint(this string qualifiedNam .Replace(">", ")"); public static bool IsGodotExportAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.ExportAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.ExportAttr; public static bool IsGodotSignalAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.SignalAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.SignalAttr; public static bool IsGodotMustBeVariantAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.MustBeVariantAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.MustBeVariantAttr; public static bool IsGodotClassNameAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.GodotClassNameAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.GodotClassNameAttr; public static bool IsGodotGlobalClassAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.GlobalClassAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.GlobalClassAttr; public static bool IsSystemFlagsAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.SystemFlagsAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.SystemFlagsAttr; public static GodotMethodData? HasGodotCompatibleSignature( this IMethodSymbol method, diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs index e856ad5c13a9..3e6858485dfa 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs @@ -362,7 +362,7 @@ private static IEnumerable DetermineGroupingPropertyInfo(ISymbol m { foreach (var attr in memberSymbol.GetAttributes()) { - PropertyUsageFlags? propertyUsage = attr.AttributeClass?.ToString() switch + PropertyUsageFlags? propertyUsage = attr.AttributeClass?.FullQualifiedNameOmitGlobal() switch { GodotClasses.ExportCategoryAttr => PropertyUsageFlags.Category, GodotClasses.ExportGroupAttr => PropertyUsageFlags.Group, diff --git a/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/ExtensionMethods.cs b/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/ExtensionMethods.cs index 37f7005d0159..a0bd96412a3d 100644 --- a/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/ExtensionMethods.cs +++ b/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/ExtensionMethods.cs @@ -38,7 +38,7 @@ out INamedTypeSymbol? symbol } private static bool IsGenerateUnmanagedCallbacksAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GeneratorClasses.GenerateUnmanagedCallbacksAttr; + => symbol.FullQualifiedNameOmitGlobal() == GeneratorClasses.GenerateUnmanagedCallbacksAttr; public static IEnumerable<(ClassDeclarationSyntax cds, INamedTypeSymbol symbol)> SelectUnmanagedCallbacksClasses( this IEnumerable source, From 836913ce7a49c17d21b3095957e7eff46186d51b Mon Sep 17 00:00:00 2001 From: Rindbee Date: Sun, 2 Jul 2023 06:40:14 +0800 Subject: [PATCH 15/77] Make sure the shortcut key respects the context in `TileSetAtlasSourceEditor` (cherry picked from commit fec731bf33ccec46549840cca1d48fdbdf36a7b7) --- editor/plugins/tiles/tile_set_atlas_source_editor.cpp | 6 +++--- editor/plugins/tiles/tile_set_atlas_source_editor.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index c71dcf10034a..6ec45b1f956b 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -1693,7 +1693,7 @@ void TileSetAtlasSourceEditor::_menu_option(int p_option) { } } -void TileSetAtlasSourceEditor::_unhandled_key_input(const Ref &p_event) { +void TileSetAtlasSourceEditor::shortcut_input(const Ref &p_event) { // Check for shortcuts. if (ED_IS_SHORTCUT("tiles_editor/delete_tile", p_event)) { if (tools_button_group->get_pressed_button() == tool_select_button && !selection.is_empty()) { @@ -2418,14 +2418,14 @@ void TileSetAtlasSourceEditor::_notification(int p_what) { } void TileSetAtlasSourceEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &TileSetAtlasSourceEditor::_unhandled_key_input); ClassDB::bind_method(D_METHOD("_set_selection_from_array"), &TileSetAtlasSourceEditor::_set_selection_from_array); ADD_SIGNAL(MethodInfo("source_id_changed", PropertyInfo(Variant::INT, "source_id"))); } TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { - set_process_unhandled_key_input(true); + set_shortcut_context(this); + set_process_shortcut_input(true); set_process_internal(true); // Middle panel. diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.h b/editor/plugins/tiles/tile_set_atlas_source_editor.h index f8dbbc4b3fb7..65a2ba33f65d 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.h +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.h @@ -257,9 +257,6 @@ class TileSetAtlasSourceEditor : public HSplitContainer { void _update_atlas_view(); void _update_toolbar(); - // -- input events -- - void _unhandled_key_input(const Ref &p_event); - // -- Misc -- void _auto_create_tiles(); void _auto_remove_tiles(); @@ -275,6 +272,9 @@ class TileSetAtlasSourceEditor : public HSplitContainer { void _notification(int p_what); static void _bind_methods(); + // -- input events -- + virtual void shortcut_input(const Ref &p_event) override; + public: void edit(Ref p_tile_set, TileSetAtlasSource *p_tile_set_source, int p_source_id); void init_source(); From 705c1d6bdff81b6307ef04cff8ce0bb864536edf Mon Sep 17 00:00:00 2001 From: kobewi Date: Sat, 1 Jul 2023 19:21:35 +0200 Subject: [PATCH 16/77] Fix dropping files from res:// to res:// (cherry picked from commit 1d970cd6ca9400eec16d4b11b291d93f331fc273) --- editor/filesystem_dock.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index dd8fde496f46..1ff68b7d3675 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2617,8 +2617,10 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, if (!to_dir.is_empty()) { Vector fnames = drag_data["files"]; to_move.clear(); + String target_dir = to_dir == "res://" ? to_dir : to_dir.trim_suffix("/"); + for (int i = 0; i < fnames.size(); i++) { - if (fnames[i].trim_suffix("/").get_base_dir() != to_dir.trim_suffix("/")) { + if (fnames[i].trim_suffix("/").get_base_dir() != target_dir) { to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/"))); } } From a0366f1cea16bdcd7c62d5d066f8a1dcea40cac1 Mon Sep 17 00:00:00 2001 From: "ocean (they/them)" Date: Sun, 2 Jul 2023 10:55:47 -0400 Subject: [PATCH 17/77] Fix regression with enum descriptions now showing up in documentation. (cherry picked from commit d48636c3bf96bb97f01e3a5ad69365776d030b7c) --- editor/editor_help.cpp | 2 +- modules/gdscript/editor/gdscript_docgen.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 61e94388babc..5a3841e4ca72 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1367,7 +1367,7 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); // Enum description. - if (e != "@unnamed_enums" && cd.enums.has(e)) { + if (e != "@unnamed_enums" && cd.enums.has(e) && !cd.enums[e].strip_edges().is_empty()) { class_desc->push_color(theme_cache.text_color); _push_normal_font(); class_desc->push_indent(1); diff --git a/modules/gdscript/editor/gdscript_docgen.cpp b/modules/gdscript/editor/gdscript_docgen.cpp index df17581ad145..0d8453738d71 100644 --- a/modules/gdscript/editor/gdscript_docgen.cpp +++ b/modules/gdscript/editor/gdscript_docgen.cpp @@ -236,6 +236,8 @@ void GDScriptDocGen::generate_docs(GDScript *p_script, const GDP::ClassNode *p_c p_script->member_lines[name] = m_enum->start_line; + doc.enums[name] = m_enum->doc_description; + for (const GDP::EnumNode::Value &val : m_enum->values) { DocData::ConstantDoc const_doc; const_doc.name = val.identifier->name; @@ -244,7 +246,6 @@ void GDScriptDocGen::generate_docs(GDScript *p_script, const GDP::ClassNode *p_c const_doc.description = val.doc_description; const_doc.enumeration = name; - doc.enums[const_doc.name] = const_doc.description; doc.constants.push_back(const_doc); } From 0dec3d6485d58597c3c0444d0362cc530e3fd948 Mon Sep 17 00:00:00 2001 From: bitsawer Date: Mon, 3 Jul 2023 12:48:33 +0300 Subject: [PATCH 18/77] Fix shader language float literal precision truncation (cherry picked from commit 356297f9093a06b8e61892d3819390cd5b927994) --- servers/rendering/shader_compiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp index 4ea06afe79eb..1515ed32f6bf 100644 --- a/servers/rendering/shader_compiler.cpp +++ b/servers/rendering/shader_compiler.cpp @@ -178,7 +178,7 @@ static String _mkid(const String &p_id) { } static String f2sp0(float p_float) { - String num = rtoss(p_float); + String num = rtos(p_float); if (!num.contains(".") && !num.contains("e")) { num += ".0"; } From f5addd583d695f6441215153b7fa3b0ce8118c9f Mon Sep 17 00:00:00 2001 From: bitsawer Date: Thu, 6 Jul 2023 17:56:26 +0300 Subject: [PATCH 19/77] Make shader preprocessor keyword colors consistent (cherry picked from commit a5d61529499f162ea659f2f16a0587dcc68140f7) --- editor/plugins/text_shader_editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp index 791746da96da..0c8907d6a0da 100644 --- a/editor/plugins/text_shader_editor.cpp +++ b/editor/plugins/text_shader_editor.cpp @@ -238,7 +238,7 @@ void ShaderTextEditor::_load_theme_settings() { ShaderPreprocessor::get_keyword_list(&pp_keywords, false); for (const String &E : pp_keywords) { - syntax_highlighter->add_keyword_color(E, keyword_color); + syntax_highlighter->add_keyword_color(E, control_flow_keyword_color); } // Colorize built-ins like `COLOR` differently to make them easier From ed9c091a92fe32238c43aa09a2e64da2aefc9153 Mon Sep 17 00:00:00 2001 From: "Silc Lizard (Tokage) Renew" <61938263+TokageItLab@users.noreply.github.com> Date: Fri, 7 Jul 2023 14:33:08 +0900 Subject: [PATCH 20/77] Fix infinity loop state can't break (cherry picked from commit fc40ba21cd3f26609065122c625fbe470c8a6c20) --- scene/animation/animation_node_state_machine.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index 071e2e7f37ae..0254419d228e 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -901,18 +901,20 @@ bool AnimationNodeStateMachinePlayback::_transition_to_next_recursive(AnimationT bool is_state_changed = false; NextInfo next; - StringName transition_start = current; + Vector transition_path; + transition_path.push_back(current); while (true) { next = _find_next(p_tree, p_state_machine); - if (next.node == transition_start) { - is_state_changed = false; - break; // Maybe infinity loop, do noting more. + if (transition_path.has(next.node)) { + WARN_PRINT_ONCE_ED("AnimationNodeStateMachinePlayback: " + base_path + "playback aborts the transition by detecting one or more looped transitions in the same frame to prevent to infinity loop. You may need to check the transition settings."); + break; // Maybe infinity loop, do nothing more. } if (!_can_transition_to_next(p_tree, p_state_machine, next, p_test_only)) { break; // Finish transition. } + transition_path.push_back(next.node); is_state_changed = true; // Setting for fading. From 8cea540eba2391e202db23d4fb45486e53b36e09 Mon Sep 17 00:00:00 2001 From: "Alfonso J. Ramos" Date: Sat, 1 Jul 2023 19:29:54 -0500 Subject: [PATCH 21/77] Do not change a node unique name to the same name (cherry picked from commit b2bef8c47babbfea3a11143e428a248f59da4eb5) --- editor/gui/scene_tree_editor.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index d1756df66cbf..7b0b8166300d 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -1019,11 +1019,18 @@ void SceneTreeEditor::_renamed() { } } - if (n->is_unique_name_in_owner() && get_tree()->get_edited_scene_root()->get_node_or_null("%" + new_name) != nullptr) { - error->set_text(TTR("Another node already uses this unique name in the scene.")); - error->popup_centered(); - which->set_text(0, n->get_name()); - return; + if (n->is_unique_name_in_owner()) { + Node *existing = get_tree()->get_edited_scene_root()->get_node_or_null("%" + new_name); + if (existing == n) { + which->set_text(0, n->get_name()); + return; + } + if (existing != nullptr) { + error->set_text(TTR("Another node already uses this unique name in the scene.")); + error->popup_centered(); + which->set_text(0, n->get_name()); + return; + } } _rename_node(n, new_name); From 6018ff49d68377fd9737fb022fc9a791a7534466 Mon Sep 17 00:00:00 2001 From: mb4c Date: Thu, 6 Jul 2023 08:45:07 +0200 Subject: [PATCH 22/77] Add tooltip description wrapping in scene tree and plugin settings (cherry picked from commit d007be2d14387c6bb3ab206db23db276eb9b677d) --- editor/editor_plugin_settings.cpp | 11 ++++++++++- editor/gui/scene_tree_editor.cpp | 9 ++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index 1e582992d187..7f57619ac8d4 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -101,9 +101,18 @@ void EditorPluginSettings::update_plugins() { String description = cf->get_value("plugin", "description"); String scr = cf->get_value("plugin", "script"); + const PackedInt32Array boundaries = TS->string_get_word_breaks(description, "", 80); + String wrapped_description; + + for (int j = 0; j < boundaries.size(); j += 2) { + const int start = boundaries[j]; + const int end = boundaries[j + 1]; + wrapped_description += "\n" + description.substr(start, end - start + 1).rstrip("\n"); + } + TreeItem *item = plugin_list->create_item(root); item->set_text(0, name); - item->set_tooltip_text(0, TTR("Name:") + " " + name + "\n" + TTR("Path:") + " " + path + "\n" + TTR("Main Script:") + " " + scr + "\n" + TTR("Description:") + " " + description); + item->set_tooltip_text(0, TTR("Name:") + " " + name + "\n" + TTR("Path:") + " " + path + "\n" + TTR("Main Script:") + " " + scr + "\n" + TTR("Description:") + " " + wrapped_description); item->set_metadata(0, path); item->set_text(1, version); item->set_metadata(1, scr); diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index 7b0b8166300d..d8c6ff54ccec 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -374,7 +374,14 @@ void SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { tooltip += String("\n" + TTR("Type:") + " " + (custom_type != StringName() ? String(custom_type) : p_node->get_class())); if (!p_node->get_editor_description().is_empty()) { - tooltip += "\n\n" + p_node->get_editor_description(); + const PackedInt32Array boundaries = TS->string_get_word_breaks(p_node->get_editor_description(), "", 80); + tooltip += "\n"; + + for (int i = 0; i < boundaries.size(); i += 2) { + const int start = boundaries[i]; + const int end = boundaries[i + 1]; + tooltip += "\n" + p_node->get_editor_description().substr(start, end - start + 1).rstrip("\n"); + } } item->set_tooltip_text(0, tooltip); From 69948f7489aa482e150b919db53e14e61657fc4e Mon Sep 17 00:00:00 2001 From: RedworkDE <10944644+RedworkDE@users.noreply.github.com> Date: Fri, 7 Jul 2023 13:09:40 +0200 Subject: [PATCH 23/77] C#: Add null check before calling `UnregisterGodotObject` (cherry picked from commit 693e6e036b1428392b74dcfca2b0b5fe0fce66b5) --- .../mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs index b9a5ac82d132..12e8a638d3b4 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs @@ -125,7 +125,10 @@ protected virtual void Dispose(bool disposing) NativePtr = IntPtr.Zero; } - DisposablesTracker.UnregisterGodotObject(this, _weakReferenceToSelf); + if (_weakReferenceToSelf != null) + { + DisposablesTracker.UnregisterGodotObject(this, _weakReferenceToSelf); + } } /// From 4e84660b50d2b8e79532c8fdf185f05f24a8c66b Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Sat, 10 Jun 2023 09:33:16 +0200 Subject: [PATCH 24/77] Fix that `_drop_physics_mouseover` only happens when necessary Previously the call was executed every time, because in the `_drop_mouse_over();` a few lines above, `gui.mouse_over = nullptr;` was set. (cherry picked from commit 37a96d395760a4439eb49464ec55899e3027c8a5) --- scene/main/viewport.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index faa609d84776..8609b7794460 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1875,13 +1875,13 @@ void Viewport::_gui_input_event(Ref p_event) { } if (over != gui.mouse_over) { + if (!gui.mouse_over) { + _drop_physics_mouseover(); + } _drop_mouse_over(); _gui_cancel_tooltip(); if (over) { - if (!gui.mouse_over) { - _drop_physics_mouseover(); - } _gui_call_notification(over, Control::NOTIFICATION_MOUSE_ENTER); gui.mouse_over = over; } From 221535c33c2414e25d7d6982914ec8b5c1c80f08 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 15 Jun 2023 11:04:54 +0300 Subject: [PATCH 25/77] [Windows] Flash both the window caption and taskbar button on `request_attention`. (cherry picked from commit 49af2582c41cc553c2ee4a388df9ddf3bda3cdda) --- platform/windows/display_server_windows.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 91f7de7f26fa..b0b1e1680fc5 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -1598,7 +1598,7 @@ void DisplayServerWindows::window_request_attention(WindowID p_window) { FLASHWINFO info; info.cbSize = sizeof(FLASHWINFO); info.hwnd = wd.hWnd; - info.dwFlags = FLASHW_TRAY; + info.dwFlags = FLASHW_ALL; info.dwTimeout = 0; info.uCount = 2; FlashWindowEx(&info); From 3fd5fecfc19d31a854ae53045c3e6e892e8f289e Mon Sep 17 00:00:00 2001 From: Bauke Conijn Date: Tue, 20 Jun 2023 20:44:50 +0200 Subject: [PATCH 26/77] Fix Camera3D project_* methods not accounting for frustum offset This does not fix Camera3D::project_ray_normal(). Adds Camera3D::get_camera_projection() and exposes it to GDScript (cherry picked from commit 47e63bc55f611793c4b1f7ca878d9b8a02aa492e) --- doc/classes/Camera3D.xml | 6 ++++ scene/3d/camera_3d.cpp | 68 +++++++++++++++++++--------------------- scene/3d/camera_3d.h | 3 ++ 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a/doc/classes/Camera3D.xml b/doc/classes/Camera3D.xml index b0406c77a108..e0113cb9c0fa 100644 --- a/doc/classes/Camera3D.xml +++ b/doc/classes/Camera3D.xml @@ -17,6 +17,12 @@ If this is the current camera, remove it from being current. If [param enable_next] is [code]true[/code], request to make the next camera current, if any. + + + + Returns the projection matrix that this camera uses to render to its associated viewport. The camera must be part of the scene tree to function. + + diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 5a4761892d15..225b9b35b3fb 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -170,6 +170,30 @@ Transform3D Camera3D::get_camera_transform() const { return tr; } +Projection Camera3D::_get_camera_projection(real_t p_near) const { + Size2 viewport_size = get_viewport()->get_visible_rect().size; + Projection cm; + + switch (mode) { + case PROJECTION_PERSPECTIVE: { + cm.set_perspective(fov, viewport_size.aspect(), p_near, far, keep_aspect == KEEP_WIDTH); + } break; + case PROJECTION_ORTHOGONAL: { + cm.set_orthogonal(size, viewport_size.aspect(), p_near, far, keep_aspect == KEEP_WIDTH); + } break; + case PROJECTION_FRUSTUM: { + cm.set_frustum(size, viewport_size.aspect(), frustum_offset, p_near, far); + } break; + } + + return cm; +} + +Projection Camera3D::get_camera_projection() const { + ERR_FAIL_COND_V_MSG(!is_inside_tree(), Projection(), "Camera is not inside the scene tree."); + return _get_camera_projection(near); +} + void Camera3D::set_perspective(real_t p_fovy_degrees, real_t p_z_near, real_t p_z_far) { if (!force_change && fov == p_fovy_degrees && p_z_near == near && p_z_far == far && mode == PROJECTION_PERSPECTIVE) { return; @@ -286,8 +310,7 @@ Vector3 Camera3D::project_local_ray_normal(const Point2 &p_pos) const { if (mode == PROJECTION_ORTHOGONAL) { ray = Vector3(0, 0, -1); } else { - Projection cm; - cm.set_perspective(fov, viewport_size.aspect(), near, far, keep_aspect == KEEP_WIDTH); + Projection cm = _get_camera_projection(near); Vector2 screen_he = cm.get_viewport_half_extents(); ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_he.x, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_he.y, -near).normalized(); } @@ -302,9 +325,7 @@ Vector3 Camera3D::project_ray_origin(const Point2 &p_pos) const { Vector2 cpos = get_viewport()->get_camera_coords(p_pos); ERR_FAIL_COND_V(viewport_size.y == 0, Vector3()); - if (mode == PROJECTION_PERSPECTIVE) { - return get_camera_transform().origin; - } else { + if (mode == PROJECTION_ORTHOGONAL) { Vector2 pos = cpos / viewport_size; real_t vsize, hsize; if (keep_aspect == KEEP_WIDTH) { @@ -321,6 +342,8 @@ Vector3 Camera3D::project_ray_origin(const Point2 &p_pos) const { ray.z = -near; ray = get_camera_transform().xform(ray); return ray; + } else { + return get_camera_transform().origin; }; }; @@ -333,15 +356,7 @@ bool Camera3D::is_position_behind(const Vector3 &p_pos) const { Vector Camera3D::get_near_plane_points() const { ERR_FAIL_COND_V_MSG(!is_inside_tree(), Vector(), "Camera is not inside scene."); - Size2 viewport_size = get_viewport()->get_visible_rect().size; - - Projection cm; - - if (mode == PROJECTION_ORTHOGONAL) { - cm.set_orthogonal(size, viewport_size.aspect(), near, far, keep_aspect == KEEP_WIDTH); - } else { - cm.set_perspective(fov, viewport_size.aspect(), near, far, keep_aspect == KEEP_WIDTH); - } + Projection cm = _get_camera_projection(near); Vector3 endpoints[8]; cm.get_endpoints(Transform3D(), endpoints); @@ -361,13 +376,7 @@ Point2 Camera3D::unproject_position(const Vector3 &p_pos) const { Size2 viewport_size = get_viewport()->get_visible_rect().size; - Projection cm; - - if (mode == PROJECTION_ORTHOGONAL) { - cm.set_orthogonal(size, viewport_size.aspect(), near, far, keep_aspect == KEEP_WIDTH); - } else { - cm.set_perspective(fov, viewport_size.aspect(), near, far, keep_aspect == KEEP_WIDTH); - } + Projection cm = _get_camera_projection(near); Plane p(get_camera_transform().xform_inv(p_pos), 1.0); @@ -389,13 +398,7 @@ Vector3 Camera3D::project_position(const Point2 &p_point, real_t p_z_depth) cons } Size2 viewport_size = get_viewport()->get_visible_rect().size; - Projection cm; - - if (mode == PROJECTION_ORTHOGONAL) { - cm.set_orthogonal(size, viewport_size.aspect(), p_z_depth, far, keep_aspect == KEEP_WIDTH); - } else { - cm.set_perspective(fov, viewport_size.aspect(), p_z_depth, far, keep_aspect == KEEP_WIDTH); - } + Projection cm = _get_camera_projection(p_z_depth); Vector2 vp_he = cm.get_viewport_half_extents(); @@ -508,6 +511,7 @@ void Camera3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_current", "enabled"), &Camera3D::set_current); ClassDB::bind_method(D_METHOD("is_current"), &Camera3D::is_current); ClassDB::bind_method(D_METHOD("get_camera_transform"), &Camera3D::get_camera_transform); + ClassDB::bind_method(D_METHOD("get_camera_projection"), &Camera3D::get_camera_projection); ClassDB::bind_method(D_METHOD("get_fov"), &Camera3D::get_fov); ClassDB::bind_method(D_METHOD("get_frustum_offset"), &Camera3D::get_frustum_offset); ClassDB::bind_method(D_METHOD("get_size"), &Camera3D::get_size); @@ -653,13 +657,7 @@ bool Camera3D::get_cull_mask_value(int p_layer_number) const { Vector Camera3D::get_frustum() const { ERR_FAIL_COND_V(!is_inside_world(), Vector()); - Size2 viewport_size = get_viewport()->get_visible_rect().size; - Projection cm; - if (mode == PROJECTION_PERSPECTIVE) { - cm.set_perspective(fov, viewport_size.aspect(), near, far, keep_aspect == KEEP_WIDTH); - } else { - cm.set_orthogonal(size, viewport_size.aspect(), near, far, keep_aspect == KEEP_WIDTH); - } + Projection cm = _get_camera_projection(near); return cm.get_projection_planes(get_camera_transform()); } diff --git a/scene/3d/camera_3d.h b/scene/3d/camera_3d.h index 420d0cb93906..aa302ded4a3b 100644 --- a/scene/3d/camera_3d.h +++ b/scene/3d/camera_3d.h @@ -105,6 +105,8 @@ class Camera3D : public Node3D { static void _bind_methods(); + Projection _get_camera_projection(real_t p_near) const; + public: enum { NOTIFICATION_BECAME_CURRENT = 50, @@ -138,6 +140,7 @@ class Camera3D : public Node3D { void set_frustum_offset(Vector2 p_offset); virtual Transform3D get_camera_transform() const; + virtual Projection get_camera_projection() const; virtual Vector3 project_ray_normal(const Point2 &p_pos) const; virtual Vector3 project_ray_origin(const Point2 &p_pos) const; From ffc87b2bb1d04c14b9badc2c4a44af288b75c782 Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 21 Oct 2021 15:58:07 +0200 Subject: [PATCH 27/77] Focus current node after connecting (cherry picked from commit d17c522991159260b95621a45383fde408eb83c9) --- editor/connections_dialog.cpp | 2 ++ editor/node_dock.cpp | 7 +++++++ editor/node_dock.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index f4b7b14e990d..3965dcd1987b 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -39,6 +39,7 @@ #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/scene_tree_editor.h" +#include "editor/node_dock.h" #include "editor/scene_tree_dock.h" #include "plugins/script_editor_plugin.h" #include "scene/gui/button.h" @@ -1440,6 +1441,7 @@ ConnectionsDock::ConnectionsDock() { connect_button->connect("pressed", callable_mp(this, &ConnectionsDock::_connect_pressed)); connect_dialog = memnew(ConnectDialog); + connect_dialog->connect("connected", callable_mp(NodeDock::get_singleton(), &NodeDock::restore_last_valid_node), CONNECT_DEFERRED); add_child(connect_dialog); disconnect_all_dialog = memnew(ConfirmationDialog); diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp index 545769d32704..ebb35eedf9cc 100644 --- a/editor/node_dock.cpp +++ b/editor/node_dock.cpp @@ -70,6 +70,9 @@ void NodeDock::update_lists() { void NodeDock::set_node(Node *p_node) { connections->set_node(p_node); groups->set_current(p_node); + if (p_node) { + last_valid_node = p_node; + } if (p_node) { if (connections_button->is_pressed()) { @@ -88,6 +91,10 @@ void NodeDock::set_node(Node *p_node) { } } +void NodeDock::restore_last_valid_node() { + set_node(last_valid_node); +} + NodeDock::NodeDock() { singleton = this; diff --git a/editor/node_dock.h b/editor/node_dock.h index e9dcc41d48cb..cc221714530f 100644 --- a/editor/node_dock.h +++ b/editor/node_dock.h @@ -47,6 +47,7 @@ class NodeDock : public VBoxContainer { HBoxContainer *mode_hb = nullptr; Label *select_a_node = nullptr; + Node *last_valid_node = nullptr; private: static NodeDock *singleton; @@ -60,6 +61,7 @@ class NodeDock : public VBoxContainer { public: void set_node(Node *p_node); + void restore_last_valid_node(); void show_groups(); void show_connections(); From 4cec4bd32f2fd6bf1445b51e8e69bf2a1a6bc0d0 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Tue, 27 Jun 2023 18:22:33 -0500 Subject: [PATCH 28/77] Sort project tags before saving (cherry picked from commit d667402461387afae62a401e1de2f514740c61be) --- editor/project_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index a86963c33038..71b5ef246072 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2504,6 +2504,7 @@ void ProjectManager::_apply_project_tags() { callable_mp((Window *)tag_manage_dialog, &Window::show).call_deferred(); // Make sure the dialog does not disappear. return; } else { + tags.sort(); cfg.set_value("application", "config/tags", tags); err = cfg.save(project_godot); if (err != OK) { From ab14aa9f165bcf96d09e348887ebe943733a8fa6 Mon Sep 17 00:00:00 2001 From: MewPurPur Date: Wed, 21 Jun 2023 19:18:08 +0200 Subject: [PATCH 29/77] Fix enum tooltip with no description (cherry picked from commit c0453a544d10858672b635de0a75e385c532e333) --- editor/editor_inspector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index e3514b4691bb..367373dc1764 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -3184,10 +3184,11 @@ void EditorInspector::update_tree() { if (val.enumeration == enum_name && !val.name.ends_with("_MAX")) { const String enum_value = EditorPropertyNameProcessor::get_singleton()->process_name(val.name, EditorPropertyNameProcessor::STYLE_CAPITALIZED); // Prettify the enum value display, so that "_" becomes "Value". + String desc = DTR(val.description).trim_prefix("\n"); doc_info.description += vformat( "\n[b]%s:[/b] %s", enum_value.trim_prefix(EditorPropertyNameProcessor::get_singleton()->process_name(enum_name, EditorPropertyNameProcessor::STYLE_CAPITALIZED) + " "), - DTR(val.description).trim_prefix("\n")); + desc.is_empty() ? ("[i]" + TTR("No description.") + "[/i]") : desc); } } } From 8cefce591ac3502b8e8b098c2c97d32b1c6a29c7 Mon Sep 17 00:00:00 2001 From: MewPurPur Date: Wed, 21 Jun 2023 17:43:45 +0200 Subject: [PATCH 30/77] Improve string printing in the tiledata editor (cherry picked from commit 1649dcad0b7bc2b1227f1f9be90a8fa0fcb62b83) --- editor/plugins/tiles/tile_data_editors.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index ef805e652477..7767831ea3f3 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -1185,19 +1185,18 @@ void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2 Ref font = TileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), SNAME("EditorFonts")); int font_size = TileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts")); String text; + // Round floating point precision to 2 digits, as tiles don't have that much space. switch (value.get_type()) { - case Variant::INT: - text = vformat("%d", value); - break; case Variant::FLOAT: text = vformat("%.2f", value); break; - case Variant::STRING: - case Variant::STRING_NAME: - text = value; + case Variant::VECTOR2: + case Variant::VECTOR3: + case Variant::VECTOR4: + text = vformat("%.2v", value); break; default: - return; + text = value.stringify(); break; } @@ -1216,8 +1215,8 @@ void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2 } Vector2 string_size = font->get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size); - p_canvas_item->draw_string_outline(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, 1, Color(0, 0, 0, 1)); - p_canvas_item->draw_string(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color); + p_canvas_item->draw_string_outline(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 4), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, 3, Color(0, 0, 0)); + p_canvas_item->draw_string(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 4), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color); } } From 2ba192e803208e0f91f48cc82fc0c6f108738ce3 Mon Sep 17 00:00:00 2001 From: jpcerrone Date: Fri, 7 Jul 2023 11:18:30 -0300 Subject: [PATCH 31/77] Fix comments and indentation in .gdshaderinc files Fixes #78205 The handling of comments and indentation in the shader editor wasn't considering shader include files. (cherry picked from commit 71b8a9d2744bab4c83f38f2d0606b3f0df5f6bae) --- editor/plugins/text_shader_editor.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp index 0c8907d6a0da..4838661fa881 100644 --- a/editor/plugins/text_shader_editor.cpp +++ b/editor/plugins/text_shader_editor.cpp @@ -646,13 +646,13 @@ void TextShaderEditor::_menu_option(int p_option) { shader_editor->move_lines_down(); } break; case EDIT_INDENT: { - if (shader.is_null()) { + if (shader.is_null() && shader_inc.is_null()) { return; } shader_editor->get_text_editor()->indent_lines(); } break; case EDIT_UNINDENT: { - if (shader.is_null()) { + if (shader.is_null() && shader_inc.is_null()) { return; } shader_editor->get_text_editor()->unindent_lines(); @@ -668,12 +668,10 @@ void TextShaderEditor::_menu_option(int p_option) { shader_editor->get_text_editor()->set_line_wrapping_mode(wrap == TextEdit::LINE_WRAPPING_BOUNDARY ? TextEdit::LINE_WRAPPING_NONE : TextEdit::LINE_WRAPPING_BOUNDARY); } break; case EDIT_TOGGLE_COMMENT: { - if (shader.is_null()) { + if (shader.is_null() && shader_inc.is_null()) { return; } - shader_editor->toggle_inline_comment("//"); - } break; case EDIT_COMPLETE: { shader_editor->get_text_editor()->request_code_completion(); From 1875ecb77624b87442d8f3ff9d7514eba254d7cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 28 Jun 2023 15:07:37 +0200 Subject: [PATCH 32/77] Project converter: Use same rendering driver as Project Manager Which means by default OpenGL 3, but it can still be overridden from the command line. Fixes #76303. (cherry picked from commit 53c78b2cacf71a7156c1813348bb4a556405facf) --- editor/project_manager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 71b5ef246072..98ce9baaf369 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2337,6 +2337,8 @@ void ProjectManager::_perform_full_project_conversion() { args.push_back("--path"); args.push_back(path); args.push_back("--convert-3to4"); + args.push_back("--rendering-driver"); + args.push_back(Main::get_rendering_driver_name()); Error err = OS::get_singleton()->create_instance(args); ERR_FAIL_COND(err); From 87b4143f3b2e37a9dcae7bbe85aa1a45803d65a0 Mon Sep 17 00:00:00 2001 From: Dawid Marzec Date: Fri, 6 Jan 2023 20:19:34 +0100 Subject: [PATCH 33/77] Fix cursor behaviour in Tree while holding CTRL (cherry picked from commit 9abbdea95e8ba345ba539782e8aa3c597a99c6d3) --- editor/gui/scene_tree_editor.cpp | 10 +++++-- scene/gui/tree.cpp | 47 ++++++++++++++------------------ 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index d8c6ff54ccec..41f81a3f6003 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -1114,9 +1114,15 @@ void SceneTreeEditor::_update_selection(TreeItem *item) { } if (editor_selection->is_selected(n)) { - item->select(0); + if (!item->is_selected(0)) { + item->select(0); + } } else { - item->deselect(0); + if (item->is_selected(0)) { + TreeItem *previous_cursor_item = tree->get_selected(); + item->deselect(0); + previous_cursor_item->set_as_cursor(0); + } } TreeItem *c = item->get_first_child(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index a5d12aecadf1..f9f7438576af 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2868,21 +2868,17 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int return -1; } - if (select_mode == SELECT_MULTI && p_mod->is_command_or_control_pressed() && c.selectable) { - if (!c.selected || p_button == MouseButton::RIGHT) { - p_item->select(col); - emit_signal(SNAME("multi_selected"), p_item, col, true); - emit_signal(SNAME("item_mouse_selected"), get_local_mouse_position(), p_button); - - //p_item->selected_signal.call(col); + if (c.selectable) { + if (select_mode == SELECT_MULTI && p_mod->is_command_or_control_pressed()) { + if (c.selected && p_button == MouseButton::LEFT) { + p_item->deselect(col); + emit_signal(SNAME("multi_selected"), p_item, col, false); + } else { + p_item->select(col); + emit_signal(SNAME("multi_selected"), p_item, col, true); + emit_signal(SNAME("item_mouse_selected"), get_local_mouse_position(), p_button); + } } else { - p_item->deselect(col); - emit_signal(SNAME("multi_selected"), p_item, col, false); - //p_item->deselected_signal.call(col); - } - - } else { - if (c.selectable) { if (select_mode == SELECT_MULTI && p_mod->is_shift_pressed() && selected_item && selected_item != p_item) { bool inrange = false; @@ -2902,12 +2898,6 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int emit_signal(SNAME("item_mouse_selected"), get_local_mouse_position(), p_button); } } - - /* - if (!c.selected && select_mode==SELECT_MULTI) { - emit_signal(SNAME("multi_selected"),p_item,col,true); - } - */ queue_redraw(); } } @@ -4400,9 +4390,7 @@ void Tree::item_selected(int p_column, TreeItem *p_item) { //emit_signal(SNAME("multi_selected"),p_item,p_column,true); - NO this is for TreeItem::select selected_col = p_column; - if (!selected_item) { - selected_item = p_item; - } + selected_item = p_item; } else { select_single_item(p_item, root, p_column); } @@ -4410,11 +4398,18 @@ void Tree::item_selected(int p_column, TreeItem *p_item) { } void Tree::item_deselected(int p_column, TreeItem *p_item) { - if (selected_item == p_item) { + if (select_mode == SELECT_SINGLE && selected_item == p_item && selected_col == p_column) { selected_item = nullptr; - - if (selected_col == p_column) { + selected_col = -1; + } else { + if (select_mode == SELECT_ROW && selected_item == p_item) { + selected_item = nullptr; selected_col = -1; + } else { + if (select_mode == SELECT_MULTI) { + selected_item = p_item; + selected_col = p_column; + } } } From a084f0568f4b1cc67a078a49a37a812fc803d423 Mon Sep 17 00:00:00 2001 From: lewiji Date: Thu, 29 Jun 2023 16:18:31 +0100 Subject: [PATCH 34/77] Return shader parse error when using 'hint_normal_roughness_texture' and not using the Forward+ backend (cherry picked from commit 2a93681334d3388eebbe1ba34e633a40ed9f1333) --- servers/rendering/shader_language.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index cb05063e0605..22e6f7d67dbc 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -8807,8 +8807,8 @@ Error ShaderLanguage::_parse_shader(const HashMap &p_f new_hint = ShaderNode::Uniform::HINT_NORMAL_ROUGHNESS_TEXTURE; --texture_uniforms; --texture_binding; - if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { - _set_error(RTR("'hint_normal_roughness_texture' is not supported in gl_compatibility shaders.")); + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus") { + _set_error(RTR("'hint_normal_roughness_texture' is only available when using the Forward+ backend.")); return ERR_PARSE_ERROR; } if (String(shader_type_identifier) != "spatial") { From e32330473a3dcb1a46497bfadd16696cc8c97fda Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 28 Jun 2023 16:27:55 +0200 Subject: [PATCH 35/77] Remove uses of `vformat()` with no placeholders This is identical to passing the string directly. (cherry picked from commit dcc92c174efeb4d93874f26a9dd247f7a89d5619) --- drivers/unix/os_unix.cpp | 2 +- platform/macos/export/codesign.cpp | 22 +++++++++++----------- scene/resources/visual_shader.cpp | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 967699c5f381..387e048221bd 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -315,7 +315,7 @@ Dictionary OS_Unix::get_memory_info() const { mach_msg_type_number_t count = HOST_VM_INFO64_COUNT; vm_statistics64_data_t vmstat; if (host_statistics64(mach_host_self(), HOST_VM_INFO64, (host_info64_t)&vmstat, &count) != KERN_SUCCESS) { - ERR_PRINT(vformat("Could not get host vm statistics.")); + ERR_PRINT("Could not get host vm statistics."); } struct xsw_usage swap_used; len = sizeof(swap_used); diff --git a/platform/macos/export/codesign.cpp b/platform/macos/export/codesign.cpp index a1ec06b5f6a1..2b8898e6a1b3 100644 --- a/platform/macos/export/codesign.cpp +++ b/platform/macos/export/codesign.cpp @@ -1211,7 +1211,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const // Read Info.plist. if (!p_info.is_empty()) { - print_verbose(vformat("CodeSign: Reading bundle info...")); + print_verbose("CodeSign: Reading bundle info..."); PList info_plist; if (info_plist.load_file(p_info)) { info_hash1 = file_hash_sha1(p_info); @@ -1262,7 +1262,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const } } } else if (MachO::is_macho(main_exe)) { - print_verbose(vformat("CodeSign: Executable is thin...")); + print_verbose("CodeSign: Executable is thin..."); files_to_sign.push_back(main_exe); } else { r_error_msg = TTR("Invalid binary format."); @@ -1284,7 +1284,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const // Generate core resources. if (!p_bundle_path.is_empty()) { - print_verbose(vformat("CodeSign: Generating bundle CodeResources...")); + print_verbose("CodeSign: Generating bundle CodeResources..."); CodeSignCodeResources cr; if (p_ios_bundle) { @@ -1366,7 +1366,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const CharString uuid_str = id.utf8(); print_verbose(vformat("CodeSign: Used bundle ID: %s", id)); - print_verbose(vformat("CodeSign: Processing entitlements...")); + print_verbose("CodeSign: Processing entitlements..."); Ref cet; Ref ceb; @@ -1381,7 +1381,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const ceb = Ref(memnew(CodeSignEntitlementsBinary(entitlements))); } - print_verbose(vformat("CodeSign: Generating requirements...")); + print_verbose("CodeSign: Generating requirements..."); Ref rq; String team_id = ""; rq = Ref(memnew(CodeSignRequirements())); @@ -1396,10 +1396,10 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const } print_verbose(vformat("CodeSign: Signing executable for cputype: %d ...", mh.get_cputype())); - print_verbose(vformat("CodeSign: Generating CodeDirectory...")); + print_verbose("CodeSign: Generating CodeDirectory..."); Ref cd1 = memnew(CodeSignCodeDirectory(0x14, 0x01, true, uuid_str, team_id.utf8(), 12, mh.get_exe_limit(), mh.get_code_limit())); Ref cd2 = memnew(CodeSignCodeDirectory(0x20, 0x02, true, uuid_str, team_id.utf8(), 12, mh.get_exe_limit(), mh.get_code_limit())); - print_verbose(vformat("CodeSign: Calculating special slot hashes...")); + print_verbose("CodeSign: Calculating special slot hashes..."); if (info_hash2.size() == 0x20) { cd2->set_hash_in_slot(info_hash2, CodeSignCodeDirectory::SLOT_INFO_PLIST); } @@ -1444,7 +1444,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const ERR_FAIL_V_MSG(FAILED, "CodeSign: Can't resize signature load command."); } - print_verbose(vformat("CodeSign: Calculating executable code hashes...")); + print_verbose("CodeSign: Calculating executable code hashes..."); // Calculate executable code hashes. PackedByteArray buffer; PackedByteArray hash1, hash2; @@ -1481,11 +1481,11 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const cd1->set_hash_in_slot(hash1, cd1->get_page_count()); } - print_verbose(vformat("CodeSign: Generating signature...")); + print_verbose("CodeSign: Generating signature..."); Ref cs; cs = Ref(memnew(CodeSignSignature())); - print_verbose(vformat("CodeSign: Writing signature superblob...")); + print_verbose("CodeSign: Writing signature superblob..."); // Write signature data to the executable. CodeSignSuperBlob sb = CodeSignSuperBlob(); sb.add_blob(cd2); @@ -1502,7 +1502,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const sb.write_to_file(mh.get_file()); } if (files_to_sign.size() > 1) { - print_verbose(vformat("CodeSign: Rebuilding fat executable...")); + print_verbose("CodeSign: Rebuilding fat executable..."); LipO lip; if (!lip.create_file(main_exe, files_to_sign)) { CLEANUP(); diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index a361b7584a9f..71e84ef6367e 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -4854,7 +4854,7 @@ VisualShaderNodeVarying::VisualShaderNodeVarying() { ////////////// Varying Setter String VisualShaderNodeVaryingSetter::get_caption() const { - return vformat("VaryingSetter"); + return "VaryingSetter"; } int VisualShaderNodeVaryingSetter::get_input_port_count() const { @@ -4896,7 +4896,7 @@ VisualShaderNodeVaryingSetter::VisualShaderNodeVaryingSetter() { ////////////// Varying Getter String VisualShaderNodeVaryingGetter::get_caption() const { - return vformat("VaryingGetter"); + return "VaryingGetter"; } int VisualShaderNodeVaryingGetter::get_input_port_count() const { From fe8e7a0b223ea8c631e6398318e876b0409f8b7c Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 24 Jun 2023 02:12:13 +0200 Subject: [PATCH 36/77] Use bullet points in shader editor creation dialog This is consistent with the script creation dialog. (cherry picked from commit bce298561537828191d11f6c055db9162b2820cc) --- editor/shader_create_dialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor/shader_create_dialog.cpp b/editor/shader_create_dialog.cpp index 7d7ea2f509d7..3d8a6e368d8e 100644 --- a/editor/shader_create_dialog.cpp +++ b/editor/shader_create_dialog.cpp @@ -464,7 +464,7 @@ String ShaderCreateDialog::_validate_path(const String &p_path) { } void ShaderCreateDialog::_msg_script_valid(bool valid, const String &p_msg) { - error_label->set_text("- " + p_msg); + error_label->set_text(String::utf8("• ") + p_msg); if (valid) { error_label->add_theme_color_override("font_color", gc->get_theme_color(SNAME("success_color"), SNAME("Editor"))); } else { @@ -473,7 +473,7 @@ void ShaderCreateDialog::_msg_script_valid(bool valid, const String &p_msg) { } void ShaderCreateDialog::_msg_path_valid(bool valid, const String &p_msg) { - path_error_label->set_text("- " + p_msg); + path_error_label->set_text(String::utf8("• ") + p_msg); if (valid) { path_error_label->add_theme_color_override("font_color", gc->get_theme_color(SNAME("success_color"), SNAME("Editor"))); } else { From ac87b5df758a1af4c95f68bfdeb3aa96f6971baf Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 26 Jun 2023 09:14:26 +0200 Subject: [PATCH 37/77] Mention Xbox menu button by name in Start button description Microsoft officially calls it the Menu button: https://support.xbox.com/en-US/help/hardware-network/controller/get-to-know-your-xbox-series-x-s-controller (cherry picked from commit 1621b4e2b1adfa7f072eaf542bb1ffda24805ce9) --- core/input/input_event.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index e547b04d0b16..e37886cbe996 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -1192,7 +1192,7 @@ static const char *_joy_button_descriptions[(size_t)JoyButton::SDL_MAX] = { TTRC("Top Action, Sony Triangle, Xbox Y, Nintendo X"), TTRC("Back, Sony Select, Xbox Back, Nintendo -"), TTRC("Guide, Sony PS, Xbox Home"), - TTRC("Start, Nintendo +"), + TTRC("Start, Xbox Menu, Nintendo +"), TTRC("Left Stick, Sony L3, Xbox L/LS"), TTRC("Right Stick, Sony R3, Xbox R/RS"), TTRC("Left Shoulder, Sony L1, Xbox LB"), From 240701f95a8b5416ef81ea3991fd4463f3917def Mon Sep 17 00:00:00 2001 From: Florian Kothmeier Date: Tue, 27 Jun 2023 16:22:58 +0200 Subject: [PATCH 38/77] Fix invalid minimum size for translated messages in option button (cherry picked from commit c33748d954a279edd8c42a58f14efa88719f4111) --- scene/gui/option_button.cpp | 2 +- scene/gui/popup_menu.cpp | 5 +++++ scene/gui/popup_menu.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 451ac9410925..71d64c8bffb6 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -451,7 +451,7 @@ void OptionButton::_refresh_size_cache() { _cached_size = Vector2(); for (int i = 0; i < get_item_count(); i++) { - _cached_size = _cached_size.max(get_minimum_size_for_text_and_icon(get_item_text(i), get_item_icon(i))); + _cached_size = _cached_size.max(get_minimum_size_for_text_and_icon(popup->get_item_xl_text(i), get_item_icon(i))); } update_minimum_size(); } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index adeaf9a49f4a..94690a493801 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1471,6 +1471,11 @@ String PopupMenu::get_item_text(int p_idx) const { return items[p_idx].text; } +String PopupMenu::get_item_xl_text(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx, items.size(), ""); + return items[p_idx].xl_text; +} + Control::TextDirection PopupMenu::get_item_text_direction(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, items.size(), Control::TEXT_DIRECTION_INHERITED); return items[p_idx].text_direction; diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index 572467bf94db..b4655f13ae29 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -250,6 +250,7 @@ class PopupMenu : public Popup { void toggle_item_checked(int p_idx); String get_item_text(int p_idx) const; + String get_item_xl_text(int p_idx) const; Control::TextDirection get_item_text_direction(int p_idx) const; String get_item_language(int p_idx) const; int get_item_idx_from_text(const String &text) const; From c9b1d99cae9575ee02b6f6e3b6ac9547a96ae189 Mon Sep 17 00:00:00 2001 From: Ivan Shakhov Date: Thu, 22 Jun 2023 17:42:21 +0200 Subject: [PATCH 39/77] Update the RiderPathLocator to support the JetBrains Toolbox 2.0 (cherry picked from commit bf3af9fd48aceda699bb558558bd805a7e522760) --- .../GodotTools/GodotTools/GodotTools.csproj | 3 +- .../Ides/Rider/RiderLocatorEnvironment.cs | 51 ++ .../GodotTools/Ides/Rider/RiderPathLocator.cs | 474 ------------------ .../GodotTools/Ides/Rider/RiderPathManager.cs | 8 + 4 files changed, 60 insertions(+), 476 deletions(-) create mode 100644 modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderLocatorEnvironment.cs delete mode 100644 modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj index 30525ba04ac7..4a0b7f9bed6f 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj +++ b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj @@ -28,10 +28,9 @@ + - - $(GodotApiAssembliesDir)/GodotSharp.dll False diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderLocatorEnvironment.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderLocatorEnvironment.cs new file mode 100644 index 000000000000..7e08d8c01dad --- /dev/null +++ b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderLocatorEnvironment.cs @@ -0,0 +1,51 @@ +using System; +using Godot; +using JetBrains.Rider.PathLocator; +using Newtonsoft.Json; +using OS = GodotTools.Utils.OS; + +namespace GodotTools.Ides.Rider; + +public class RiderLocatorEnvironment : IRiderLocatorEnvironment +{ + public JetBrains.Rider.PathLocator.OS CurrentOS + { + get + { + if (OS.IsWindows) + return JetBrains.Rider.PathLocator.OS.Windows; + if (OS.IsMacOS) return JetBrains.Rider.PathLocator.OS.MacOSX; + if (OS.IsUnixLike) return JetBrains.Rider.PathLocator.OS.Linux; + return JetBrains.Rider.PathLocator.OS.Other; + } + } + + public T FromJson(string json) + { + return JsonConvert.DeserializeObject(json); + } + + public void Info(string message, Exception e = null) + { + if (e == null) + GD.Print(message); + else + GD.Print(message, e); + } + + public void Warn(string message, Exception e = null) + { + if (e == null) + GD.PushWarning(message); + else + GD.PushWarning(message, e); + } + + public void Error(string message, Exception e = null) + { + if (e == null) + GD.PushError(message); + else + GD.PushError(message, e); + } +} diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs deleted file mode 100644 index dad6e353448d..000000000000 --- a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs +++ /dev/null @@ -1,474 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Linq; -using System.Runtime.Versioning; -using Godot; -using Microsoft.Win32; -using Newtonsoft.Json; -using Directory = System.IO.Directory; -using Environment = System.Environment; -using File = System.IO.File; -using Path = System.IO.Path; -using OS = GodotTools.Utils.OS; - -// ReSharper disable UnassignedField.Local -// ReSharper disable InconsistentNaming -// ReSharper disable UnassignedField.Global -// ReSharper disable MemberHidesStaticFromOuterClass - -namespace GodotTools.Ides.Rider -{ - /// - /// This code is a modified version of the JetBrains resharper-unity plugin listed under Apache License 2.0 license: - /// https://github.com/JetBrains/resharper-unity/blob/master/unity/JetBrains.Rider.Unity.Editor/EditorPlugin/RiderPathLocator.cs - /// - public static class RiderPathLocator - { - public static RiderInfo[] GetAllRiderPaths() - { - try - { - if (OS.IsWindows) - { - return CollectRiderInfosWindows(); - } - if (OS.IsMacOS) - { - return CollectRiderInfosMac(); - } - if (OS.IsUnixLike) - { - return CollectAllRiderPathsLinux(); - } - throw new InvalidOperationException("Unexpected OS."); - } - catch (Exception e) - { - GD.PushWarning(e.Message); - } - - return Array.Empty(); - } - - private static RiderInfo[] CollectAllRiderPathsLinux() - { - var installInfos = new List(); - string home = Environment.GetEnvironmentVariable("HOME"); - if (!string.IsNullOrEmpty(home)) - { - string toolboxRiderRootPath = GetToolboxBaseDir(); - installInfos.AddRange(CollectPathsFromToolbox(toolboxRiderRootPath, "bin", "rider.sh", false) - .Select(a => new RiderInfo(a, true)).ToList()); - - //$Home/.local/share/applications/jetbrains-rider.desktop - var shortcut = new FileInfo(Path.Combine(home, @".local/share/applications/jetbrains-rider.desktop")); - - if (shortcut.Exists) - { - string[] lines = File.ReadAllLines(shortcut.FullName); - foreach (string line in lines) - { - if (!line.StartsWith("Exec=\"")) - continue; - string path = line.Split('"').Where((item, index) => index == 1).SingleOrDefault(); - if (string.IsNullOrEmpty(path)) - continue; - - if (installInfos.Any(a => a.Path == path)) // avoid adding similar build as from toolbox - continue; - installInfos.Add(new RiderInfo(path, false)); - } - } - } - - // snap install - string snapInstallPath = "/snap/rider/current/bin/rider.sh"; - if (new FileInfo(snapInstallPath).Exists) - installInfos.Add(new RiderInfo(snapInstallPath, false)); - - return installInfos.ToArray(); - } - - private static RiderInfo[] CollectRiderInfosMac() - { - var installInfos = new List(); - // "/Applications/*Rider*.app" - // should be combined with "Contents/MacOS/rider" - var folder = new DirectoryInfo("/Applications"); - if (folder.Exists) - { - installInfos.AddRange(folder.GetDirectories("*Rider*.app") - .Select(a => new RiderInfo(Path.Combine(a.FullName, "Contents/MacOS/rider"), false)) - .ToList()); - } - - // /Users/user/Library/Application Support/JetBrains/Toolbox/apps/Rider/ch-1/181.3870.267/Rider EAP.app - // should be combined with "Contents/MacOS/rider" - string toolboxRiderRootPath = GetToolboxBaseDir(); - var paths = CollectPathsFromToolbox(toolboxRiderRootPath, "", "Rider*.app", true) - .Select(a => new RiderInfo(Path.Combine(a, "Contents/MacOS/rider"), true)); - installInfos.AddRange(paths); - - return installInfos.ToArray(); - } - - [SupportedOSPlatform("windows")] - private static RiderInfo[] CollectRiderInfosWindows() - { - var installInfos = new List(); - var toolboxRiderRootPath = GetToolboxBaseDir(); - var installPathsToolbox = CollectPathsFromToolbox(toolboxRiderRootPath, "bin", "rider64.exe", false).ToList(); - installInfos.AddRange(installPathsToolbox.Select(a => new RiderInfo(a, true)).ToList()); - - var installPaths = new List(); - const string registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"; - CollectPathsFromRegistry(registryKey, installPaths); - const string wowRegistryKey = @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"; - CollectPathsFromRegistry(wowRegistryKey, installPaths); - - installInfos.AddRange(installPaths.Select(a => new RiderInfo(a, false)).ToList()); - - return installInfos.ToArray(); - } - - private static string GetToolboxBaseDir() - { - if (OS.IsWindows) - { - string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - return GetToolboxRiderRootPath(localAppData); - } - - if (OS.IsMacOS) - { - var home = Environment.GetEnvironmentVariable("HOME"); - if (string.IsNullOrEmpty(home)) - return string.Empty; - var localAppData = Path.Combine(home, @"Library/Application Support"); - return GetToolboxRiderRootPath(localAppData); - } - - if (OS.IsUnixLike) - { - var home = Environment.GetEnvironmentVariable("HOME"); - if (string.IsNullOrEmpty(home)) - return string.Empty; - var localAppData = Path.Combine(home, @".local/share"); - return GetToolboxRiderRootPath(localAppData); - } - - return string.Empty; - } - - - private static string GetToolboxRiderRootPath(string localAppData) - { - var toolboxPath = Path.Combine(localAppData, @"JetBrains/Toolbox"); - var settingsJson = Path.Combine(toolboxPath, ".settings.json"); - - if (File.Exists(settingsJson)) - { - var path = SettingsJson.GetInstallLocationFromJson(File.ReadAllText(settingsJson)); - if (!string.IsNullOrEmpty(path)) - toolboxPath = path; - } - - var toolboxRiderRootPath = Path.Combine(toolboxPath, @"apps/Rider"); - return toolboxRiderRootPath; - } - - internal static ProductInfo GetBuildVersion(string path) - { - var buildTxtFileInfo = new FileInfo(Path.Combine(path, GetRelativePathToBuildTxt())); - var dir = buildTxtFileInfo.DirectoryName; - if (!Directory.Exists(dir)) - return null; - var buildVersionFile = new FileInfo(Path.Combine(dir, "product-info.json")); - if (!buildVersionFile.Exists) - return null; - var json = File.ReadAllText(buildVersionFile.FullName); - return ProductInfo.GetProductInfo(json); - } - - internal static Version GetBuildNumber(string path) - { - var file = new FileInfo(Path.Combine(path, GetRelativePathToBuildTxt())); - if (!file.Exists) - return null; - var text = File.ReadAllText(file.FullName); - if (text.Length <= 3) - return null; - - var versionText = text.Substring(3); - return Version.TryParse(versionText, out var v) ? v : null; - } - - internal static bool IsToolbox(string path) - { - return path.StartsWith(GetToolboxBaseDir()); - } - - private static string GetRelativePathToBuildTxt() - { - if (OS.IsWindows || OS.IsUnixLike) - return "../../build.txt"; - if (OS.IsMacOS) - return "Contents/Resources/build.txt"; - throw new InvalidOperationException("Unknown OS."); - } - - [SupportedOSPlatform("windows")] - private static void CollectPathsFromRegistry(string registryKey, List installPaths) - { - using (var key = Registry.CurrentUser.OpenSubKey(registryKey)) - { - CollectPathsFromRegistry(installPaths, key); - } - using (var key = Registry.LocalMachine.OpenSubKey(registryKey)) - { - CollectPathsFromRegistry(installPaths, key); - } - } - - [SupportedOSPlatform("windows")] - private static void CollectPathsFromRegistry(List installPaths, RegistryKey key) - { - if (key == null) return; - foreach (var subkeyName in key.GetSubKeyNames().Where(a => a.Contains("Rider"))) - { - using (var subkey = key.OpenSubKey(subkeyName)) - { - var folderObject = subkey?.GetValue("InstallLocation"); - if (folderObject == null) continue; - var folder = folderObject.ToString(); - var possiblePath = Path.Combine(folder, @"bin\rider64.exe"); - if (File.Exists(possiblePath)) - installPaths.Add(possiblePath); - } - } - } - - private static string[] CollectPathsFromToolbox(string toolboxRiderRootPath, string dirName, string searchPattern, - bool isMac) - { - if (!Directory.Exists(toolboxRiderRootPath)) - return Array.Empty(); - - var channelDirs = Directory.GetDirectories(toolboxRiderRootPath); - var paths = channelDirs.SelectMany(channelDir => - { - try - { - // use history.json - last entry stands for the active build https://jetbrains.slack.com/archives/C07KNP99D/p1547807024066500?thread_ts=1547731708.057700&cid=C07KNP99D - var historyFile = Path.Combine(channelDir, ".history.json"); - if (File.Exists(historyFile)) - { - var json = File.ReadAllText(historyFile); - var build = ToolboxHistory.GetLatestBuildFromJson(json); - if (build != null) - { - var buildDir = Path.Combine(channelDir, build); - var executablePaths = GetExecutablePaths(dirName, searchPattern, isMac, buildDir); - if (executablePaths.Any()) - return executablePaths; - } - } - - var channelFile = Path.Combine(channelDir, ".channel.settings.json"); - if (File.Exists(channelFile)) - { - var json = File.ReadAllText(channelFile).Replace("active-application", "active_application"); - var build = ToolboxInstallData.GetLatestBuildFromJson(json); - if (build != null) - { - var buildDir = Path.Combine(channelDir, build); - var executablePaths = GetExecutablePaths(dirName, searchPattern, isMac, buildDir); - if (executablePaths.Any()) - return executablePaths; - } - } - - // changes in toolbox json files format may brake the logic above, so return all found Rider installations - return Directory.GetDirectories(channelDir) - .SelectMany(buildDir => GetExecutablePaths(dirName, searchPattern, isMac, buildDir)); - } - catch (Exception e) - { - // do not write to Debug.Log, just log it. - Logger.Warn($"Failed to get RiderPath from {channelDir}", e); - } - - return Array.Empty(); - }) - .Where(c => !string.IsNullOrEmpty(c)) - .ToArray(); - return paths; - } - - private static string[] GetExecutablePaths(string dirName, string searchPattern, bool isMac, string buildDir) - { - var folder = new DirectoryInfo(Path.Combine(buildDir, dirName)); - if (!folder.Exists) - return Array.Empty(); - - if (!isMac) - return new[] { Path.Combine(folder.FullName, searchPattern) }.Where(File.Exists).ToArray(); - return folder.GetDirectories(searchPattern).Select(f => f.FullName) - .Where(Directory.Exists).ToArray(); - } - - // Disable the "field is never assigned" compiler warning. We never assign it, but Unity does. - // Note that Unity disable this warning in the generated C# projects -#pragma warning disable 0649 - - [Serializable] - class SettingsJson - { - public string install_location; - - [return: MaybeNull] - public static string GetInstallLocationFromJson(string json) - { - try - { - return JsonConvert.DeserializeObject(json).install_location; - } - catch (Exception) - { - Logger.Warn($"Failed to get install_location from json {json}"); - } - - return null; - } - } - - [Serializable] - class ToolboxHistory - { - public List history; - - public static string GetLatestBuildFromJson(string json) - { - try - { - return JsonConvert.DeserializeObject(json).history.LastOrDefault()?.item.build; - } - catch (Exception) - { - Logger.Warn($"Failed to get latest build from json {json}"); - } - - return null; - } - } - - [Serializable] - class ItemNode - { - public BuildNode item; - } - - [Serializable] - class BuildNode - { - public string build; - } - - [Serializable] - public class ProductInfo - { - public string version; - public string versionSuffix; - - [return: MaybeNull] - internal static ProductInfo GetProductInfo(string json) - { - try - { - var productInfo = JsonConvert.DeserializeObject(json); - return productInfo; - } - catch (Exception) - { - Logger.Warn($"Failed to get version from json {json}"); - } - - return null; - } - } - - // ReSharper disable once ClassNeverInstantiated.Global - [Serializable] - class ToolboxInstallData - { - // ReSharper disable once InconsistentNaming - public ActiveApplication active_application; - - [return: MaybeNull] - public static string GetLatestBuildFromJson(string json) - { - try - { - var toolbox = JsonConvert.DeserializeObject(json); - var builds = toolbox.active_application.builds; - if (builds != null && builds.Any()) - return builds.First(); - } - catch (Exception) - { - Logger.Warn($"Failed to get latest build from json {json}"); - } - - return null; - } - } - - [Serializable] - class ActiveApplication - { - public List builds; - } - -#pragma warning restore 0649 - - public struct RiderInfo - { - // ReSharper disable once NotAccessedField.Global - public bool IsToolbox; - public string Presentation; - public Version BuildNumber; - public ProductInfo ProductInfo; - public string Path; - - public RiderInfo(string path, bool isToolbox) - { - BuildNumber = GetBuildNumber(path); - ProductInfo = GetBuildVersion(path); - Path = new FileInfo(path).FullName; // normalize separators - var presentation = $"Rider {BuildNumber}"; - - if (ProductInfo != null && !string.IsNullOrEmpty(ProductInfo.version)) - { - var suffix = string.IsNullOrEmpty(ProductInfo.versionSuffix) ? "" : $" {ProductInfo.versionSuffix}"; - presentation = $"Rider {ProductInfo.version}{suffix}"; - } - - if (isToolbox) - presentation += " (JetBrains Toolbox)"; - - Presentation = presentation; - IsToolbox = isToolbox; - } - } - - private static class Logger - { - internal static void Warn(string message, Exception e = null) - { - throw new Exception(message, e); - } - } - } -} diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs index f55ca4c7d79b..5c09f1f83af6 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs @@ -4,11 +4,19 @@ using System.Linq; using Godot; using GodotTools.Internals; +using JetBrains.Rider.PathLocator; namespace GodotTools.Ides.Rider { public static class RiderPathManager { + private static readonly RiderPathLocator RiderPathLocator; + + static RiderPathManager() + { + RiderPathLocator = new RiderPathLocator(new RiderLocatorEnvironment()); + } + public static readonly string EditorPathSettingName = "dotnet/editor/editor_path_optional"; private static string GetRiderPathFromSettings() From 393076a4b3af863f62ee75f560a0e3b25ed45a3d Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 5 Jul 2023 15:34:18 +0300 Subject: [PATCH 40/77] [macOS/iOS] Set MoltenVK logging level based on `--verbose` flag. (cherry picked from commit 75d0fcea16a7959bcf5deccd4e63c0bba3932a12) --- main/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/main.cpp b/main/main.cpp index f6c4df583ba1..397476ae3968 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1956,6 +1956,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->_verbose_stdout = GLOBAL_GET("debug/settings/stdout/verbose_stdout"); } +#if defined(MACOS_ENABLED) || defined(IOS_ENABLED) + OS::get_singleton()->set_environment("MVK_CONFIG_LOG_LEVEL", OS::get_singleton()->_verbose_stdout ? "3" : "1"); // 1 = Errors only, 3 = Info +#endif + if (frame_delay == 0) { frame_delay = GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/frame_delay_msec", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), 0); } From fa45bb63c6579b5cb7d09c457aa6480516ae725c Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 4 Jul 2023 13:09:26 +0300 Subject: [PATCH 41/77] [Windows] Fix setting initial non-exclusive window mode. (cherry picked from commit db0109b23713cc9ebdb6f8efb1097874fda81113) --- platform/windows/display_server_windows.cpp | 4 +++- scene/main/window.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index b0b1e1680fc5..4138f53a9d9b 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -3926,7 +3926,9 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, WindowRect.top += offset.y; WindowRect.bottom += offset.y; - AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); + if (p_mode != WINDOW_MODE_FULLSCREEN && p_mode != WINDOW_MODE_EXCLUSIVE_FULLSCREEN) { + AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); + } WindowID id = window_id_counter; { diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 0aa6b69d6c77..be88b757fd97 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -2653,7 +2653,7 @@ void Window::_bind_methods() { ClassDB::bind_method(D_METHOD("popup_exclusive_centered_clamped", "from_node", "minsize", "fallback_ratio"), &Window::popup_exclusive_centered_clamped, DEFVAL(Size2i()), DEFVAL(0.75)); // Keep the enum values in sync with the `Mode` enum. - ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Windowed,Minimized,Maximized,Fullscreen"), "set_mode", "get_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Windowed,Minimized,Maximized,Fullscreen,Exclusive Fullscreen"), "set_mode", "get_mode"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title"); From 4c1c26979b4faffaf6e25dc756091f9f02de29fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 6 Jul 2023 15:32:42 +0200 Subject: [PATCH 42/77] Linux: Link libsquish directly when unbundling, .pc file unreliable (cherry picked from commit b3b4f4c1c9cc4a37c4f2ee3ad4720834274f3a38) --- platform/linuxbsd/detect.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 6bde9233c26f..ce743fbf8a82 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -235,7 +235,8 @@ def configure(env: "Environment"): env.ParseConfig("pkg-config libenet --cflags --libs") if not env["builtin_squish"]: - env.ParseConfig("pkg-config libsquish --cflags --libs") + # libsquish doesn't reliably install its .pc file, so some distros lack it. + env.Append(LIBS=["libsquish"]) if not env["builtin_zstd"]: env.ParseConfig("pkg-config libzstd --cflags --libs") From cdeddffee7f5f87d132bbd5a0a26467a3ed42d8d Mon Sep 17 00:00:00 2001 From: Angad Kambli Date: Wed, 17 Feb 2021 21:17:57 +0530 Subject: [PATCH 43/77] Check parameter validity in `Object::set_script` Fixes #46120. (cherry picked from commit 9c6c2f09e07e65f7819920c4954a7fd54b37d3f6) --- core/object/object.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/object/object.cpp b/core/object/object.cpp index c76188a2cd32..4d19a2c75bdd 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -836,14 +836,16 @@ void Object::set_script(const Variant &p_script) { return; } + Ref