summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp12
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/object.cpp16
-rw-r--r--doc/classes/BaseButton.xml1
-rw-r--r--doc/classes/CollisionObject2D.xml2
-rw-r--r--doc/classes/ColorPickerButton.xml2
-rw-r--r--doc/classes/Crypto.xml1
-rw-r--r--doc/classes/CryptoKey.xml1
-rw-r--r--doc/classes/Engine.xml16
-rw-r--r--doc/classes/HashingContext.xml1
-rw-r--r--doc/classes/MainLoop.xml1
-rw-r--r--doc/classes/NinePatchRect.xml2
-rw-r--r--doc/classes/PoolByteArray.xml5
-rw-r--r--doc/classes/ShaderMaterial.xml2
-rw-r--r--doc/classes/SpriteFrames.xml1
-rw-r--r--doc/classes/StreamPeerSSL.xml1
-rw-r--r--doc/classes/StyleBox.xml8
-rw-r--r--doc/classes/Thread.xml3
-rw-r--r--doc/classes/X509Certificate.xml1
-rw-r--r--editor/editor_node.cpp47
-rw-r--r--editor/editor_node.h2
-rw-r--r--editor/editor_resource_preview.cpp2
-rw-r--r--editor/icons/icon_crosshair.svg1
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp25
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp11
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp15
-rw-r--r--editor/plugins/spatial_editor_plugin.h1
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp10
-rw-r--r--main/main.cpp11
-rw-r--r--modules/gdscript/gdscript.h1
-rw-r--r--modules/gdscript/gdscript_compiler.cpp4
-rw-r--r--modules/gdscript/gdscript_parser.cpp14
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.cpp5
-rw-r--r--modules/mono/csharp_script.cpp54
-rw-r--r--modules/mono/csharp_script.h8
-rw-r--r--modules/mono/glue/base_object_glue.cpp1
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp1
-rw-r--r--modules/squish/image_compress_squish.cpp2
-rw-r--r--modules/squish/image_compress_squish.h2
-rw-r--r--modules/squish/register_types.cpp2
-rw-r--r--modules/visual_script/visual_script_editor.cpp4
-rw-r--r--modules/websocket/doc_classes/WebSocketClient.xml4
-rw-r--r--modules/websocket/doc_classes/WebSocketServer.xml2
-rw-r--r--platform/android/export/export.cpp148
-rw-r--r--platform/android/java/app/AndroidManifest.xml2
-rw-r--r--platform/android/java/lib/AndroidManifest.xml2
-rw-r--r--platform/android/java/lib/res/drawable-nodpi/icon.pngbin7569 -> 0 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-anydpi-v26/icon.xml5
-rw-r--r--platform/android/java/lib/res/mipmap-hdpi/icon.pngbin0 -> 3762 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-hdpi/icon_background.pngbin0 -> 375 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-hdpi/icon_foreground.pngbin0 -> 2998 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-mdpi/icon.pngbin0 -> 2672 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-mdpi/icon_background.pngbin0 -> 240 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-mdpi/icon_foreground.pngbin0 -> 1909 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xhdpi/icon.pngbin0 -> 5186 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xhdpi/icon_background.pngbin0 -> 517 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xhdpi/icon_foreground.pngbin0 -> 4490 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxhdpi/icon.pngbin0 -> 8154 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxhdpi/icon_background.pngbin0 -> 905 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxhdpi/icon_foreground.pngbin0 -> 7415 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxxhdpi/icon.pngbin0 -> 11749 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxxhdpi/icon_background.pngbin0 -> 1360 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxxhdpi/icon_foreground.pngbin0 -> 11325 bytes
-rw-r--r--platform/android/java/lib/res/mipmap/icon.pngbin0 -> 11749 bytes
-rw-r--r--platform/android/java/lib/res/mipmap/icon_background.pngbin0 -> 240 bytes
-rw-r--r--platform/android/java/lib/res/mipmap/icon_foreground.pngbin0 -> 1909 bytes
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotLib.java2
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java2
-rw-r--r--platform/android/java_godot_lib_jni.cpp2
-rw-r--r--platform/android/java_godot_lib_jni.h2
-rw-r--r--platform/haiku/detect.py2
-rw-r--r--platform/javascript/export/export.cpp18
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm6
-rw-r--r--platform/server/detect.py2
-rw-r--r--platform/server/os_server.h1
-rw-r--r--platform/x11/detect.py2
-rw-r--r--scene/2d/light_2d.cpp4
-rw-r--r--scene/2d/node_2d.cpp1
-rw-r--r--scene/gui/center_container.cpp6
-rw-r--r--scene/gui/control.cpp5
-rw-r--r--scene/gui/graph_edit.cpp24
-rw-r--r--scene/gui/item_list.cpp2
-rw-r--r--scene/gui/scroll_container.cpp45
-rw-r--r--scene/gui/scroll_container.h1
87 files changed, 405 insertions, 194 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 0eacffeb88..68650019a2 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -3024,6 +3024,16 @@ float _Engine::get_frames_per_second() const {
return Engine::get_singleton()->get_frames_per_second();
}
+uint64_t _Engine::get_physics_frames() const {
+
+ return Engine::get_singleton()->get_physics_frames();
+}
+
+uint64_t _Engine::get_idle_frames() const {
+
+ return Engine::get_singleton()->get_idle_frames();
+}
+
void _Engine::set_time_scale(float p_scale) {
Engine::get_singleton()->set_time_scale(p_scale);
}
@@ -3108,6 +3118,8 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_frames_drawn"), &_Engine::get_frames_drawn);
ClassDB::bind_method(D_METHOD("get_frames_per_second"), &_Engine::get_frames_per_second);
+ ClassDB::bind_method(D_METHOD("get_physics_frames"), &_Engine::get_physics_frames);
+ ClassDB::bind_method(D_METHOD("get_idle_frames"), &_Engine::get_idle_frames);
ClassDB::bind_method(D_METHOD("get_main_loop"), &_Engine::get_main_loop);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 7c5031cad4..65f20c375e 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -747,6 +747,8 @@ public:
int get_target_fps() const;
float get_frames_per_second() const;
+ uint64_t get_physics_frames() const;
+ uint64_t get_idle_frames() const;
int get_frames_drawn();
diff --git a/core/object.cpp b/core/object.cpp
index 35ccc38d4e..21666a334c 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1185,13 +1185,11 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int
const Connection &c = slot_map.getv(i).conn;
- Object *target;
-#ifdef DEBUG_ENABLED
- target = ObjectDB::get_instance(slot_map.getk(i)._id);
- ERR_CONTINUE(!target);
-#else
- target = c.target;
-#endif
+ Object *target = ObjectDB::get_instance(slot_map.getk(i)._id);
+ if (!target) {
+ // Target might have been deleted during signal callback, this is expected and OK.
+ continue;
+ }
const Variant **args = p_args;
int argc = p_argcount;
@@ -1519,10 +1517,6 @@ void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const
Signal *s = signal_map.getptr(p_signal);
ERR_FAIL_COND_MSG(!s, vformat("Nonexistent signal '%s' in %s.", p_signal, to_string()));
- ERR_FAIL_COND_MSG(s->lock > 0,
- vformat("Attempt to disconnect %s signal '%s' while in emission callback '%s' (in target %s). Use CONNECT_DEFERRED (to be able to safely disconnect) or CONNECT_ONESHOT (for automatic disconnection) as connection flags.",
- to_string(), p_signal, p_to_method, p_to_object->to_string()));
-
Signal::Target target(p_to_object->get_instance_id(), p_to_method);
ERR_FAIL_COND_MSG(!s->slot_map.has(target), "Disconnecting nonexistent signal '" + p_signal + "', slot: " + itos(target._id) + ":" + target.method + ".");
diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml
index 21f46efe84..0128e7b220 100644
--- a/doc/classes/BaseButton.xml
+++ b/doc/classes/BaseButton.xml
@@ -112,6 +112,7 @@
The state of buttons are disabled.
</constant>
<constant name="DRAW_HOVER_PRESSED" value="4" enum="DrawMode">
+ The state of buttons are both hovered and pressed.
</constant>
<constant name="ACTION_MODE_BUTTON_PRESS" value="0" enum="ActionMode">
Require just a press to consider the button clicked.
diff --git a/doc/classes/CollisionObject2D.xml b/doc/classes/CollisionObject2D.xml
index b9ec9480cf..bbc2e44dc0 100644
--- a/doc/classes/CollisionObject2D.xml
+++ b/doc/classes/CollisionObject2D.xml
@@ -44,6 +44,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ Returns the [code]one_way_collision_margin[/code] of the shape owner identified by given [code]owner_id[/code].
</description>
</method>
<method name="get_shape_owners">
@@ -199,6 +200,7 @@
<argument index="1" name="margin" type="float">
</argument>
<description>
+ Sets the [code]one_way_collision_margin[/code] of the shape owner identified by given [code]owner_id[/code] to [code]margin[/code] pixels.
</description>
</method>
<method name="shape_owner_set_transform">
diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml
index e8c78fb6bf..37116b096a 100644
--- a/doc/classes/ColorPickerButton.xml
+++ b/doc/classes/ColorPickerButton.xml
@@ -43,10 +43,12 @@
</signal>
<signal name="picker_created">
<description>
+ Emitted when the [ColorPicker] is created (the button is pressed for the first time).
</description>
</signal>
<signal name="popup_closed">
<description>
+ Emitted when the [ColorPicker] is closed.
</description>
</signal>
</signals>
diff --git a/doc/classes/Crypto.xml b/doc/classes/Crypto.xml
index bce7895973..bb2c443618 100644
--- a/doc/classes/Crypto.xml
+++ b/doc/classes/Crypto.xml
@@ -22,6 +22,7 @@
key.save("user://generated.key")
cert.save("user://generated.crt")
[/codeblock]
+ [b]Note:[/b] Not available in HTML5 exports.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/CryptoKey.xml b/doc/classes/CryptoKey.xml
index 8c825c9e1c..8feb7d4809 100644
--- a/doc/classes/CryptoKey.xml
+++ b/doc/classes/CryptoKey.xml
@@ -6,6 +6,7 @@
<description>
The CryptoKey class represents a cryptographic key. Keys can be loaded and saved like any other [Resource].
They can be used to generate a self-signed [X509Certificate] via [method Crypto.generate_self_signed_certificate] and as private key in [method StreamPeerSSL.accept_stream] along with the appropriate certificate.
+ [b]Note:[/b] Not available in HTML5 exports.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml
index 04e203793b..53ddde0e4a 100644
--- a/doc/classes/Engine.xml
+++ b/doc/classes/Engine.xml
@@ -41,7 +41,7 @@
<return type="int">
</return>
<description>
- Returns the total number of frames drawn.
+ Returns the total number of frames drawn. If the render loop is disabled with [code]--disable-render-loop[/code] via command line, this returns [code]0[/code]. See also [method get_idle_frames].
</description>
</method>
<method name="get_frames_per_second" qualifiers="const">
@@ -51,6 +51,13 @@
Returns the frames per second of the running game.
</description>
</method>
+ <method name="get_idle_frames" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the total number of frames passed since engine initialization which is advanced on each [b]idle frame[/b], regardless of whether the render loop is enabled. See also [method get_frames_drawn].
+ </description>
+ </method>
<method name="get_license_info" qualifiers="const">
<return type="Dictionary">
</return>
@@ -72,6 +79,13 @@
Returns the main loop object (see [MainLoop] and [SceneTree]).
</description>
</method>
+ <method name="get_physics_frames" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the total number of frames passed since engine initialization which is advanced on each [b]physics frame[/b].
+ </description>
+ </method>
<method name="get_physics_interpolation_fraction" qualifiers="const">
<return type="float">
</return>
diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml
index 802b186ef3..8a20eb99b8 100644
--- a/doc/classes/HashingContext.xml
+++ b/doc/classes/HashingContext.xml
@@ -27,6 +27,7 @@
# Print the result as hex string and array.
printt(res.hex_encode(), Array(res))
[/codeblock]
+ [b]Note:[/b] Not available in HTML5 exports.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/MainLoop.xml b/doc/classes/MainLoop.xml
index d5ca39e09a..606c898a35 100644
--- a/doc/classes/MainLoop.xml
+++ b/doc/classes/MainLoop.xml
@@ -69,6 +69,7 @@
<argument index="1" name="meta" type="Variant">
</argument>
<description>
+ Called when the user performs an action in the system global menu (e.g. the Mac OS menu bar).
</description>
</method>
<method name="_idle" qualifiers="virtual">
diff --git a/doc/classes/NinePatchRect.xml b/doc/classes/NinePatchRect.xml
index 8935ac9d94..7a7973684d 100644
--- a/doc/classes/NinePatchRect.xml
+++ b/doc/classes/NinePatchRect.xml
@@ -15,6 +15,7 @@
<argument index="0" name="margin" type="int" enum="Margin">
</argument>
<description>
+ Returns the size of the margin identified by the given [enum Margin] constant.
</description>
</method>
<method name="set_patch_margin">
@@ -25,6 +26,7 @@
<argument index="1" name="value" type="int">
</argument>
<description>
+ Sets the size of the margin identified by the given [enum Margin] constant to [code]value[/code] in pixels.
</description>
</method>
</methods>
diff --git a/doc/classes/PoolByteArray.xml b/doc/classes/PoolByteArray.xml
index 867f042cd2..83c348f6be 100644
--- a/doc/classes/PoolByteArray.xml
+++ b/doc/classes/PoolByteArray.xml
@@ -78,6 +78,11 @@
<return type="String">
</return>
<description>
+ Returns a hexadecimal representation of this array as a [String].
+ [codeblock]
+ var array = PoolByteArray([11, 46, 255])
+ print(array.hex_encode()) # Prints: 0b2eff
+ [/codeblock]
</description>
</method>
<method name="insert">
diff --git a/doc/classes/ShaderMaterial.xml b/doc/classes/ShaderMaterial.xml
index ef355c4417..0f39b703ca 100644
--- a/doc/classes/ShaderMaterial.xml
+++ b/doc/classes/ShaderMaterial.xml
@@ -25,6 +25,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns [code]true[/code] if the property identified by [code]name[/code] can be reverted to a default value.
</description>
</method>
<method name="property_get_revert">
@@ -33,6 +34,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns the default value of the material property with given [code]name[/code].
</description>
</method>
<method name="set_shader_param">
diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml
index f28192519e..2f2075074c 100644
--- a/doc/classes/SpriteFrames.xml
+++ b/doc/classes/SpriteFrames.xml
@@ -170,6 +170,7 @@
</methods>
<members>
<member name="frames" type="Array" setter="_set_frames" getter="_get_frames">
+ Compatibility property, always equals to an empty array.
</member>
</members>
<constants>
diff --git a/doc/classes/StreamPeerSSL.xml b/doc/classes/StreamPeerSSL.xml
index b34d8d1b25..eea44ef93d 100644
--- a/doc/classes/StreamPeerSSL.xml
+++ b/doc/classes/StreamPeerSSL.xml
@@ -38,6 +38,7 @@
</argument>
<description>
Connects to a peer using an underlying [StreamPeer] [code]stream[/code]. If [code]validate_certs[/code] is [code]true[/code], [StreamPeerSSL] will validate that the certificate presented by the peer matches the [code]for_hostname[/code].
+ [b]Note:[/b] Specifying a custom [code]valid_certificate[/code] is not supported in HTML5 exports due to browsers restrictions.
</description>
</method>
<method name="disconnect_from_stream">
diff --git a/doc/classes/StyleBox.xml b/doc/classes/StyleBox.xml
index 1d873ef0b1..1a11904792 100644
--- a/doc/classes/StyleBox.xml
+++ b/doc/classes/StyleBox.xml
@@ -17,18 +17,22 @@
<argument index="1" name="rect" type="Rect2">
</argument>
<description>
+ Draws this stylebox using a [CanvasItem] with given [RID].
+ You can get a [RID] value using [method Object.get_instance_id] on a [CanvasItem]-derived node.
</description>
</method>
<method name="get_center_size" qualifiers="const">
<return type="Vector2">
</return>
<description>
+ Returns the size of this [StyleBox] without the margins.
</description>
</method>
<method name="get_current_item_drawn" qualifiers="const">
<return type="CanvasItem">
</return>
<description>
+ Returns the [CanvasItem] that handles its [constant CanvasItem.NOTIFICATION_DRAW] or [method CanvasItem._draw] callback at this moment.
</description>
</method>
<method name="get_default_margin" qualifiers="const">
@@ -37,6 +41,7 @@
<argument index="0" name="margin" type="int" enum="Margin">
</argument>
<description>
+ Returns the default value of the specified [enum Margin].
</description>
</method>
<method name="get_margin" qualifiers="const">
@@ -45,7 +50,7 @@
<argument index="0" name="margin" type="int" enum="Margin">
</argument>
<description>
- Returns the content margin offset for the specified margin.
+ Returns the content margin offset for the specified [enum Margin].
Positive values reduce size inwards, unlike [Control]'s margin values.
</description>
</method>
@@ -71,6 +76,7 @@
<argument index="1" name="offset" type="float">
</argument>
<description>
+ Sets the default value of the specified [enum Margin] to given [code]offset[/code] in pixels.
</description>
</method>
<method name="test_mask" qualifiers="const">
diff --git a/doc/classes/Thread.xml b/doc/classes/Thread.xml
index 25e40d4c1f..e56ea2325e 100644
--- a/doc/classes/Thread.xml
+++ b/doc/classes/Thread.xml
@@ -50,10 +50,13 @@
</methods>
<constants>
<constant name="PRIORITY_LOW" value="0" enum="Priority">
+ A thread running with lower priority than normally.
</constant>
<constant name="PRIORITY_NORMAL" value="1" enum="Priority">
+ A thread with a standard priority.
</constant>
<constant name="PRIORITY_HIGH" value="2" enum="Priority">
+ A thread running with higher priority than normally.
</constant>
</constants>
</class>
diff --git a/doc/classes/X509Certificate.xml b/doc/classes/X509Certificate.xml
index 50e9e4e0d4..5f3e91c4e6 100644
--- a/doc/classes/X509Certificate.xml
+++ b/doc/classes/X509Certificate.xml
@@ -6,6 +6,7 @@
<description>
The X509Certificate class represents an X509 certificate. Certificates can be loaded and saved like any other [Resource].
They can be used as the server certificate in [method StreamPeerSSL.accept_stream] (along with the proper [CryptoKey]), and to specify the only certificate that should be accepted when connecting to an SSL server via [method StreamPeerSSL.connect_to_stream].
+ [b]Note:[/b] Not available in HTML5 exports.
</description>
<tutorials>
</tutorials>
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0ea8e04471..c5b67eb971 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -369,6 +369,19 @@ void EditorNode::_notification(int p_what) {
case NOTIFICATION_READY: {
+ {
+ _initializing_addons = true;
+ Vector<String> addons;
+ if (ProjectSettings::get_singleton()->has_setting("editor_plugins/enabled")) {
+ addons = ProjectSettings::get_singleton()->get("editor_plugins/enabled");
+ }
+
+ for (int i = 0; i < addons.size(); i++) {
+ set_addon_plugin_enabled(addons[i], true);
+ }
+ _initializing_addons = false;
+ }
+
VisualServer::get_singleton()->viewport_set_hide_scenario(get_scene_root()->get_viewport_rid(), true);
VisualServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport_rid(), true);
VisualServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(), true);
@@ -660,12 +673,14 @@ void EditorNode::_sources_changed(bool p_exist) {
if (waiting_for_first_scan) {
waiting_for_first_scan = false;
- EditorResourcePreview::get_singleton()->start(); //start previes now that it's safe
+ // Start preview thread now that it's safe.
+ if (!singleton->cmdline_export_mode) {
+ EditorResourcePreview::get_singleton()->start();
+ }
_load_docks();
if (defer_load_scene != "") {
-
load_scene(defer_load_scene);
defer_load_scene = "";
}
@@ -1155,7 +1170,10 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
save.step(TTR("Saving Scene"), 4);
_save_scene(p_file, p_idx);
- EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
+
+ if (!singleton->cmdline_export_mode) {
+ EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
+ }
}
bool EditorNode::_validate_scene_recursive(const String &p_filename, Node *p_node) {
@@ -3839,7 +3857,7 @@ Ref<Texture> EditorNode::get_class_icon(const String &p_class, const String &p_f
void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) {
- if (singleton->disable_progress_dialog) {
+ if (singleton->cmdline_export_mode) {
print_line(p_task + ": begin: " + p_label + " steps: " + itos(p_steps));
} else {
singleton->progress_dialog->add_task(p_task, p_label, p_steps, p_can_cancel);
@@ -3848,7 +3866,7 @@ void EditorNode::progress_add_task(const String &p_task, const String &p_label,
bool EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) {
- if (singleton->disable_progress_dialog) {
+ if (singleton->cmdline_export_mode) {
print_line("\t" + p_task + ": step " + itos(p_step) + ": " + p_state);
return false;
} else {
@@ -3859,7 +3877,7 @@ bool EditorNode::progress_task_step(const String &p_task, const String &p_state,
void EditorNode::progress_end_task(const String &p_task) {
- if (singleton->disable_progress_dialog) {
+ if (singleton->cmdline_export_mode) {
print_line(p_task + ": end");
} else {
singleton->progress_dialog->end_task(p_task);
@@ -3945,7 +3963,7 @@ Error EditorNode::export_preset(const String &p_preset, const String &p_path, bo
export_defer.path = p_path;
export_defer.debug = p_debug;
export_defer.pack_only = p_pack_only;
- disable_progress_dialog = true;
+ cmdline_export_mode = true;
return OK;
}
@@ -5587,7 +5605,7 @@ EditorNode::EditorNode() {
_initializing_addons = false;
docks_visible = true;
restoring_scenes = false;
- disable_progress_dialog = false;
+ cmdline_export_mode = false;
scene_distraction = false;
script_distraction = false;
@@ -6776,19 +6794,6 @@ EditorNode::EditorNode() {
import_dock->initialize_import_options();
- {
- _initializing_addons = true;
- Vector<String> addons;
- if (ProjectSettings::get_singleton()->has_setting("editor_plugins/enabled")) {
- addons = ProjectSettings::get_singleton()->get("editor_plugins/enabled");
- }
-
- for (int i = 0; i < addons.size(); i++) {
- set_addon_plugin_enabled(addons[i], true);
- }
- _initializing_addons = false;
- }
-
FileAccess::set_file_close_fail_notify_callback(_file_access_close_error_notify);
waiting_for_first_scan = true;
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 7f53f77c76..a5c04d3531 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -561,7 +561,7 @@ private:
bool pack_only;
} export_defer;
- bool disable_progress_dialog;
+ bool cmdline_export_mode;
static EditorNode *singleton;
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 9d31e26086..f63d4884e2 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -215,7 +215,6 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
void EditorResourcePreview::_thread() {
-#ifndef SERVER_ENABLED
exited = false;
while (!exit) {
@@ -349,7 +348,6 @@ void EditorResourcePreview::_thread() {
preview_mutex->unlock();
}
}
-#endif
exited = true;
}
diff --git a/editor/icons/icon_crosshair.svg b/editor/icons/icon_crosshair.svg
new file mode 100644
index 0000000000..b6fa5ec654
--- /dev/null
+++ b/editor/icons/icon_crosshair.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m6 1v5h-5v1 3h5v5h4v-5h5v-4h-5v-5z" fill-opacity=".627451"/><path d="m2 7v2l5.0000803.0000197-.0000803 4.9999803h2l-.0000803-4.9999803 5.0000803-.0000197v-2l-5.0000803.0001803.0000803-5.0001803h-2l.0000803 5.0001803z" fill="#fefefe" fill-opacity=".862745"/></svg> \ No newline at end of file
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 5b41da6e8e..5e69ce4e69 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -997,9 +997,9 @@ void AnimationPlayerEditor::_animation_duplicate() {
String new_name = current;
while (player->has_animation(new_name)) {
-
new_name = new_name + " (copy)";
}
+ new_anim->set_name(new_name);
undo_redo->create_action(TTR("Duplicate Animation"));
undo_redo->add_do_method(player, "add_animation", new_name, new_anim);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 9223e86f42..e9a705a0dc 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -3987,29 +3987,21 @@ void CanvasItemEditor::_update_scrollbars() {
updating_scroll = true;
- // Move the zoom buttons
+ // Move the zoom buttons.
Point2 controls_vb_begin = Point2(5, 5);
controls_vb_begin += (show_rulers) ? Point2(RULER_WIDTH, RULER_WIDTH) : Point2();
controls_vb->set_begin(controls_vb_begin);
- // Move and resize the scrollbars
- Size2 size = viewport->get_size();
Size2 hmin = h_scroll->get_minimum_size();
Size2 vmin = v_scroll->get_minimum_size();
- v_scroll->set_begin(Point2(size.width - vmin.width, (show_rulers) ? RULER_WIDTH : 0));
- v_scroll->set_end(Point2(size.width, size.height));
-
- h_scroll->set_begin(Point2((show_rulers) ? RULER_WIDTH : 0, size.height - hmin.height));
- h_scroll->set_end(Point2(size.width - vmin.width, size.height));
-
- // Get the visible frame
+ // Get the visible frame.
Size2 screen_rect = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height"));
Rect2 local_rect = Rect2(Point2(), viewport->get_size() - Size2(vmin.width, hmin.height));
_queue_update_bone_list();
- // Calculate scrollable area
+ // Calculate scrollable area.
Rect2 canvas_item_rect = Rect2(Point2(), screen_rect);
if (editor->get_edited_scene()) {
Rect2 content_rect = _get_encompassing_rect(editor->get_edited_scene());
@@ -4019,7 +4011,8 @@ void CanvasItemEditor::_update_scrollbars() {
canvas_item_rect.size += screen_rect * 2;
canvas_item_rect.position -= screen_rect;
- // Constraints the view offset and updates the scrollbars
+ // Constraints the view offset and updates the scrollbars.
+ Size2 size = viewport->get_size();
Point2 begin = canvas_item_rect.position;
Point2 end = canvas_item_rect.position + canvas_item_rect.size - local_rect.size / zoom;
bool constrain_editor_view = bool(EditorSettings::get_singleton()->get("editors/2d/constrain_editor_view"));
@@ -4066,7 +4059,13 @@ void CanvasItemEditor::_update_scrollbars() {
h_scroll->set_page(screen_rect.x);
}
- // Calculate scrollable area
+ // Move and resize the scrollbars, avoiding overlap.
+ v_scroll->set_begin(Point2(size.width - vmin.width, (show_rulers) ? RULER_WIDTH : 0));
+ v_scroll->set_end(Point2(size.width, size.height - (h_scroll->is_visible() ? hmin.height : 0)));
+ h_scroll->set_begin(Point2((show_rulers) ? RULER_WIDTH : 0, size.height - hmin.height));
+ h_scroll->set_end(Point2(size.width - (v_scroll->is_visible() ? vmin.width : 0), size.height));
+
+ // Calculate scrollable area.
v_scroll->set_value(view_offset.y);
h_scroll->set_value(view_offset.x);
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index de23193df0..04d595461d 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -1196,7 +1196,9 @@ void Polygon2DEditor::_uv_draw() {
rect.position -= uv_edit_draw->get_size();
rect.size += uv_edit_draw->get_size() * 2.0;
+
updating_uv_scroll = true;
+
uv_hscroll->set_min(rect.position.x);
uv_hscroll->set_max(rect.position.x + rect.size.x);
if (ABS(rect.position.x - (rect.position.x + rect.size.x)) <= uv_edit_draw->get_size().x) {
@@ -1216,6 +1218,14 @@ void Polygon2DEditor::_uv_draw() {
uv_vscroll->set_page(uv_edit_draw->get_size().y);
uv_vscroll->set_value(uv_draw_ofs.y);
}
+
+ Size2 hmin = uv_hscroll->get_combined_minimum_size();
+ Size2 vmin = uv_vscroll->get_combined_minimum_size();
+
+ // Avoid scrollbar overlapping.
+ uv_hscroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, uv_vscroll->is_visible() ? -vmin.width : 0);
+ uv_vscroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, uv_hscroll->is_visible() ? -hmin.height : 0);
+
updating_uv_scroll = false;
}
@@ -1467,7 +1477,6 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
uv_hscroll->set_step(0.001);
uv_edit_draw->add_child(uv_hscroll);
uv_hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
- uv_hscroll->set_margin(MARGIN_RIGHT, -uv_vscroll->get_size().x * EDSCALE);
uv_hscroll->connect("value_changed", this, "_uv_scroll_changed");
bone_scroll_main_vb = memnew(VBoxContainer);
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 252f067eb1..31dce720db 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -2135,6 +2135,13 @@ void SpatialEditorViewport::_notification(int p_what) {
call_deferred("update_transform_gizmo_view");
}
+ if (p_what == NOTIFICATION_READY) {
+ // The crosshair icon doesn't depend on the editor theme.
+ crosshair->set_texture(get_icon("Crosshair", "EditorIcons"));
+ // Set the anchors and margins after changing the icon to ensure it's centered correctly.
+ crosshair->set_anchors_and_margins_preset(PRESET_CENTER);
+ }
+
if (p_what == NOTIFICATION_PROCESS) {
real_t delta = get_process_delta_time();
@@ -2255,6 +2262,10 @@ void SpatialEditorViewport::_notification(int p_what) {
current_camera = camera;
}
+ // Display the crosshair only while freelooking. Hide it otherwise,
+ // as the crosshair can be distracting.
+ crosshair->set_visible(freelook_active);
+
if (show_info) {
String text;
text += "X: " + rtos(current_camera->get_translation().x).pad_decimals(1) + "\n";
@@ -3546,6 +3557,10 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
camera->make_current();
surface->set_focus_mode(FOCUS_ALL);
+ crosshair = memnew(TextureRect);
+ crosshair->set_mouse_filter(MOUSE_FILTER_IGNORE);
+ surface->add_child(crosshair);
+
VBoxContainer *vbox = memnew(VBoxContainer);
surface->add_child(vbox);
vbox->set_position(Point2(10, 10) * EDSCALE);
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 356646221e..5cc2b24cbb 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -217,6 +217,7 @@ private:
bool freelook_active;
real_t freelook_speed;
+ TextureRect *crosshair;
Label *info_label;
Label *fps_label;
Label *cinema_label;
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 13faeb0edb..f9b1e3b43a 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -178,6 +178,7 @@ void TextureRegionEditor::_region_draw() {
scroll_rect.size += scroll_margin * 2;
updating_scroll = true;
+
hscroll->set_min(scroll_rect.position.x);
hscroll->set_max(scroll_rect.position.x + scroll_rect.size.x);
if (ABS(scroll_rect.position.x - (scroll_rect.position.x + scroll_rect.size.x)) <= scroll_margin.x) {
@@ -198,6 +199,14 @@ void TextureRegionEditor::_region_draw() {
vscroll->set_page(scroll_margin.y);
vscroll->set_value(draw_ofs.y);
}
+
+ Size2 hmin = hscroll->get_combined_minimum_size();
+ Size2 vmin = vscroll->get_combined_minimum_size();
+
+ // Avoid scrollbar overlapping.
+ hscroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, vscroll->is_visible() ? -vmin.width : 0);
+ vscroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, hscroll->is_visible() ? -hmin.height : 0);
+
updating_scroll = false;
if (node_ninepatch || obj_styleBox.is_valid()) {
@@ -1019,7 +1028,6 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
hscroll->set_step(0.001);
edit_draw->add_child(hscroll);
hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
- hscroll->set_margin(MARGIN_RIGHT, -vscroll->get_size().x * EDSCALE);
hscroll->connect("value_changed", this, "_scroll_changed");
updating_scroll = false;
diff --git a/main/main.cpp b/main/main.cpp
index 7015902e19..0ff392978a 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -292,7 +292,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --export-pack <preset> <path> Same as --export, but only export the game pack for the given preset. The <path> extension determines whether it will be in PCK or ZIP format.\n");
OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n");
OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n");
- OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects).\n");
+ OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects). Implies --editor and requires a valid project to edit.\n");
#ifdef DEBUG_METHODS_ENABLED
OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
#endif
@@ -2112,8 +2112,12 @@ bool Main::iteration() {
#ifdef TOOLS_ENABLED
if (auto_build_solutions) {
auto_build_solutions = false;
+ // Only relevant when running the editor.
+ if (!editor) {
+ ERR_FAIL_V_MSG(true, "Command line option --build-solutions was passed, but no project is being edited. Aborting.");
+ }
if (!EditorNode::get_singleton()->call_build()) {
- ERR_FAIL_V(true);
+ ERR_FAIL_V_MSG(true, "Command line option --build-solutions was passed, but the build callback failed. Aborting.");
}
}
#endif
@@ -2165,6 +2169,9 @@ void Main::cleanup() {
ScriptServer::finish_languages();
+ // Sync pending commands that may have been queued from a different thread during ScriptServer finalization
+ VisualServer::get_singleton()->sync();
+
#ifdef TOOLS_ENABLED
EditorNode::unregister_editor_types();
#endif
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 72389cdddc..0e2b812a22 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -111,6 +111,7 @@ class GDScript : public Script {
String source;
String path;
String name;
+ String fully_qualified_name;
SelfList<GDScript> script_list;
GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error);
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 7b3175d9cd..711fa54d0b 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -2131,6 +2131,7 @@ void GDScriptCompiler::_make_scripts(GDScript *p_script, const GDScriptParser::C
}
subclass->_owner = p_script;
+ subclass->fully_qualified_name = p_script->fully_qualified_name + "::" + name;
p_script->subclasses.insert(name, subclass);
_make_scripts(subclass.ptr(), p_class->subclasses[i], false);
@@ -2149,6 +2150,9 @@ Error GDScriptCompiler::compile(const GDScriptParser *p_parser, GDScript *p_scri
source = p_script->get_path();
+ // The best fully qualified name for a base level script is its file path
+ p_script->fully_qualified_name = p_script->path;
+
// Create scripts for subclasses beforehand so they can be referenced
_make_scripts(p_script, static_cast<const GDScriptParser::ClassNode *>(root), p_keep_state);
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index dcf5d35e36..fc2e626795 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -7046,12 +7046,10 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
return_type = _type_from_property(mi.return_val, false);
-#ifdef DEBUG_ENABLED
// Check all arguments beforehand to solve warnings
for (int i = 1; i < p_call->arguments.size(); i++) {
_reduce_node_type(p_call->arguments[i]);
}
-#endif // DEBUG_ENABLED
// Check arguments
@@ -7079,12 +7077,10 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
ERR_FAIL_V(DataType());
}
-#ifdef DEBUG_ENABLED
// Check all arguments beforehand to solve warnings
for (int i = arg_id + 1; i < p_call->arguments.size(); i++) {
_reduce_node_type(p_call->arguments[i]);
}
-#endif // DEBUG_ENABLED
IdentifierNode *func_id = static_cast<IdentifierNode *>(p_call->arguments[arg_id]);
callee_name = func_id->name;
@@ -8210,12 +8206,10 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
_add_warning(GDScriptWarning::FUNCTION_MAY_YIELD, op->line, _find_function_name(static_cast<OperatorNode *>(op->arguments[1])));
}
- bool type_match = check_types;
#endif // DEBUG_ENABLED
+ bool type_match = lh_type.has_type && rh_type.has_type;
if (check_types && !_is_type_compatible(lh_type, rh_type)) {
-#ifdef DEBUG_ENABLED
type_match = false;
-#endif // DEBUG_ENABLED
// Try supertype test
if (_is_type_compatible(rh_type, lh_type)) {
@@ -8247,9 +8241,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
op->arguments.write[1] = convert_call;
-#ifdef DEBUG_ENABLED
type_match = true; // Since we are converting, the type is matching
-#endif // DEBUG_ENABLED
}
#ifdef DEBUG_ENABLED
if (lh_type.builtin_type == Variant::INT && rh_type.builtin_type == Variant::REAL) {
@@ -8262,10 +8254,8 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
if (!rh_type.has_type && (op->op != OperatorNode::OP_ASSIGN || lh_type.has_type || op->arguments[0]->type == Node::TYPE_OPERATOR)) {
_mark_line_as_unsafe(op->line);
}
- op->datatype.has_type = type_match;
-#else
- op->datatype.has_type = false;
#endif // DEBUG_ENABLED
+ op->datatype.has_type = type_match;
} break;
case OperatorNode::OP_CALL:
case OperatorNode::OP_PARENT_CALL: {
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp
index c8ff471401..2d4344e6f3 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.cpp
+++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp
@@ -112,9 +112,10 @@ void ExtendGDScriptParser::update_document_links(const String &p_code) {
FileAccessRef fs = FileAccess::create(FileAccess::ACCESS_RESOURCES);
tokenizer.set_code(p_code);
while (true) {
- if (tokenizer.get_token() == GDScriptTokenizer::TK_EOF) {
+ GDScriptTokenizerText::Token token = tokenizer.get_token();
+ if (token == GDScriptTokenizer::TK_EOF || token == GDScriptTokenizer::TK_ERROR) {
break;
- } else if (tokenizer.get_token() == GDScriptTokenizer::TK_CONSTANT) {
+ } else if (token == GDScriptTokenizer::TK_CONSTANT) {
const Variant &const_val = tokenizer.get_token_constant();
if (const_val.get_type() == Variant::STRING) {
String path = const_val;
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index d82e78d080..8a024eef13 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -159,6 +159,19 @@ void CSharpLanguage::finish() {
// Clear here, after finalizing all domains to make sure there is nothing else referencing the elements.
script_bindings.clear();
+#ifdef DEBUG_ENABLED
+ for (List<ObjectID>::Element *E = unsafely_referenced_objects.front(); E; E = E->next()) {
+ const ObjectID &id = E->get();
+ Object *obj = ObjectDB::get_instance(id);
+
+ if (obj) {
+ ERR_PRINTS("Leaked unsafe reference to object: " + obj->get_class() + ":" + itos(id));
+ } else {
+ ERR_PRINTS("Leaked unsafe reference to deleted object: " + itos(id));
+ }
+ }
+#endif
+
finalizing = false;
}
@@ -615,6 +628,23 @@ Vector<ScriptLanguage::StackInfo> CSharpLanguage::stack_trace_get_info(MonoObjec
}
#endif
+void CSharpLanguage::post_unsafe_reference(Object *p_obj) {
+#ifdef DEBUG_ENABLED
+ ObjectID id = p_obj->get_instance_id();
+ ERR_FAIL_COND_MSG(unsafely_referenced_objects.find(id), "Multiple unsafe references for object: " + p_obj->get_class() + ":" + itos(id));
+ unsafely_referenced_objects.push_back(id);
+#endif
+}
+
+void CSharpLanguage::pre_unsafe_unreference(Object *p_obj) {
+#ifdef DEBUG_ENABLED
+ ObjectID id = p_obj->get_instance_id();
+ List<ObjectID>::Element *elem = unsafely_referenced_objects.find(id);
+ ERR_FAIL_NULL(elem);
+ unsafely_referenced_objects.erase(elem);
+#endif
+}
+
void CSharpLanguage::frame() {
if (gdmono && gdmono->is_runtime_initialized() && gdmono->get_core_api_assembly() != NULL) {
@@ -1286,6 +1316,7 @@ bool CSharpLanguage::setup_csharp_script_binding(CSharpScriptBinding &r_script_b
// See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr)
ref->reference();
+ CSharpLanguage::get_singleton()->post_unsafe_reference(ref);
}
return true;
@@ -1736,9 +1767,12 @@ bool CSharpInstance::_reference_owner_unsafe() {
// See: _unreference_owner_unsafe()
// May not me referenced yet, so we must use init_ref() instead of reference()
- bool success = Object::cast_to<Reference>(owner)->init_ref();
- unsafe_referenced = success;
- return success;
+ if (static_cast<Reference *>(owner)->init_ref()) {
+ CSharpLanguage::get_singleton()->post_unsafe_reference(owner);
+ unsafe_referenced = true;
+ }
+
+ return unsafe_referenced;
}
bool CSharpInstance::_unreference_owner_unsafe() {
@@ -1759,6 +1793,7 @@ bool CSharpInstance::_unreference_owner_unsafe() {
// See: _reference_owner_unsafe()
// Destroying the owner here means self destructing, so we defer the owner destruction to the caller.
+ CSharpLanguage::get_singleton()->pre_unsafe_unreference(owner);
return static_cast<Reference *>(owner)->unreference();
}
@@ -2243,7 +2278,11 @@ bool CSharpScript::_update_exports() {
MonoException *ctor_exc = NULL;
ctor->invoke(tmp_object, NULL, &ctor_exc);
+ Object *tmp_native = GDMonoMarshal::unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(tmp_object));
+
if (ctor_exc) {
+ // TODO: Should we free 'tmp_native' if the exception was thrown after its creation?
+
MonoGCHandle::free_handle(tmp_pinned_gchandle);
tmp_object = NULL;
@@ -2322,6 +2361,15 @@ bool CSharpScript::_update_exports() {
MonoGCHandle::free_handle(tmp_pinned_gchandle);
tmp_object = NULL;
+
+ if (tmp_native && !Object::cast_to<Reference>(tmp_native)) {
+ Node *node = Object::cast_to<Node>(tmp_native);
+ if (node && node->is_inside_tree()) {
+ ERR_PRINTS("Temporary instance was added to the scene tree.");
+ } else {
+ memdelete(tmp_native);
+ }
+ }
}
placeholder_fallback_enabled = false;
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 027f429125..30f56e00bd 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -307,6 +307,11 @@ class CSharpLanguage : public ScriptLanguage {
Map<Object *, CSharpScriptBinding> script_bindings;
+#ifdef DEBUG_ENABLED
+ // List of unsafely referenced objects
+ List<ObjectID> unsafely_referenced_objects;
+#endif
+
struct StringNameCache {
StringName _signal_callback;
@@ -458,6 +463,9 @@ public:
Vector<StackInfo> stack_trace_get_info(MonoObject *p_stack_trace);
#endif
+ void post_unsafe_reference(Object *p_obj);
+ void pre_unsafe_unreference(Object *p_obj);
+
CSharpLanguage();
~CSharpLanguage();
};
diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp
index 04a489f1f9..02246b2f2f 100644
--- a/modules/mono/glue/base_object_glue.cpp
+++ b/modules/mono/glue/base_object_glue.cpp
@@ -108,6 +108,7 @@ void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolea
// Unsafe refcount decrement. The managed instance also counts as a reference.
// See: CSharpLanguage::alloc_instance_binding_data(Object *p_object)
+ CSharpLanguage::get_singleton()->pre_unsafe_unreference(ref);
if (ref->unreference()) {
memdelete(ref);
} else {
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp
index 8669182c4e..75aa77c7b0 100644
--- a/modules/mono/mono_gd/gd_mono_internals.cpp
+++ b/modules/mono/mono_gd/gd_mono_internals.cpp
@@ -83,7 +83,9 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
// See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr)
// May not me referenced yet, so we must use init_ref() instead of reference()
- ref->init_ref();
+ if (ref->init_ref()) {
+ CSharpLanguage::get_singleton()->post_unsafe_reference(ref);
+ }
}
// The object was just created, no script instance binding should have been attached
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 3c8aa0c727..6bb9f28a32 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -115,6 +115,7 @@ MonoObject *unmanaged_get_managed(Object *unmanaged) {
// but the managed instance is alive, the refcount will be 1 instead of 0.
// See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr)
ref->reference();
+ CSharpLanguage::get_singleton()->post_unsafe_reference(ref);
}
return mono_object;
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index ef4ea93e57..58b8115dfc 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -73,7 +73,6 @@ void image_decompress_squish(Image *p_image) {
p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
}
-#ifdef TOOLS_ENABLED
void image_compress_squish(Image *p_image, float p_lossy_quality, Image::CompressSource p_source) {
if (p_image->get_format() >= Image::FORMAT_DXT1)
@@ -203,4 +202,3 @@ void image_compress_squish(Image *p_image, float p_lossy_quality, Image::Compres
p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
}
}
-#endif
diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h
index 2666815e47..b5a209ceb9 100644
--- a/modules/squish/image_compress_squish.h
+++ b/modules/squish/image_compress_squish.h
@@ -33,9 +33,7 @@
#include "core/image.h"
-#ifdef TOOLS_ENABLED
void image_compress_squish(Image *p_image, float p_lossy_quality, Image::CompressSource p_source);
-#endif
void image_decompress_squish(Image *p_image);
#endif // IMAGE_COMPRESS_SQUISH_H
diff --git a/modules/squish/register_types.cpp b/modules/squish/register_types.cpp
index 1cd551defb..2a0cf82b56 100644
--- a/modules/squish/register_types.cpp
+++ b/modules/squish/register_types.cpp
@@ -33,9 +33,7 @@
void register_squish_types() {
-#ifdef TOOLS_ENABLED
Image::set_compress_bc_func(image_compress_squish);
-#endif
Image::_image_decompress_bc = image_decompress_squish;
}
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 4bfd4f48ce..ec20698ae8 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -575,7 +575,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
Button *btn = memnew(Button);
btn->set_text(TTR("Add Input Port"));
hbnc->add_child(btn);
- btn->connect("pressed", this, "_add_input_port", varray(E->get()));
+ btn->connect("pressed", this, "_add_input_port", varray(E->get()), CONNECT_DEFERRED);
}
if (nd_list->is_output_port_editable()) {
if (nd_list->is_input_port_editable())
@@ -584,7 +584,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
Button *btn = memnew(Button);
btn->set_text(TTR("Add Output Port"));
hbnc->add_child(btn);
- btn->connect("pressed", this, "_add_output_port", varray(E->get()));
+ btn->connect("pressed", this, "_add_output_port", varray(E->get()), CONNECT_DEFERRED);
}
gnode->add_child(hbnc);
} else if (Object::cast_to<VisualScriptExpression>(node.ptr())) {
diff --git a/modules/websocket/doc_classes/WebSocketClient.xml b/modules/websocket/doc_classes/WebSocketClient.xml
index 705e3485f5..52a98d8c32 100644
--- a/modules/websocket/doc_classes/WebSocketClient.xml
+++ b/modules/websocket/doc_classes/WebSocketClient.xml
@@ -27,7 +27,8 @@
Connects to the given URL requesting one of the given [code]protocols[/code] as sub-protocol. If the list empty (default), no sub-protocol will be requested.
If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI], connections to non-Godot servers will not work, and [signal data_received] will not be emitted.
If [code]false[/code] is passed instead (default), you must call [PacketPeer] functions ([code]put_packet[/code], [code]get_packet[/code], etc.) on the [WebSocketPeer] returned via [code]get_peer(1)[/code] and not on this object directly (e.g. [code]get_peer(1).put_packet(data)[/code]).
- You can optionally pass a list of [code]custom_headers[/code] to be added to the handshake HTTP request (not supported in HTML5 platform).
+ You can optionally pass a list of [code]custom_headers[/code] to be added to the handshake HTTP request.
+ [b]Note:[/b] Specifying [code]custom_headers[/code] is not supported in HTML5 exports due to browsers restrictions.
</description>
</method>
<method name="disconnect_from_host">
@@ -59,6 +60,7 @@
<members>
<member name="trusted_ssl_certificate" type="X509Certificate" setter="set_trusted_ssl_certificate" getter="get_trusted_ssl_certificate">
If specified, this [X509Certificate] will be the only one accepted when connecting to an SSL host. Any other certificate provided by the server will be regarded as invalid.
+ [b]Note:[/b] Specifying a custom [code]trusted_ssl_certificate[/code] is not supported in HTML5 exports due to browsers restrictions.
</member>
<member name="verify_ssl" type="bool" setter="set_verify_ssl_enabled" getter="is_verify_ssl_enabled">
If [code]true[/code], SSL certificate verification is enabled.
diff --git a/modules/websocket/doc_classes/WebSocketServer.xml b/modules/websocket/doc_classes/WebSocketServer.xml
index 86f2dae64f..f5fb77f3a1 100644
--- a/modules/websocket/doc_classes/WebSocketServer.xml
+++ b/modules/websocket/doc_classes/WebSocketServer.xml
@@ -6,7 +6,7 @@
<description>
This class implements a WebSocket server that can also support the high-level multiplayer API.
After starting the server ([method listen]), you will need to [method NetworkedMultiplayerPeer.poll] it at regular intervals (e.g. inside [method Node._process]). When clients connect, disconnect, or send data, you will receive the appropriate signal.
- [b]Note:[/b] This class will not work in HTML5 exports due to browser restrictions.
+ [b]Note:[/b] Not available in HTML5 exports.
</description>
<tutorials>
</tutorials>
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 8f784dd943..eb461860ed 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -30,6 +30,7 @@
#include "export.h"
+#include "core/io/image_loader.h"
#include "core/io/marshalls.h"
#include "core/io/zip_io.h"
#include "core/os/dir_access.h"
@@ -37,6 +38,7 @@
#include "core/os/os.h"
#include "core/project_settings.h"
#include "core/version.h"
+#include "drivers/png/png_driver_common.h"
#include "editor/editor_export.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
@@ -196,16 +198,40 @@ static const char *android_perms[] = {
};
struct LauncherIcon {
- const char *option_id;
const char *export_path;
+ int dimensions;
};
-static const LauncherIcon launcher_icons[] = {
- { "launcher_icons/xxxhdpi_192x192", "res/drawable-xxxhdpi-v4/icon.png" },
- { "launcher_icons/xxhdpi_144x144", "res/drawable-xxhdpi-v4/icon.png" },
- { "launcher_icons/xhdpi_96x96", "res/drawable-xhdpi-v4/icon.png" },
- { "launcher_icons/hdpi_72x72", "res/drawable-hdpi-v4/icon.png" },
- { "launcher_icons/mdpi_48x48", "res/drawable-mdpi-v4/icon.png" }
+static const int icon_densities_count = 6;
+static const char *launcher_icon_option = "launcher_icon/xxxhdpi_192x192";
+static const char *launcher_adaptive_icon_foreground_option = "launcher_adaptive_icon_foreground/xxxhdpi_432x432";
+static const char *launcher_adaptive_icon_background_option = "launcher_adaptive_icon_background/xxxhdpi_432x432";
+
+static const LauncherIcon launcher_icons[icon_densities_count] = {
+ { "res/mipmap-xxxhdpi-v4/icon.png", 192 },
+ { "res/mipmap-xxhdpi-v4/icon.png", 144 },
+ { "res/mipmap-xhdpi-v4/icon.png", 96 },
+ { "res/mipmap-hdpi-v4/icon.png", 72 },
+ { "res/mipmap-mdpi-v4/icon.png", 48 },
+ { "res/mipmap/icon.png", 192 }
+};
+
+static const LauncherIcon launcher_adaptive_icon_foregrounds[icon_densities_count] = {
+ { "res/mipmap-xxxhdpi-v4/icon_foreground.png", 432 },
+ { "res/mipmap-xxhdpi-v4/icon_foreground.png", 324 },
+ { "res/mipmap-xhdpi-v4/icon_foreground.png", 216 },
+ { "res/mipmap-hdpi-v4/icon_foreground.png", 162 },
+ { "res/mipmap-mdpi-v4/icon_foreground.png", 108 },
+ { "res/mipmap/icon_foreground.png", 432 }
+};
+
+static const LauncherIcon launcher_adaptive_icon_backgrounds[icon_densities_count] = {
+ { "res/mipmap-xxxhdpi-v4/icon_background.png", 432 },
+ { "res/mipmap-xxhdpi-v4/icon_background.png", 324 },
+ { "res/mipmap-xhdpi-v4/icon_background.png", 216 },
+ { "res/mipmap-hdpi-v4/icon_background.png", 162 },
+ { "res/mipmap-mdpi-v4/icon_background.png", 108 },
+ { "res/mipmap/icon_background.png", 432 }
};
class EditorExportPlatformAndroid : public EditorExportPlatform {
@@ -1298,6 +1324,27 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
//printf("end\n");
}
+ void _process_launcher_icons(const String &p_processing_file_name, const Ref<Image> &p_source_image, const LauncherIcon p_icon, Vector<uint8_t> &p_data) {
+ if (p_processing_file_name == p_icon.export_path) {
+ Ref<Image> working_image = p_source_image;
+
+ if (p_source_image->get_width() != p_icon.dimensions || p_source_image->get_height() != p_icon.dimensions) {
+ working_image = p_source_image->duplicate();
+ working_image->resize(p_icon.dimensions, p_icon.dimensions, Image::Interpolation::INTERPOLATE_LANCZOS);
+ }
+
+ PoolVector<uint8_t> png_buffer;
+ Error err = PNGDriverCommon::image_to_png(working_image, png_buffer);
+ if (err == OK) {
+ p_data.resize(png_buffer.size());
+ memcpy(p_data.ptrw(), png_buffer.read().ptr(), p_data.size());
+ } else {
+ String err_str = String("Failed to convert resized icon (") + p_processing_file_name + ") to png.";
+ WARN_PRINT(err_str.utf8().get_data());
+ }
+ }
+ }
+
static Vector<String> get_enabled_abis(const Ref<EditorExportPreset> &p_preset) {
Vector<String> abis = get_abis();
Vector<String> enabled_abis;
@@ -1355,11 +1402,9 @@ public:
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_large"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_xlarge"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/opengl_debug"), false));
-
- for (uint64_t i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_icons[i].option_id, PROPERTY_HINT_FILE, "*.png"), ""));
- }
-
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_icon_option, PROPERTY_HINT_FILE, "*.png"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_adaptive_icon_foreground_option, PROPERTY_HINT_FILE, "*.png"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_adaptive_icon_background_option, PROPERTY_HINT_FILE, "*.png"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "keystore/debug", PROPERTY_HINT_GLOBAL_FILE, "*.keystore"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "keystore/debug_user"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "keystore/debug_password"), ""));
@@ -1957,7 +2002,7 @@ public:
}
} else if (l.strip_edges().begins_with("<application")) {
- String last_tag = "android:icon=\"@drawable/icon\"";
+ String last_tag = "android:icon=\"@mipmap/icon\"";
int last_tag_pos = l.find(last_tag);
if (last_tag_pos == -1) {
ERR_PRINTS("Not adding application attributes as the expected tag was not found in '<application': " + last_tag);
@@ -2136,6 +2181,35 @@ public:
Vector<String> enabled_abis = get_enabled_abis(p_preset);
+ String project_icon_path = ProjectSettings::get_singleton()->get("application/config/icon");
+
+ // Prepare images to be resized for the icons. If some image ends up being uninitialized, the default image from the export template will be used.
+ Ref<Image> launcher_icon_image;
+ Ref<Image> launcher_adaptive_icon_foreground_image;
+ Ref<Image> launcher_adaptive_icon_background_image;
+
+ launcher_icon_image.instance();
+ launcher_adaptive_icon_foreground_image.instance();
+ launcher_adaptive_icon_background_image.instance();
+
+ // Regular icon: user selection -> project icon -> default.
+ String path = static_cast<String>(p_preset->get(launcher_icon_option)).strip_edges();
+ if (path.empty() || ImageLoader::load_image(path, launcher_icon_image) != OK) {
+ ImageLoader::load_image(project_icon_path, launcher_icon_image);
+ }
+
+ // Adaptive foreground: user selection -> regular icon (user selection -> project icon -> default).
+ path = static_cast<String>(p_preset->get(launcher_adaptive_icon_foreground_option)).strip_edges();
+ if (path.empty() || ImageLoader::load_image(path, launcher_adaptive_icon_foreground_image) != OK) {
+ launcher_adaptive_icon_foreground_image = launcher_icon_image;
+ }
+
+ // Adaptive background: user selection -> default.
+ path = static_cast<String>(p_preset->get(launcher_adaptive_icon_background_option)).strip_edges();
+ if (!path.empty()) {
+ ImageLoader::load_image(path, launcher_adaptive_icon_background_image);
+ }
+
while (ret == UNZ_OK) {
//get filename
@@ -2158,41 +2232,22 @@ public:
//write
if (file == "AndroidManifest.xml") {
-
_fix_manifest(p_preset, data, p_flags & (DEBUG_FLAG_DUMB_CLIENT | DEBUG_FLAG_REMOTE_DEBUG));
}
if (file == "resources.arsc") {
-
_fix_resources(p_preset, data);
}
- if (file == "res/drawable-nodpi-v4/icon.png") {
- bool found = false;
- for (uint64_t i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
- String icon_path = String(p_preset->get(launcher_icons[i].option_id)).strip_edges();
- if (icon_path != "" && icon_path.ends_with(".png")) {
- FileAccess *f = FileAccess::open(icon_path, FileAccess::READ);
- if (f) {
- data.resize(f->get_len());
- f->get_buffer(data.ptrw(), data.size());
- memdelete(f);
- found = true;
- break;
- }
- }
+ for (int i = 0; i < icon_densities_count; ++i) {
+ if (launcher_icon_image.is_valid() && !launcher_icon_image->empty()) {
+ _process_launcher_icons(file, launcher_icon_image, launcher_icons[i], data);
}
- if (!found) {
-
- String appicon = ProjectSettings::get_singleton()->get("application/config/icon");
- if (appicon != "" && appicon.ends_with(".png")) {
- FileAccess *f = FileAccess::open(appicon, FileAccess::READ);
- if (f) {
- data.resize(f->get_len());
- f->get_buffer(data.ptrw(), data.size());
- memdelete(f);
- }
- }
+ if (launcher_adaptive_icon_foreground_image.is_valid() && !launcher_adaptive_icon_foreground_image->empty()) {
+ _process_launcher_icons(file, launcher_adaptive_icon_foreground_image, launcher_adaptive_icon_foregrounds[i], data);
+ }
+ if (launcher_adaptive_icon_background_image.is_valid() && !launcher_adaptive_icon_background_image->empty()) {
+ _process_launcher_icons(file, launcher_adaptive_icon_background_image, launcher_adaptive_icon_backgrounds[i], data);
}
}
@@ -2291,19 +2346,6 @@ public:
}
}
- if (!err) {
- APKExportData ed;
- ed.ep = &ep;
- ed.apk = unaligned_apk;
- for (uint64_t i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
- String icon_path = String(p_preset->get(launcher_icons[i].option_id)).strip_edges();
- if (icon_path != "" && icon_path.ends_with(".png") && FileAccess::exists(icon_path)) {
- Vector<uint8_t> data = FileAccess::get_file_as_array(icon_path);
- store_in_apk(&ed, launcher_icons[i].export_path, data);
- }
- }
- }
-
int xr_mode_index = p_preset->get("xr_features/xr_mode");
if (xr_mode_index == 1 /* XRMode.OVR */) {
cl.push_back("--xr_mode_ovr");
diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml
index ba01ec313b..7e9ce70d80 100644
--- a/platform/android/java/app/AndroidManifest.xml
+++ b/platform/android/java/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- Any tag in this line after android:icon will be erased when doing custom builds. -->
<!-- If you want to add tags manually, do before it. -->
<!-- WARNING: This should stay on a single line until the parsing code is improved. See GH-32414. -->
- <application android:label="@string/godot_project_name_string" android:allowBackup="false" tools:ignore="GoogleAppIndexingWarning" android:icon="@drawable/icon" >
+ <application android:label="@string/godot_project_name_string" android:allowBackup="false" tools:ignore="GoogleAppIndexingWarning" android:icon="@mipmap/icon" >
<!-- The following metadata values are replaced when Godot exports, modifying them here has no effect. -->
<!-- Do these changes in the export preset. Adding new ones is fine. -->
diff --git a/platform/android/java/lib/AndroidManifest.xml b/platform/android/java/lib/AndroidManifest.xml
index 517fc403b2..b133585f99 100644
--- a/platform/android/java/lib/AndroidManifest.xml
+++ b/platform/android/java/lib/AndroidManifest.xml
@@ -11,7 +11,7 @@
</application>
<instrumentation
- android:icon="@drawable/icon"
+ android:icon="@mipmap/icon"
android:label="@string/godot_project_name_string"
android:name=".GodotInstrumentation"
android:targetPackage="org.godotengine.godot" />
diff --git a/platform/android/java/lib/res/drawable-nodpi/icon.png b/platform/android/java/lib/res/drawable-nodpi/icon.png
deleted file mode 100644
index 6ad9b43117..0000000000
--- a/platform/android/java/lib/res/drawable-nodpi/icon.png
+++ /dev/null
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-anydpi-v26/icon.xml b/platform/android/java/lib/res/mipmap-anydpi-v26/icon.xml
new file mode 100644
index 0000000000..1ed4037035
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-anydpi-v26/icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@mipmap/icon_background"/>
+ <foreground android:drawable="@mipmap/icon_foreground"/>
+</adaptive-icon> \ No newline at end of file
diff --git a/platform/android/java/lib/res/mipmap-hdpi/icon.png b/platform/android/java/lib/res/mipmap-hdpi/icon.png
new file mode 100644
index 0000000000..cc6e113e89
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-hdpi/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-hdpi/icon_background.png b/platform/android/java/lib/res/mipmap-hdpi/icon_background.png
new file mode 100644
index 0000000000..78445c0181
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-hdpi/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-hdpi/icon_foreground.png b/platform/android/java/lib/res/mipmap-hdpi/icon_foreground.png
new file mode 100644
index 0000000000..75e409ff74
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-hdpi/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-mdpi/icon.png b/platform/android/java/lib/res/mipmap-mdpi/icon.png
new file mode 100644
index 0000000000..e1968fe142
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-mdpi/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-mdpi/icon_background.png b/platform/android/java/lib/res/mipmap-mdpi/icon_background.png
new file mode 100644
index 0000000000..5813f751ed
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-mdpi/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-mdpi/icon_foreground.png b/platform/android/java/lib/res/mipmap-mdpi/icon_foreground.png
new file mode 100644
index 0000000000..982b69be1e
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-mdpi/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xhdpi/icon.png b/platform/android/java/lib/res/mipmap-xhdpi/icon.png
new file mode 100644
index 0000000000..9281d8da48
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xhdpi/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xhdpi/icon_background.png b/platform/android/java/lib/res/mipmap-xhdpi/icon_background.png
new file mode 100644
index 0000000000..4269c822a7
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xhdpi/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xhdpi/icon_foreground.png b/platform/android/java/lib/res/mipmap-xhdpi/icon_foreground.png
new file mode 100644
index 0000000000..726b267ad6
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xhdpi/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxhdpi/icon.png b/platform/android/java/lib/res/mipmap-xxhdpi/icon.png
new file mode 100644
index 0000000000..7a6b67d273
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxhdpi/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxhdpi/icon_background.png b/platform/android/java/lib/res/mipmap-xxhdpi/icon_background.png
new file mode 100644
index 0000000000..5e8b518d17
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxhdpi/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxhdpi/icon_foreground.png b/platform/android/java/lib/res/mipmap-xxhdpi/icon_foreground.png
new file mode 100644
index 0000000000..b0c727f74c
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxhdpi/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxxhdpi/icon.png b/platform/android/java/lib/res/mipmap-xxxhdpi/icon.png
new file mode 100644
index 0000000000..0881245802
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxxhdpi/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxxhdpi/icon_background.png b/platform/android/java/lib/res/mipmap-xxxhdpi/icon_background.png
new file mode 100644
index 0000000000..004b6fd508
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxxhdpi/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxxhdpi/icon_foreground.png b/platform/android/java/lib/res/mipmap-xxxhdpi/icon_foreground.png
new file mode 100644
index 0000000000..72e6f92b6e
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxxhdpi/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap/icon.png b/platform/android/java/lib/res/mipmap/icon.png
new file mode 100644
index 0000000000..0881245802
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap/icon_background.png b/platform/android/java/lib/res/mipmap/icon_background.png
new file mode 100644
index 0000000000..5813f751ed
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap/icon_foreground.png b/platform/android/java/lib/res/mipmap/icon_foreground.png
new file mode 100644
index 0000000000..982b69be1e
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
index 0ff37e3c37..e0b46673ba 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
@@ -102,7 +102,7 @@ public class GodotLib {
/**
* Forward double_tap events from the main thread to the GL thread.
*/
- public static native void double_tap(int x, int y);
+ public static native void doubletap(int x, int y);
/**
* Forward scroll events from the main thread to the GL thread.
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java
index b42b13894c..1a38a9c3d2 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java
@@ -78,7 +78,7 @@ public class GodotGestureHandler extends GestureDetector.SimpleOnGestureListener
queueEvent(new Runnable() {
@Override
public void run() {
- GodotLib.double_tap(x, y);
+ GodotLib.doubletap(x, y);
}
});
return true;
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index d3bc216608..858ff89cbc 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -835,7 +835,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_hover(JNIEnv *env, jo
os_android->process_hover(p_type, Point2(p_x, p_y));
}
-JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_double_tap(JNIEnv *env, jobject obj, jint p_x, jint p_y) {
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_doubletap(JNIEnv *env, jobject obj, jint p_x, jint p_y) {
if (step == 0)
return;
diff --git a/platform/android/java_godot_lib_jni.h b/platform/android/java_godot_lib_jni.h
index 08029c3c30..71d4547f65 100644
--- a/platform/android/java_godot_lib_jni.h
+++ b/platform/android/java_godot_lib_jni.h
@@ -46,7 +46,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, jobject obj);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv *env, jobject obj, jint ev, jint pointer, jint count, jintArray positions);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_hover(JNIEnv *env, jobject obj, jint p_type, jint p_x, jint p_y);
-JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_double_tap(JNIEnv *env, jobject obj, jint p_x, jint p_y);
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_doubletap(JNIEnv *env, jobject obj, jint p_x, jint p_y);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_scroll(JNIEnv *env, jobject obj, jint p_x, jint p_y);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jobject obj, jint p_scancode, jint p_unicode_char, jboolean p_pressed);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env, jobject obj, jint p_device, jint p_button, jboolean p_pressed);
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index 2a3e165069..dd72294816 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -95,7 +95,7 @@ def configure(env):
if not env['builtin_enet']:
env.ParseConfig('pkg-config libenet --cflags --libs')
- if not env['builtin_squish'] and env['tools']:
+ if not env['builtin_squish']:
env.ParseConfig('pkg-config libsquish --cflags --libs')
if not env['builtin_zstd']:
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 93c83f4ff4..9b93d4f140 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -87,16 +87,22 @@ public:
String filepath = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_js_export");
String basereq = "/tmp_js_export";
+ String ctype = "";
if (req[1] == basereq + ".html") {
filepath += ".html";
+ ctype = "text/html";
} else if (req[1] == basereq + ".js") {
filepath += ".js";
+ ctype = "application/javascript";
} else if (req[1] == basereq + ".pck") {
filepath += ".pck";
+ ctype = "application/octet-stream";
} else if (req[1] == basereq + ".png") {
filepath += ".png";
+ ctype = "image/png";
} else if (req[1] == basereq + ".wasm") {
filepath += ".wasm";
+ ctype = "application/wasm";
} else {
String s = "HTTP/1.1 404 Not Found\r\n";
s += "Connection: Close\r\n";
@@ -109,10 +115,14 @@ public:
ERR_FAIL_COND(!f);
String s = "HTTP/1.1 200 OK\r\n";
s += "Connection: Close\r\n";
+ s += "Content-Type: " + ctype + "\r\n";
s += "\r\n";
CharString cs = s.utf8();
Error err = connection->put_data((const uint8_t *)cs.get_data(), cs.size() - 1);
- ERR_FAIL_COND(err != OK);
+ if (err != OK) {
+ memdelete(f);
+ ERR_FAIL();
+ }
while (true) {
uint8_t bytes[4096];
@@ -121,8 +131,12 @@ public:
break;
}
err = connection->put_data(bytes, read);
- ERR_FAIL_COND(err != OK);
+ if (err != OK) {
+ memdelete(f);
+ ERR_FAIL();
+ }
}
+ memdelete(f);
}
void poll() {
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 58a47c102a..190dbcf662 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -76,8 +76,6 @@ public:
List<String> args;
MainLoop *main_loop;
- IP_Unix *ip_unix;
-
#ifdef COREAUDIO_ENABLED
AudioDriverCoreAudio audio_driver;
#endif
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 2b002d3b5d..6a214b8669 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -479,7 +479,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
}
- (NSRange)markedRange {
- return (markedText.length > 0) ? NSMakeRange(0, markedText.length - 1) : kEmptyRange;
+ return NSMakeRange(0, markedText.length);
}
- (NSRange)selectedRange {
@@ -492,6 +492,10 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
} else {
[markedText initWithString:aString];
}
+ if (markedText.length == 0) {
+ [self unmarkText];
+ return;
+ }
if (OS_OSX::singleton->im_active) {
imeInputEventInProgress = true;
OS_OSX::singleton->im_text.parse_utf8([[markedText mutableString] UTF8String]);
diff --git a/platform/server/detect.py b/platform/server/detect.py
index b6028c20e3..d82df77957 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -162,7 +162,7 @@ def configure(env):
if not env['builtin_enet']:
env.ParseConfig('pkg-config libenet --cflags --libs')
- if not env['builtin_squish'] and env['tools']:
+ if not env['builtin_squish']:
env.ParseConfig('pkg-config libsquish --cflags --libs')
if not env['builtin_zstd']:
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index 0aca8049f2..46ca9cb6d1 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -58,7 +58,6 @@ class OS_Server : public OS_Unix {
bool grab;
virtual void delete_main_loop();
- IP_Unix *ip_unix;
bool force_quit;
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index b8ff97279d..a961072bd6 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -232,7 +232,7 @@ def configure(env):
if not env['builtin_enet']:
env.ParseConfig('pkg-config libenet --cflags --libs')
- if not env['builtin_squish'] and env['tools']:
+ if not env['builtin_squish']:
env.ParseConfig('pkg-config libsquish --cflags --libs')
if not env['builtin_zstd']:
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index eb66265010..1bffaf8084 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -189,6 +189,10 @@ float Light2D::get_energy() const {
void Light2D::set_texture_scale(float p_scale) {
_scale = p_scale;
+ // Avoid having 0 scale values, can lead to errors in physics and rendering.
+ if (_scale == 0) {
+ _scale = CMP_EPSILON;
+ }
VS::get_singleton()->canvas_light_set_scale(canvas_light, _scale);
item_rect_changed();
}
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 7bbc7577ed..7deebe9b27 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -173,6 +173,7 @@ void Node2D::set_scale(const Size2 &p_scale) {
if (_xform_dirty)
((Node2D *)this)->_update_xform_values();
_scale = p_scale;
+ // Avoid having 0 scale values, can lead to errors in physics and rendering.
if (_scale.x == 0)
_scale.x = CMP_EPSILON;
if (_scale.y == 0)
diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp
index 9f4353ceb6..64d6885bc8 100644
--- a/scene/gui/center_container.cpp
+++ b/scene/gui/center_container.cpp
@@ -54,7 +54,13 @@ Size2 CenterContainer::get_minimum_size() const {
void CenterContainer::set_use_top_left(bool p_enable) {
+ if (use_top_left == p_enable) {
+ return;
+ }
+
use_top_left = p_enable;
+
+ minimum_size_changed();
queue_sort();
}
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 9a67745e0d..4f499af186 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2682,6 +2682,11 @@ Vector2 Control::get_pivot_offset() const {
void Control::set_scale(const Vector2 &p_scale) {
data.scale = p_scale;
+ // Avoid having 0 scale values, can lead to errors in physics and rendering.
+ if (data.scale.x == 0)
+ data.scale.x = CMP_EPSILON;
+ if (data.scale.y == 0)
+ data.scale.y = CMP_EPSILON;
update();
_notify_transform();
}
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index be465751b6..399f998cb9 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -200,6 +200,13 @@ void GraphEdit::_update_scroll() {
else
v_scroll->show();
+ Size2 hmin = h_scroll->get_combined_minimum_size();
+ Size2 vmin = v_scroll->get_combined_minimum_size();
+
+ // Avoid scrollbar overlapping.
+ h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, v_scroll->is_visible() ? -vmin.width : 0);
+ v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, h_scroll->is_visible() ? -hmin.height : 0);
+
set_block_minimum_size_adjust(false);
if (!awaiting_scroll_offset_update) {
@@ -282,20 +289,6 @@ void GraphEdit::_notification(int p_what) {
zoom_plus->set_icon(get_icon("more"));
snap_button->set_icon(get_icon("snap"));
}
- if (p_what == NOTIFICATION_READY) {
- Size2 hmin = h_scroll->get_combined_minimum_size();
- Size2 vmin = v_scroll->get_combined_minimum_size();
-
- v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -vmin.width);
- v_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
- v_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
- v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
-
- h_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
- h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
- h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height);
- h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
- }
if (p_what == NOTIFICATION_DRAW) {
draw_style_box(get_stylebox("bg"), Rect2(Point2(), get_size()));
@@ -1348,10 +1341,13 @@ GraphEdit::GraphEdit() {
h_scroll = memnew(HScrollBar);
h_scroll->set_name("_h_scroll");
top_layer->add_child(h_scroll);
+ h_scroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
v_scroll = memnew(VScrollBar);
v_scroll->set_name("_v_scroll");
top_layer->add_child(v_scroll);
+ v_scroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
+
updating = false;
connecting = false;
right_disconnects = false;
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 2a812caf9a..526950dbb3 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -993,7 +993,7 @@ void ItemList::_notification(int p_what) {
}
//ensure_selected_visible needs to be checked before we draw the list.
- if (ensure_selected_visible && current >= 0 && current <= items.size()) {
+ if (ensure_selected_visible && current >= 0 && current < items.size()) {
Rect2 r = items[current].rect_cache;
int from = scroll_bar->get_value();
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index dc1183df74..5e88251953 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -214,25 +214,6 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
accept_event(); //accept event if scroll changed
}
-void ScrollContainer::_update_scrollbar_position() {
-
- Size2 hmin = h_scroll->get_combined_minimum_size();
- Size2 vmin = v_scroll->get_combined_minimum_size();
-
- v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -vmin.width);
- v_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
- v_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
- v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
-
- h_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
- h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
- h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height);
- h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
-
- h_scroll->raise();
- v_scroll->raise();
-}
-
void ScrollContainer::_ensure_focused_visible(Control *p_control) {
if (!follow_focus) {
@@ -262,7 +243,8 @@ void ScrollContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- call_deferred("_update_scrollbar_position");
+ h_scroll->raise();
+ v_scroll->raise();
};
if (p_what == NOTIFICATION_READY) {
@@ -317,6 +299,7 @@ void ScrollContainer::_notification(int p_what) {
r.position += ofs;
fit_child_in_rect(c, r);
}
+
update();
};
@@ -408,13 +391,17 @@ void ScrollContainer::update_scrollbars() {
Size2 hmin;
Size2 vmin;
- if (scroll_h) hmin = h_scroll->get_combined_minimum_size();
- if (scroll_v) vmin = v_scroll->get_combined_minimum_size();
+ if (scroll_h) {
+ hmin = h_scroll->get_combined_minimum_size();
+ }
+ if (scroll_v) {
+ vmin = v_scroll->get_combined_minimum_size();
+ }
Size2 min = child_max_size;
- bool hide_scroll_v = !scroll_v || min.height <= size.height - hmin.height;
- bool hide_scroll_h = !scroll_h || min.width <= size.width - vmin.width;
+ bool hide_scroll_v = !scroll_v || min.height <= size.height;
+ bool hide_scroll_h = !scroll_h || min.width <= size.width;
if (hide_scroll_v) {
@@ -449,6 +436,10 @@ void ScrollContainer::update_scrollbars() {
scroll.x = h_scroll->get_value();
}
+
+ // Avoid scrollbar overlapping.
+ h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, hide_scroll_v ? 0 : -vmin.width);
+ v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, hide_scroll_h ? 0 : -hmin.height);
}
void ScrollContainer::_scroll_moved(float) {
@@ -559,7 +550,6 @@ void ScrollContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_h_scroll_enabled"), &ScrollContainer::is_h_scroll_enabled);
ClassDB::bind_method(D_METHOD("set_enable_v_scroll", "enable"), &ScrollContainer::set_enable_v_scroll);
ClassDB::bind_method(D_METHOD("is_v_scroll_enabled"), &ScrollContainer::is_v_scroll_enabled);
- ClassDB::bind_method(D_METHOD("_update_scrollbar_position"), &ScrollContainer::_update_scrollbar_position);
ClassDB::bind_method(D_METHOD("_ensure_focused_visible"), &ScrollContainer::_ensure_focused_visible);
ClassDB::bind_method(D_METHOD("set_h_scroll", "value"), &ScrollContainer::set_h_scroll);
ClassDB::bind_method(D_METHOD("get_h_scroll"), &ScrollContainer::get_h_scroll);
@@ -593,13 +583,14 @@ ScrollContainer::ScrollContainer() {
h_scroll = memnew(HScrollBar);
h_scroll->set_name("_h_scroll");
add_child(h_scroll);
+ h_scroll->connect("value_changed", this, "_scroll_moved");
+ h_scroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
v_scroll = memnew(VScrollBar);
v_scroll->set_name("_v_scroll");
add_child(v_scroll);
-
- h_scroll->connect("value_changed", this, "_scroll_moved");
v_scroll->connect("value_changed", this, "_scroll_moved");
+ v_scroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
drag_speed = Vector2();
drag_touching = false;
diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h
index 6423b36fcc..608b29bd93 100644
--- a/scene/gui/scroll_container.h
+++ b/scene/gui/scroll_container.h
@@ -75,7 +75,6 @@ protected:
void _scroll_moved(float);
static void _bind_methods();
- void _update_scrollbar_position();
void _ensure_focused_visible(Control *p_node);
public: