summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/extension/gdextension.compat.inc49
-rw-r--r--core/extension/gdextension.cpp2
-rw-r--r--core/extension/gdextension.h9
-rw-r--r--doc/classes/EditorExportPlugin.xml2
-rw-r--r--doc/classes/EditorSettings.xml3
-rw-r--r--doc/classes/Window.xml2
-rw-r--r--editor/code_editor.cpp25
-rw-r--r--editor/code_editor.h1
-rw-r--r--editor/editor_settings.cpp1
-rw-r--r--editor/export/editor_export_platform.cpp12
-rw-r--r--editor/gui/editor_file_dialog.h2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp5
-rw-r--r--editor/plugins/script_editor_plugin.cpp18
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp14
-rw-r--r--editor/plugins/script_text_editor.h2
-rw-r--r--editor/plugins/shader_editor_plugin.cpp20
-rw-r--r--editor/plugins/text_editor.cpp8
-rw-r--r--editor/plugins/text_editor.h2
-rw-r--r--editor/plugins/text_shader_editor.cpp9
-rw-r--r--editor/plugins/text_shader_editor.h3
-rw-r--r--modules/gdscript/gdscript_editor.cpp31
-rw-r--r--platform/ios/export/export_plugin.cpp7
-rw-r--r--platform/linuxbsd/freedesktop_portal_desktop.cpp2
-rw-r--r--platform/linuxbsd/joypad_linux.cpp6
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp4
-rw-r--r--platform/windows/display_server_windows.cpp26
-rw-r--r--scene/2d/tile_map.cpp2
-rw-r--r--scene/gui/control.cpp11
-rw-r--r--scene/gui/file_dialog.h2
-rw-r--r--scene/gui/item_list.h2
-rw-r--r--scene/gui/menu_button.h2
-rw-r--r--scene/gui/option_button.h2
-rw-r--r--scene/gui/popup_menu.h2
-rw-r--r--scene/gui/tab_bar.h2
-rw-r--r--scene/main/canvas_item.cpp27
-rw-r--r--scene/main/window.cpp20
-rw-r--r--scene/property_list_helper.cpp9
-rw-r--r--scene/property_list_helper.h2
-rw-r--r--servers/audio/audio_stream.h2
40 files changed, 290 insertions, 62 deletions
diff --git a/core/extension/gdextension.compat.inc b/core/extension/gdextension.compat.inc
new file mode 100644
index 0000000000..9dea865dbd
--- /dev/null
+++ b/core/extension/gdextension.compat.inc
@@ -0,0 +1,49 @@
+/**************************************************************************/
+/* gdextension.compat.inc */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+#ifndef DISABLE_DEPRECATED
+
+Error GDExtension::_open_library_bind_compat_88418(const String &p_path, const String &p_entry_symbol) {
+ return ERR_UNAVAILABLE;
+}
+
+void GDExtension::_close_library_bind_compat_88418() {
+}
+
+void GDExtension::_initialize_library_bind_compat_88418(InitializationLevel p_level) {
+}
+
+void GDExtension::_bind_compatibility_methods() {
+ ClassDB::bind_compatibility_method(D_METHOD("open_library", "path", "entry_symbol"), &GDExtension::_open_library_bind_compat_88418);
+ ClassDB::bind_compatibility_method(D_METHOD("close_library"), &GDExtension::_close_library_bind_compat_88418);
+ ClassDB::bind_compatibility_method(D_METHOD("initialize_library", "level"), &GDExtension::_initialize_library_bind_compat_88418);
+}
+
+#endif
diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp
index a26bb3e8f3..47628e4ea0 100644
--- a/core/extension/gdextension.cpp
+++ b/core/extension/gdextension.cpp
@@ -29,6 +29,8 @@
/**************************************************************************/
#include "gdextension.h"
+#include "gdextension.compat.inc"
+
#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
#include "core/object/class_db.h"
diff --git a/core/extension/gdextension.h b/core/extension/gdextension.h
index 3b15639890..9393e7399b 100644
--- a/core/extension/gdextension.h
+++ b/core/extension/gdextension.h
@@ -137,6 +137,15 @@ public:
INITIALIZATION_LEVEL_EDITOR = GDEXTENSION_INITIALIZATION_EDITOR
};
+protected:
+#ifndef DISABLE_DEPRECATED
+ Error _open_library_bind_compat_88418(const String &p_path, const String &p_entry_symbol);
+ void _close_library_bind_compat_88418();
+ void _initialize_library_bind_compat_88418(InitializationLevel p_level);
+ static void _bind_compatibility_methods();
+#endif
+
+public:
bool is_library_open() const;
#ifdef TOOLS_ENABLED
diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml
index 436f471e5d..3e2b3ea111 100644
--- a/doc/classes/EditorExportPlugin.xml
+++ b/doc/classes/EditorExportPlugin.xml
@@ -313,7 +313,7 @@
<method name="skip">
<return type="void" />
<description>
- To be called inside [method _export_file]. Skips the current file, so it's not included in the export.
+ To be called inside [method _export_file], [method _customize_resource], or [method _customize_scene]. Skips the current file, so it's not included in the export.
</description>
</method>
</methods>
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index 7ee239415f..e0a14e990b 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -1028,6 +1028,9 @@
<member name="text_editor/behavior/files/restore_scripts_on_load" type="bool" setter="" getter="">
If [code]true[/code], reopens scripts that were opened in the last session when the editor is reopened on a given project.
</member>
+ <member name="text_editor/behavior/files/trim_final_newlines_on_save" type="bool" setter="" getter="">
+ If [code]true[/code], trims all empty newlines after the final newline when saving a script. Final newlines refer to the empty newlines found at the end of files. Since these serve no practical purpose, they can and should be removed to make version control diffs less noisy.
+ </member>
<member name="text_editor/behavior/files/trim_trailing_whitespace_on_save" type="bool" setter="" getter="">
If [code]true[/code], trims trailing whitespace when saving a script. Trailing whitespace refers to tab and space characters placed at the end of lines. Since these serve no practical purpose, they can and should be removed to make version control diffs less noisy.
</member>
diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml
index 9c0e8011dc..286b35d642 100644
--- a/doc/classes/Window.xml
+++ b/doc/classes/Window.xml
@@ -118,12 +118,14 @@
<return type="Vector2i" />
<description>
Returns the window's position including its border.
+ [b]Note:[/b] If [member visible] is [code]false[/code], this method returns the same value as [member position].
</description>
</method>
<method name="get_size_with_decorations" qualifiers="const">
<return type="Vector2i" />
<description>
Returns the window's size including its border.
+ [b]Note:[/b] If [member visible] is [code]false[/code], this method returns the same value as [member size].
</description>
</method>
<method name="get_theme_color" qualifiers="const">
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index ee0108df8e..253157a561 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1124,6 +1124,31 @@ void CodeTextEditor::trim_trailing_whitespace() {
}
}
+void CodeTextEditor::trim_final_newlines() {
+ int final_line = text_editor->get_line_count() - 1;
+ int check_line = final_line;
+
+ String line = text_editor->get_line(check_line);
+
+ while (line.is_empty() && check_line > -1) {
+ --check_line;
+
+ line = text_editor->get_line(check_line);
+ }
+
+ ++check_line;
+
+ if (check_line < final_line) {
+ text_editor->begin_complex_operation();
+
+ text_editor->remove_text(check_line, 0, final_line, 0);
+
+ text_editor->merge_overlapping_carets();
+ text_editor->end_complex_operation();
+ text_editor->queue_redraw();
+ }
+}
+
void CodeTextEditor::insert_final_newline() {
int final_line = text_editor->get_line_count() - 1;
String line = text_editor->get_line(final_line);
diff --git a/editor/code_editor.h b/editor/code_editor.h
index 75a2a68d58..af33a3fac8 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -224,6 +224,7 @@ protected:
public:
void trim_trailing_whitespace();
+ void trim_final_newlines();
void insert_final_newline();
enum CaseStyle {
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 737bec352d..1e292a3a7b 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -651,6 +651,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// Behavior: Files
_initial_set("text_editor/behavior/files/trim_trailing_whitespace_on_save", false);
+ _initial_set("text_editor/behavior/files/trim_final_newlines_on_save", true);
_initial_set("text_editor/behavior/files/autosave_interval_secs", 0);
_initial_set("text_editor/behavior/files/restore_scripts_on_load", true);
_initial_set("text_editor/behavior/files/convert_indent_on_save", true);
diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp
index aa44189782..5a95b553e9 100644
--- a/editor/export/editor_export_platform.cpp
+++ b/editor/export/editor_export_platform.cpp
@@ -797,6 +797,10 @@ String EditorExportPlatform::_export_customize(const String &p_path, LocalVector
if (!customize_scenes_plugins.is_empty()) {
for (Ref<EditorExportPlugin> &plugin : customize_scenes_plugins) {
Node *customized = plugin->_customize_scene(node, p_path);
+ if (plugin->skipped) {
+ plugin->_clear();
+ return String();
+ }
if (customized != nullptr) {
node = customized;
modified = true;
@@ -830,6 +834,10 @@ String EditorExportPlatform::_export_customize(const String &p_path, LocalVector
if (!customize_resources_plugins.is_empty()) {
for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
Ref<Resource> new_res = plugin->_customize_resource(res, p_path);
+ if (plugin->skipped) {
+ plugin->_clear();
+ return String();
+ }
if (new_res.is_valid()) {
modified = true;
if (new_res != res) {
@@ -1135,6 +1143,10 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
// Before doing this, try to see if it can be customized.
String export_path = _export_customize(path, customize_resources_plugins, customize_scenes_plugins, export_cache, export_base_path, false);
+ if (export_path.is_empty()) {
+ // Skipped from plugin.
+ continue;
+ }
if (export_path != path) {
// It was actually customized.
diff --git a/editor/gui/editor_file_dialog.h b/editor/gui/editor_file_dialog.h
index 7d6fa19a44..6272e27f82 100644
--- a/editor/gui/editor_file_dialog.h
+++ b/editor/gui/editor_file_dialog.h
@@ -268,7 +268,7 @@ protected:
void _notification(int p_what);
bool _set(const StringName &p_name, const Variant &p_value) { return property_helper.property_set_value(p_name, p_value); }
bool _get(const StringName &p_name, Variant &r_ret) const { return property_helper.property_get_value(p_name, r_ret); }
- void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list, options.size()); }
+ void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list); }
bool _property_can_revert(const StringName &p_name) const { return property_helper.property_can_revert(p_name); }
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return property_helper.property_get_revert(p_name, r_property); }
static void _bind_methods();
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 8b44d6b486..59be0fa1de 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -3058,6 +3058,7 @@ void CanvasItemEditor::_draw_ruler_tool() {
return;
}
+ const Ref<Texture2D> position_icon = get_editor_theme_icon(SNAME("EditorPosition"));
if (ruler_tool_active) {
Color ruler_primary_color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
Color ruler_secondary_color = ruler_primary_color;
@@ -3126,8 +3127,7 @@ void CanvasItemEditor::_draw_ruler_tool() {
if (begin.is_equal_approx(end)) {
viewport->draw_string_outline(font, text_pos, (String)ruler_tool_origin, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, outline_size, outline_color);
viewport->draw_string(font, text_pos, (String)ruler_tool_origin, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
- Ref<Texture2D> position_icon = get_editor_theme_icon(SNAME("EditorPosition"));
- viewport->draw_texture(get_editor_theme_icon(SNAME("EditorPosition")), (ruler_tool_origin - view_offset) * zoom - position_icon->get_size() / 2);
+ viewport->draw_texture(position_icon, (ruler_tool_origin - view_offset) * zoom - position_icon->get_size() / 2);
return;
}
@@ -3198,7 +3198,6 @@ void CanvasItemEditor::_draw_ruler_tool() {
}
} else {
if (grid_snap_active) {
- Ref<Texture2D> position_icon = get_editor_theme_icon(SNAME("EditorPosition"));
viewport->draw_texture(position_icon, (ruler_tool_origin - view_offset) * zoom - position_icon->get_size() / 2);
}
}
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 0a0909ec9f..4812c623c9 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1008,6 +1008,10 @@ void ScriptEditor::_resave_scripts(const String &p_str) {
se->trim_trailing_whitespace();
}
+ if (trim_final_newlines_on_save) {
+ se->trim_final_newlines();
+ }
+
se->insert_final_newline();
if (convert_indent_on_save) {
@@ -1402,6 +1406,10 @@ void ScriptEditor::_menu_option(int p_option) {
current->trim_trailing_whitespace();
}
+ if (trim_final_newlines_on_save) {
+ current->trim_final_newlines();
+ }
+
current->insert_final_newline();
if (convert_indent_on_save) {
@@ -2602,6 +2610,10 @@ void ScriptEditor::save_current_script() {
current->trim_trailing_whitespace();
}
+ if (trim_final_newlines_on_save) {
+ current->trim_final_newlines();
+ }
+
current->insert_final_newline();
if (convert_indent_on_save) {
@@ -2646,6 +2658,10 @@ void ScriptEditor::save_all_scripts() {
se->trim_trailing_whitespace();
}
+ if (trim_final_newlines_on_save) {
+ se->trim_final_newlines();
+ }
+
se->insert_final_newline();
if (!se->is_unsaved()) {
@@ -2883,6 +2899,7 @@ void ScriptEditor::_apply_editor_settings() {
}
trim_trailing_whitespace_on_save = EDITOR_GET("text_editor/behavior/files/trim_trailing_whitespace_on_save");
+ trim_final_newlines_on_save = EDITOR_GET("text_editor/behavior/files/trim_final_newlines_on_save");
convert_indent_on_save = EDITOR_GET("text_editor/behavior/files/convert_indent_on_save");
members_overview_enabled = EDITOR_GET("text_editor/script_list/show_members_overview");
@@ -4307,6 +4324,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
edit_pass = 0;
trim_trailing_whitespace_on_save = EDITOR_GET("text_editor/behavior/files/trim_trailing_whitespace_on_save");
+ trim_final_newlines_on_save = EDITOR_GET("text_editor/behavior/files/trim_final_newlines_on_save");
convert_indent_on_save = EDITOR_GET("text_editor/behavior/files/convert_indent_on_save");
ScriptServer::edit_request_func = _open_script_request;
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 6f8e71ce75..9db1aff76a 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -174,6 +174,7 @@ public:
virtual void set_executing_line(int p_line) = 0;
virtual void clear_executing_line() = 0;
virtual void trim_trailing_whitespace() = 0;
+ virtual void trim_final_newlines() = 0;
virtual void insert_final_newline() = 0;
virtual void convert_indent() = 0;
virtual void ensure_focus() = 0;
@@ -408,6 +409,7 @@ class ScriptEditor : public PanelContainer {
bool open_textfile_after_create = true;
bool trim_trailing_whitespace_on_save;
+ bool trim_final_newlines_on_save;
bool convert_indent_on_save;
bool external_editor_active;
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index a5d89ff54c..b11ad8b7d5 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -431,6 +431,10 @@ void ScriptTextEditor::trim_trailing_whitespace() {
code_editor->trim_trailing_whitespace();
}
+void ScriptTextEditor::trim_final_newlines() {
+ code_editor->trim_final_newlines();
+}
+
void ScriptTextEditor::insert_final_newline() {
code_editor->insert_final_newline();
}
@@ -1427,6 +1431,9 @@ void ScriptTextEditor::_edit_option(int p_op) {
case EDIT_TRIM_TRAILING_WHITESAPCE: {
trim_trailing_whitespace();
} break;
+ case EDIT_TRIM_FINAL_NEWLINES: {
+ trim_final_newlines();
+ } break;
case EDIT_CONVERT_INDENT_TO_SPACES: {
code_editor->set_indent_using_spaces(true);
convert_indent();
@@ -1862,6 +1869,11 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
if (drop_modifier_pressed && ResourceLoader::exists(path)) {
Ref<Resource> resource = ResourceLoader::load(path);
+ if (resource.is_null()) {
+ // Resource exists, but failed to load. We need only path and name, so we can use a dummy Resource instead.
+ resource.instantiate();
+ resource->set_path_cache(path);
+ }
text_to_drop += _get_dropped_resource_line(resource, is_empty_line);
} else {
text_to_drop += _quote_drop_data(path);
@@ -2300,6 +2312,7 @@ void ScriptTextEditor::_enable_code_editor() {
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_text_completion_query"), EDIT_COMPLETE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_trailing_whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_final_newlines"), EDIT_TRIM_FINAL_NEWLINES);
{
PopupMenu *sub_menu = memnew(PopupMenu);
sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES);
@@ -2485,6 +2498,7 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/evaluate_selection", TTR("Evaluate Selection"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::E);
ED_SHORTCUT("script_text_editor/toggle_word_wrap", TTR("Toggle Word Wrap"), KeyModifierMask::ALT | Key::Z);
ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::ALT | Key::T);
+ ED_SHORTCUT("script_text_editor/trim_final_newlines", TTR("Trim Final Newlines"), Key::NONE);
ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent to Spaces"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::Y);
ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent to Tabs"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::I);
ED_SHORTCUT("script_text_editor/auto_indent", TTR("Auto Indent"), KeyModifierMask::CMD_OR_CTRL | Key::I);
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index de89fe458c..8c2ec1561b 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -118,6 +118,7 @@ class ScriptTextEditor : public ScriptEditorBase {
EDIT_COMPLETE,
EDIT_AUTO_INDENT,
EDIT_TRIM_TRAILING_WHITESAPCE,
+ EDIT_TRIM_FINAL_NEWLINES,
EDIT_CONVERT_INDENT_TO_SPACES,
EDIT_CONVERT_INDENT_TO_TABS,
EDIT_TOGGLE_COMMENT,
@@ -228,6 +229,7 @@ public:
virtual Variant get_navigation_state() override;
virtual void ensure_focus() override;
virtual void trim_trailing_whitespace() override;
+ virtual void trim_final_newlines() override;
virtual void insert_final_newline() override;
virtual void convert_indent() override;
virtual void tag_saved_version() override;
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 222d010a7a..a83f95f680 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -436,8 +436,14 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
int index = shader_tabs->get_current_tab();
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count());
TextShaderEditor *editor = edited_shaders[index].shader_editor;
- if (editor && editor->get_trim_trailing_whitespace_on_save()) {
- editor->trim_trailing_whitespace();
+ if (editor) {
+ if (editor->get_trim_trailing_whitespace_on_save()) {
+ editor->trim_trailing_whitespace();
+ }
+
+ if (editor->get_trim_final_newlines_on_save()) {
+ editor->trim_final_newlines();
+ }
}
if (edited_shaders[index].shader.is_valid()) {
EditorNode::get_singleton()->save_resource(edited_shaders[index].shader);
@@ -452,8 +458,14 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
int index = shader_tabs->get_current_tab();
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count());
TextShaderEditor *editor = edited_shaders[index].shader_editor;
- if (editor && editor->get_trim_trailing_whitespace_on_save()) {
- editor->trim_trailing_whitespace();
+ if (editor) {
+ if (editor->get_trim_trailing_whitespace_on_save()) {
+ editor->trim_trailing_whitespace();
+ }
+
+ if (editor->get_trim_final_newlines_on_save()) {
+ editor->trim_final_newlines();
+ }
}
String path;
if (edited_shaders[index].shader.is_valid()) {
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 5bc3cafe19..c4c3f3b4e3 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -288,6 +288,10 @@ void TextEditor::trim_trailing_whitespace() {
code_editor->trim_trailing_whitespace();
}
+void TextEditor::trim_final_newlines() {
+ code_editor->trim_final_newlines();
+}
+
void TextEditor::insert_final_newline() {
code_editor->insert_final_newline();
}
@@ -414,6 +418,9 @@ void TextEditor::_edit_option(int p_op) {
case EDIT_TRIM_TRAILING_WHITESAPCE: {
trim_trailing_whitespace();
} break;
+ case EDIT_TRIM_FINAL_NEWLINES: {
+ trim_final_newlines();
+ } break;
case EDIT_CONVERT_INDENT_TO_SPACES: {
code_editor->set_indent_using_spaces(true);
convert_indent();
@@ -641,6 +648,7 @@ TextEditor::TextEditor() {
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/duplicate_lines"), EDIT_DUPLICATE_LINES);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_word_wrap"), EDIT_TOGGLE_WORD_WRAP);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_trailing_whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_final_newlines"), EDIT_TRIM_FINAL_NEWLINES);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_tabs"), EDIT_CONVERT_INDENT_TO_TABS);
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index 38fddc45df..268e5c32b4 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -63,6 +63,7 @@ private:
EDIT_PASTE,
EDIT_SELECT_ALL,
EDIT_TRIM_TRAILING_WHITESAPCE,
+ EDIT_TRIM_FINAL_NEWLINES,
EDIT_CONVERT_INDENT_TO_SPACES,
EDIT_CONVERT_INDENT_TO_TABS,
EDIT_MOVE_LINE_UP,
@@ -133,6 +134,7 @@ public:
virtual void set_executing_line(int p_line) override;
virtual void clear_executing_line() override;
virtual void trim_trailing_whitespace() override;
+ virtual void trim_final_newlines() override;
virtual void insert_final_newline() override;
virtual void convert_indent() override;
virtual void ensure_focus() override;
diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp
index d6cef3ccb9..fb8bed381e 100644
--- a/editor/plugins/text_shader_editor.cpp
+++ b/editor/plugins/text_shader_editor.cpp
@@ -770,6 +770,7 @@ void TextShaderEditor::_apply_editor_settings() {
code_editor->update_editor_settings();
trim_trailing_whitespace_on_save = EDITOR_GET("text_editor/behavior/files/trim_trailing_whitespace_on_save");
+ trim_final_newlines_on_save = EDITOR_GET("text_editor/behavior/files/trim_final_newlines_on_save");
}
void TextShaderEditor::_show_warnings_panel(bool p_show) {
@@ -934,6 +935,10 @@ void TextShaderEditor::save_external_data(const String &p_str) {
trim_trailing_whitespace();
}
+ if (trim_final_newlines_on_save) {
+ trim_final_newlines();
+ }
+
apply_shaders();
Ref<Shader> edited_shader = code_editor->get_edited_shader();
@@ -960,6 +965,10 @@ void TextShaderEditor::trim_trailing_whitespace() {
code_editor->trim_trailing_whitespace();
}
+void TextShaderEditor::trim_final_newlines() {
+ code_editor->trim_final_newlines();
+}
+
void TextShaderEditor::validate_script() {
code_editor->_validate_script();
}
diff --git a/editor/plugins/text_shader_editor.h b/editor/plugins/text_shader_editor.h
index 6d2ac743b8..61066ed7c6 100644
--- a/editor/plugins/text_shader_editor.h
+++ b/editor/plugins/text_shader_editor.h
@@ -176,6 +176,7 @@ class TextShaderEditor : public MarginContainer {
uint32_t dependencies_version = 0xFFFFFFFF;
bool trim_trailing_whitespace_on_save;
+ bool trim_final_newlines_on_save;
protected:
void _notification(int p_what);
@@ -189,6 +190,7 @@ protected:
public:
bool was_compilation_successful() const { return compilation_success; }
bool get_trim_trailing_whitespace_on_save() const { return trim_trailing_whitespace_on_save; }
+ bool get_trim_final_newlines_on_save() const { return trim_final_newlines_on_save; }
void apply_shaders();
void ensure_select_current();
void edit(const Ref<Shader> &p_shader);
@@ -196,6 +198,7 @@ public:
void goto_line_selection(int p_line, int p_begin, int p_end);
void save_external_data(const String &p_str = "");
void trim_trailing_whitespace();
+ void trim_final_newlines();
void validate_script();
bool is_unsaved() const;
void tag_saved_version();
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 4ae39d80cd..11d4a4002c 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -754,13 +754,17 @@ static String _make_arguments_hint(const MethodInfo &p_info, int p_arg_idx, bool
return arghint;
}
-static String _make_arguments_hint(const GDScriptParser::FunctionNode *p_function, int p_arg_idx) {
+static String _make_arguments_hint(const GDScriptParser::FunctionNode *p_function, int p_arg_idx, bool p_just_args = false) {
String arghint;
- if (p_function->get_datatype().builtin_type == Variant::NIL) {
- arghint = "void " + p_function->identifier->name.operator String() + "(";
+ if (p_just_args) {
+ arghint = "(";
} else {
- arghint = p_function->get_datatype().to_string() + " " + p_function->identifier->name.operator String() + "(";
+ if (p_function->get_datatype().builtin_type == Variant::NIL) {
+ arghint = "void " + p_function->identifier->name.operator String() + "(";
+ } else {
+ arghint = p_function->get_datatype().to_string() + " " + p_function->identifier->name.operator String() + "(";
+ }
}
for (int i = 0; i < p_function->parameters.size(); i++) {
@@ -2731,6 +2735,25 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
while (base_type.is_set() && !base_type.is_variant()) {
switch (base_type.kind) {
case GDScriptParser::DataType::CLASS: {
+ if (base_type.is_meta_type && p_method == SNAME("new")) {
+ const GDScriptParser::ClassNode *current = base_type.class_type;
+
+ do {
+ if (current->has_member("_init")) {
+ const GDScriptParser::ClassNode::Member &member = current->get_member("_init");
+
+ if (member.type == GDScriptParser::ClassNode::Member::FUNCTION) {
+ r_arghint = base_type.class_type->get_datatype().to_string() + " new" + _make_arguments_hint(member.function, p_argidx, true);
+ return;
+ }
+ }
+ current = current->base_type.class_type;
+ } while (current != nullptr);
+
+ r_arghint = base_type.class_type->get_datatype().to_string() + " new()";
+ return;
+ }
+
if (base_type.class_type->has_member(p_method)) {
const GDScriptParser::ClassNode::Member &member = base_type.class_type->get_member(p_method);
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp
index 769d97694a..bc3a6d4628 100644
--- a/platform/ios/export/export_plugin.cpp
+++ b/platform/ios/export/export_plugin.cpp
@@ -1370,7 +1370,12 @@ void EditorExportPlatformIOS::_add_assets_to_project(const String &p_out_dir, co
type = "wrapper.framework";
} else if (asset.exported_path.ends_with(".xcframework")) {
- if (asset.should_embed) {
+ int total_libs = 0;
+ int static_libs = 0;
+ int dylibs = 0;
+ int frameworks = 0;
+ _check_xcframework_content(p_out_dir.path_join(asset.exported_path), total_libs, static_libs, dylibs, frameworks);
+ if (asset.should_embed && static_libs != total_libs) {
additional_asset_info_format += "$framework_id = {isa = PBXBuildFile; fileRef = $ref_id; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };\n";
framework_id = (++current_id).str();
pbx_embeded_frameworks += framework_id + ",\n";
diff --git a/platform/linuxbsd/freedesktop_portal_desktop.cpp b/platform/linuxbsd/freedesktop_portal_desktop.cpp
index 464c0e4286..671da7fc2a 100644
--- a/platform/linuxbsd/freedesktop_portal_desktop.cpp
+++ b/platform/linuxbsd/freedesktop_portal_desktop.cpp
@@ -591,7 +591,7 @@ void FreeDesktopPortalDesktop::_thread_monitor(void *p_ud) {
dbus_connection_read_write(portal->monitor_connection, 0);
}
- usleep(50000);
+ OS::get_singleton()->delay_usec(50'000);
}
}
diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp
index 6e546c4531..3534c1afee 100644
--- a/platform/linuxbsd/joypad_linux.cpp
+++ b/platform/linuxbsd/joypad_linux.cpp
@@ -225,7 +225,7 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
udev_device_unref(dev);
}
}
- usleep(50000);
+ OS::get_singleton()->delay_usec(50'000);
}
udev_monitor_unref(mon);
}
@@ -250,7 +250,7 @@ void JoypadLinux::monitor_joypads() {
}
}
closedir(input_directory);
- usleep(1000000); // 1s
+ OS::get_singleton()->delay_usec(1'000'000);
}
}
@@ -508,7 +508,7 @@ void JoypadLinux::joypad_events_thread_run() {
}
}
if (no_events) {
- usleep(10000); // 10ms
+ OS::get_singleton()->delay_usec(10'000);
}
}
}
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index b5d08a377c..767ea927c1 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -2269,7 +2269,7 @@ void DisplayServerX11::window_set_size(const Size2i p_size, WindowID p_window) {
break;
}
- usleep(10000);
+ OS::get_singleton()->delay_usec(10'000);
}
// Keep rendering context window size in sync
@@ -2544,7 +2544,7 @@ void DisplayServerX11::_set_wm_maximized(WindowID p_window, bool p_enabled) {
// Give up after 0.5s, it's not going to happen on this WM.
// https://github.com/godotengine/godot/issues/19978
for (int attempt = 0; window_get_mode(p_window) != WINDOW_MODE_MAXIMIZED && attempt < 50; attempt++) {
- usleep(10000);
+ OS::get_singleton()->delay_usec(10'000);
}
}
wd.maximized = p_enabled;
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 04a7d7f4b8..62e1a433e2 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -1832,24 +1832,6 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo
int w = p_size.width;
int h = p_size.height;
-
- wd.width = w;
- wd.height = h;
-
-#if defined(RD_ENABLED)
- if (rendering_context) {
- rendering_context->window_set_size(p_window, w, h);
- }
-#endif
-#if defined(GLES3_ENABLED)
- if (gl_manager_native) {
- gl_manager_native->window_resize(p_window, w, h);
- }
- if (gl_manager_angle) {
- gl_manager_angle->window_resize(p_window, w, h);
- }
-#endif
-
RECT rect;
GetWindowRect(wd.hWnd, &rect);
@@ -4649,6 +4631,14 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
rendering_context->window_set_size(window_id, window.width, window.height);
}
#endif
+#if defined(GLES3_ENABLED)
+ if (gl_manager_native) {
+ gl_manager_native->window_resize(window_id, window.width, window.height);
+ }
+ if (gl_manager_angle) {
+ gl_manager_angle->window_resize(window_id, window.width, window.height);
+ }
+#endif
}
if (!window.minimized && (!(window_pos_params->flags & SWP_NOMOVE) || window_pos_params->flags & SWP_FRAMECHANGED)) {
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index f7d672620d..d1f1c97ca2 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -722,7 +722,7 @@ bool TileMap::_get(const StringName &p_name, Variant &r_ret) const {
void TileMap::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::INT, "format", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL));
- property_helper.get_property_list(p_list, layers.size());
+ property_helper.get_property_list(p_list);
}
Vector2 TileMap::map_to_local(const Vector2i &p_pos) const {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 0d5c69b207..0682c11a9b 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1739,12 +1739,15 @@ void Control::_size_changed() {
data.size_cache = new_size_cache;
if (is_inside_tree()) {
- if (size_changed) {
- notification(NOTIFICATION_RESIZED);
- }
if (pos_changed || size_changed) {
- item_rect_changed(size_changed);
+ // Ensure global transform is marked as dirty before `NOTIFICATION_RESIZED` / `item_rect_changed` signal
+ // so an up to date global transform could be obtained when handling these.
_notify_transform();
+
+ if (size_changed) {
+ notification(NOTIFICATION_RESIZED);
+ }
+ item_rect_changed(size_changed);
}
if (pos_changed && !size_changed) {
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index 4236f0a56b..9680157f0a 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -194,7 +194,7 @@ protected:
void _notification(int p_what);
bool _set(const StringName &p_name, const Variant &p_value) { return property_helper.property_set_value(p_name, p_value); }
bool _get(const StringName &p_name, Variant &r_ret) const { return property_helper.property_get_value(p_name, r_ret); }
- void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list, options.size()); }
+ void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list); }
bool _property_can_revert(const StringName &p_name) const { return property_helper.property_can_revert(p_name); }
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return property_helper.property_get_revert(p_name, r_property); }
static void _bind_methods();
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 4c035ee4e6..9a57b9d8fe 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -162,7 +162,7 @@ protected:
void _notification(int p_what);
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const { return property_helper.property_get_value(p_name, r_ret); }
- void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list, items.size()); }
+ void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list); }
bool _property_can_revert(const StringName &p_name) const { return property_helper.property_can_revert(p_name); }
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return property_helper.property_get_revert(p_name, r_property); }
static void _bind_methods();
diff --git a/scene/gui/menu_button.h b/scene/gui/menu_button.h
index 2bd577ddd0..5a74d61091 100644
--- a/scene/gui/menu_button.h
+++ b/scene/gui/menu_button.h
@@ -52,7 +52,7 @@ protected:
void _notification(int p_what);
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
- void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list, popup->get_item_count()); }
+ void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list); }
bool _property_can_revert(const StringName &p_name) const { return property_helper.property_can_revert(p_name); }
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return property_helper.property_get_revert(p_name, r_property); }
static void _bind_methods();
diff --git a/scene/gui/option_button.h b/scene/gui/option_button.h
index 4b5164161a..351df9a749 100644
--- a/scene/gui/option_button.h
+++ b/scene/gui/option_button.h
@@ -84,7 +84,7 @@ protected:
void _notification(int p_what);
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const { return property_helper.property_get_value(p_name, r_ret); }
- void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list, popup->get_item_count()); }
+ void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list); }
bool _property_can_revert(const StringName &p_name) const { return property_helper.property_can_revert(p_name); }
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return property_helper.property_get_revert(p_name, r_property); }
void _validate_property(PropertyInfo &p_property) const;
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index 832c1bcc8b..c6eef03aca 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -218,7 +218,7 @@ protected:
void _notification(int p_what);
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const { return property_helper.property_get_value(p_name, r_ret); }
- void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list, items.size()); }
+ void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list); }
bool _property_can_revert(const StringName &p_name) const { return property_helper.property_can_revert(p_name); }
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return property_helper.property_get_revert(p_name, r_property); }
static void _bind_methods();
diff --git a/scene/gui/tab_bar.h b/scene/gui/tab_bar.h
index 52f1da5ec8..d62b39ae16 100644
--- a/scene/gui/tab_bar.h
+++ b/scene/gui/tab_bar.h
@@ -175,7 +175,7 @@ protected:
bool _set(const StringName &p_name, const Variant &p_value) { return property_helper.property_set_value(p_name, p_value); }
bool _get(const StringName &p_name, Variant &r_ret) const { return property_helper.property_get_value(p_name, r_ret); }
- void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list, tabs.size()); }
+ void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list); }
bool _property_can_revert(const StringName &p_name) const { return property_helper.property_can_revert(p_name); }
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return property_helper.property_get_revert(p_name, r_property); }
void _notification(int p_what);
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 7ed1f130c8..c0386b056f 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -34,6 +34,7 @@
#include "scene/2d/canvas_group.h"
#include "scene/main/canvas_layer.h"
#include "scene/main/window.h"
+#include "scene/resources/atlas_texture.h"
#include "scene/resources/canvas_item_material.h"
#include "scene/resources/font.h"
#include "scene/resources/multimesh.h"
@@ -850,18 +851,28 @@ void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color
ERR_THREAD_GUARD;
ERR_DRAW_GUARD;
- RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
+ const Ref<AtlasTexture> atlas = p_texture;
+ if (atlas.is_valid() && atlas->get_atlas().is_valid()) {
+ const Ref<Texture2D> &texture = atlas->get_atlas();
+ const Vector2 atlas_size = texture->get_size();
+
+ const Vector2 remap_min = atlas->get_region().position / atlas_size;
+ const Vector2 remap_max = atlas->get_region().get_end() / atlas_size;
- RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, p_uvs, rid);
+ PackedVector2Array uvs = p_uvs;
+ for (Vector2 &p : uvs) {
+ p.x = Math::remap(p.x, 0, 1, remap_min.x, remap_max.x);
+ p.y = Math::remap(p.y, 0, 1, remap_min.y, remap_max.y);
+ }
+ RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, uvs, texture->get_rid());
+ } else {
+ RID texture_rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
+ RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, p_uvs, texture_rid);
+ }
}
void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture) {
- ERR_THREAD_GUARD;
- ERR_DRAW_GUARD;
-
- Vector<Color> colors = { p_color };
- RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, colors, p_uvs, rid);
+ draw_polygon(p_points, { p_color }, p_uvs, p_texture);
}
void CanvasItem::draw_mesh(const Ref<Mesh> &p_mesh, const Ref<Texture2D> &p_texture, const Transform2D &p_transform, const Color &p_modulate) {
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index addbd6078a..b5824bc695 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -408,6 +408,16 @@ Point2i Window::get_position_with_decorations() const {
if (window_id != DisplayServer::INVALID_WINDOW_ID) {
return DisplayServer::get_singleton()->window_get_position_with_decorations(window_id);
}
+ if (visible && is_embedded() && !get_flag(Window::FLAG_BORDERLESS)) {
+ Size2 border_offset;
+ if (theme_cache.embedded_border.is_valid()) {
+ border_offset = theme_cache.embedded_border->get_offset();
+ }
+ if (theme_cache.embedded_unfocused_border.is_valid()) {
+ border_offset = border_offset.max(theme_cache.embedded_unfocused_border->get_offset());
+ }
+ return position - border_offset;
+ }
return position;
}
@@ -416,6 +426,16 @@ Size2i Window::get_size_with_decorations() const {
if (window_id != DisplayServer::INVALID_WINDOW_ID) {
return DisplayServer::get_singleton()->window_get_size_with_decorations(window_id);
}
+ if (visible && is_embedded() && !get_flag(Window::FLAG_BORDERLESS)) {
+ Size2 border_size;
+ if (theme_cache.embedded_border.is_valid()) {
+ border_size = theme_cache.embedded_border->get_minimum_size();
+ }
+ if (theme_cache.embedded_unfocused_border.is_valid()) {
+ border_size = border_size.max(theme_cache.embedded_unfocused_border->get_minimum_size());
+ }
+ return size + border_size;
+ }
return size;
}
diff --git a/scene/property_list_helper.cpp b/scene/property_list_helper.cpp
index 152ecaf89d..ce258ee8c3 100644
--- a/scene/property_list_helper.cpp
+++ b/scene/property_list_helper.cpp
@@ -122,8 +122,9 @@ bool PropertyListHelper::is_property_valid(const String &p_property, int *r_inde
return property_list.has(components[1]);
}
-void PropertyListHelper::get_property_list(List<PropertyInfo> *p_list, int p_count) const {
- for (int i = 0; i < p_count; i++) {
+void PropertyListHelper::get_property_list(List<PropertyInfo> *p_list) const {
+ const int property_count = _call_array_length_getter();
+ for (int i = 0; i < property_count; i++) {
for (const KeyValue<String, Property> &E : property_list) {
const Property &property = E.value;
@@ -177,7 +178,9 @@ bool PropertyListHelper::property_get_revert(const String &p_property, Variant &
PropertyListHelper::~PropertyListHelper() {
// No object = it's the main helper. Do a cleanup.
- if (!object) {
+ if (!object && is_initialized()) {
+ memdelete(array_length_getter);
+
for (const KeyValue<String, Property> &E : property_list) {
if (E.value.setter) {
memdelete(E.value.setter);
diff --git a/scene/property_list_helper.h b/scene/property_list_helper.h
index e19e7cd22e..6bc65f6e3e 100644
--- a/scene/property_list_helper.h
+++ b/scene/property_list_helper.h
@@ -77,7 +77,7 @@ public:
void setup_for_instance(const PropertyListHelper &p_base, Object *p_object);
bool is_property_valid(const String &p_property, int *r_index = nullptr) const;
- void get_property_list(List<PropertyInfo> *p_list, int p_count) const;
+ void get_property_list(List<PropertyInfo> *p_list) const;
bool property_get_value(const String &p_property, Variant &r_ret) const;
bool property_set_value(const String &p_property, const Variant &p_value) const;
bool property_can_revert(const String &p_property) const;
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 01a4a09942..aa1ad4cc3a 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -260,7 +260,7 @@ protected:
bool _set(const StringName &p_name, const Variant &p_value) { return property_helper.property_set_value(p_name, p_value); }
bool _get(const StringName &p_name, Variant &r_ret) const { return property_helper.property_get_value(p_name, r_ret); }
- void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list, audio_stream_pool.size()); }
+ void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list); }
bool _property_can_revert(const StringName &p_name) const { return property_helper.property_can_revert(p_name); }
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return property_helper.property_get_revert(p_name, r_property); }