summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/extension/gdnative_interface.h2
-rw-r--r--core/input/input.cpp10
-rw-r--r--core/input/input.h4
-rw-r--r--core/object/object.cpp4
-rw-r--r--core/templates/vector.h19
-rw-r--r--core/variant/array.cpp27
-rw-r--r--core/variant/array.h4
-rw-r--r--core/variant/callable.cpp10
-rw-r--r--core/variant/callable.h6
-rw-r--r--doc/classes/Control.xml4
-rw-r--r--doc/classes/DisplayServer.xml14
-rw-r--r--doc/classes/HTTPRequest.xml2
-rw-r--r--doc/classes/Input.xml6
-rw-r--r--doc/classes/Viewport.xml2
-rw-r--r--editor/editor_file_dialog.cpp12
-rw-r--r--editor/editor_node.cpp6
-rw-r--r--editor/editor_spin_slider.cpp4
-rw-r--r--editor/filesystem_dock.cpp13
-rw-r--r--editor/import/resource_importer_texture.cpp5
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp16
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp2
-rw-r--r--editor/scene_tree_editor.cpp8
-rw-r--r--editor/script_create_dialog.cpp38
-rw-r--r--editor/script_create_dialog.h1
-rw-r--r--modules/gdscript/editor_templates/CharacterBody2D/basic_movement.gd5
-rw-r--r--modules/gdscript/editor_templates/CharacterBody3D/basic_movement.gd5
-rw-r--r--modules/gdscript/editor_templates/EditorPlugin/plugin.gd10
-rw-r--r--modules/gdscript/editor_templates/EditorScript/basic_editor_script.gd5
-rw-r--r--modules/gdscript/editor_templates/Node/default.gd2
-rw-r--r--modules/gdscript/editor_templates/VisualShaderNodeCustom/basic.gd16
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp2
-rw-r--r--modules/gdscript/gdscript_editor.cpp7
-rw-r--r--modules/mono/editor_templates/EditorPlugin/plugin.cs1
-rw-r--r--modules/mono/editor_templates/EditorScript/basic_editor_script.cs3
-rw-r--r--modules/mono/editor_templates/Node/default.cs2
-rw-r--r--modules/mono/editor_templates/Object/empty.cs1
-rw-r--r--modules/text_server_adv/SCsub73
-rw-r--r--modules/text_server_fb/SCsub18
-rw-r--r--platform/linuxbsd/display_server_x11.cpp6
-rw-r--r--platform/linuxbsd/display_server_x11.h2
-rw-r--r--platform/osx/display_server_osx.h2
-rw-r--r--platform/osx/display_server_osx.mm4
-rw-r--r--platform/windows/display_server_windows.cpp10
-rw-r--r--platform/windows/display_server_windows.h2
-rw-r--r--scene/gui/control.cpp6
-rw-r--r--scene/gui/control.h2
-rw-r--r--scene/main/http_request.cpp6
-rw-r--r--scene/main/http_request.h6
-rw-r--r--scene/main/viewport.cpp10
-rw-r--r--scene/main/viewport.h2
-rw-r--r--servers/display_server.cpp6
-rw-r--r--servers/display_server.h2
52 files changed, 230 insertions, 205 deletions
diff --git a/core/extension/gdnative_interface.h b/core/extension/gdnative_interface.h
index 50c747a7b4..732a1b5af0 100644
--- a/core/extension/gdnative_interface.h
+++ b/core/extension/gdnative_interface.h
@@ -219,7 +219,7 @@ typedef struct {
typedef const GDNativePropertyInfo *(*GDNativeExtensionClassGetPropertyList)(GDExtensionClassInstancePtr p_instance, uint32_t *r_count);
typedef void (*GDNativeExtensionClassFreePropertyList)(GDExtensionClassInstancePtr p_instance, const GDNativePropertyInfo *p_list);
typedef void (*GDNativeExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what);
-typedef const char *(*GDNativeExtensionClassToString)(GDExtensionClassInstancePtr p_instance);
+typedef void (*GDNativeExtensionClassToString)(GDExtensionClassInstancePtr p_instance, GDNativeStringPtr p_out);
typedef void (*GDNativeExtensionClassReference)(GDExtensionClassInstancePtr p_instance);
typedef void (*GDNativeExtensionClassUnreference)(GDExtensionClassInstancePtr p_instance);
typedef void (*GDNativeExtensionClassCallVirtual)(GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret);
diff --git a/core/input/input.cpp b/core/input/input.cpp
index 656bb92203..e64b5a3ab7 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -72,7 +72,7 @@ Input *Input::singleton = nullptr;
void (*Input::set_mouse_mode_func)(Input::MouseMode) = nullptr;
Input::MouseMode (*Input::get_mouse_mode_func)() = nullptr;
-void (*Input::warp_mouse_func)(const Vector2 &p_to_pos) = nullptr;
+void (*Input::warp_mouse_func)(const Vector2 &p_position) = nullptr;
Input::CursorShape (*Input::get_current_cursor_shape_func)() = nullptr;
void (*Input::set_custom_mouse_cursor_func)(const RES &, Input::CursorShape, const Vector2 &) = nullptr;
@@ -126,7 +126,7 @@ void Input::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_mouse_button_mask"), &Input::get_mouse_button_mask);
ClassDB::bind_method(D_METHOD("set_mouse_mode", "mode"), &Input::set_mouse_mode);
ClassDB::bind_method(D_METHOD("get_mouse_mode"), &Input::get_mouse_mode);
- ClassDB::bind_method(D_METHOD("warp_mouse_position", "to"), &Input::warp_mouse_position);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &Input::warp_mouse);
ClassDB::bind_method(D_METHOD("action_press", "action", "strength"), &Input::action_press, DEFVAL(1.f));
ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release);
ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &Input::set_default_cursor_shape, DEFVAL(CURSOR_ARROW));
@@ -733,8 +733,8 @@ MouseButton Input::get_mouse_button_mask() const {
return mouse_button_mask; // do not trust OS implementation, should remove it - OS::get_singleton()->get_mouse_button_state();
}
-void Input::warp_mouse_position(const Vector2 &p_to) {
- warp_mouse_func(p_to);
+void Input::warp_mouse(const Vector2 &p_position) {
+ warp_mouse_func(p_position);
}
Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) {
@@ -756,7 +756,7 @@ Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, con
const Point2i pos_local = p_motion->get_global_position() - p_rect.position;
const Point2i pos_warped(Math::fposmod(pos_local.x, p_rect.size.x), Math::fposmod(pos_local.y, p_rect.size.y));
if (pos_warped != pos_local) {
- warp_mouse_position(pos_warped + p_rect.position);
+ warp_mouse(pos_warped + p_rect.position);
}
return rel_warped;
diff --git a/core/input/input.h b/core/input/input.h
index ab2cd377f4..ac688b53b8 100644
--- a/core/input/input.h
+++ b/core/input/input.h
@@ -216,7 +216,7 @@ private:
static void (*set_mouse_mode_func)(MouseMode);
static MouseMode (*get_mouse_mode_func)();
- static void (*warp_mouse_func)(const Vector2 &p_to_pos);
+ static void (*warp_mouse_func)(const Vector2 &p_position);
static CursorShape (*get_current_cursor_shape_func)();
static void (*set_custom_mouse_cursor_func)(const RES &, CursorShape, const Vector2 &);
@@ -273,7 +273,7 @@ public:
Vector2 get_last_mouse_velocity();
MouseButton get_mouse_button_mask() const;
- void warp_mouse_position(const Vector2 &p_to);
+ void warp_mouse(const Vector2 &p_position);
Point2i warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect);
void parse_input_event(const Ref<InputEvent> &p_event);
diff --git a/core/object/object.cpp b/core/object/object.cpp
index 226d3ef0b8..7db62fdc5c 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -865,7 +865,9 @@ String Object::to_string() {
}
}
if (_extension && _extension->to_string) {
- return _extension->to_string(_extension_instance);
+ String ret;
+ _extension->to_string(_extension_instance, &ret);
+ return ret;
}
return "[" + get_class() + ":" + itos(get_instance_id()) + "]";
}
diff --git a/core/templates/vector.h b/core/templates/vector.h
index 0877e04e01..d87e76139b 100644
--- a/core/templates/vector.h
+++ b/core/templates/vector.h
@@ -97,24 +97,29 @@ public:
_FORCE_INLINE_ bool has(const T &p_val) const { return find(p_val) != -1; }
- template <class C>
- void sort_custom() {
+ void sort() {
+ sort_custom<_DefaultComparator<T>>();
+ }
+
+ template <class Comparator, bool Validate = SORT_ARRAY_VALIDATE_ENABLED, class... Args>
+ void sort_custom(Args &&...args) {
int len = _cowdata.size();
if (len == 0) {
return;
}
T *data = ptrw();
- SortArray<T, C> sorter;
+ SortArray<T, Comparator, Validate> sorter{ args... };
sorter.sort(data, len);
}
- void sort() {
- sort_custom<_DefaultComparator<T>>();
+ int bsearch(const T &p_value, bool p_before) {
+ return bsearch_custom<_DefaultComparator<T>>(p_value, p_before);
}
- int bsearch(const T &p_value, bool p_before) {
- SearchArray<T> search;
+ template <class Comparator, class Value, class... Args>
+ int bsearch_custom(const Value &p_value, bool p_before, Args &&...args) {
+ SearchArray<T, Comparator> search{ args... };
return search.bisect(ptrw(), size(), p_value, p_before);
}
diff --git a/core/variant/array.cpp b/core/variant/array.cpp
index 1b39558dff..afc4acadf9 100644
--- a/core/variant/array.cpp
+++ b/core/variant/array.cpp
@@ -484,24 +484,8 @@ void Array::sort() {
_p->array.sort_custom<_ArrayVariantSort>();
}
-struct _ArrayVariantSortCustom {
- Callable func;
-
- _FORCE_INLINE_ bool operator()(const Variant &p_l, const Variant &p_r) const {
- const Variant *args[2] = { &p_l, &p_r };
- Callable::CallError err;
- Variant res;
- func.call(args, 2, res, err);
- ERR_FAIL_COND_V_MSG(err.error != Callable::CallError::CALL_OK, false,
- "Error calling sorting method: " + Variant::get_callable_error_text(func, args, 1, err));
- return res;
- }
-};
-
-void Array::sort_custom(Callable p_callable) {
- SortArray<Variant, _ArrayVariantSortCustom, true> avs;
- avs.compare.func = p_callable;
- avs.sort(_p->array.ptrw(), _p->array.size());
+void Array::sort_custom(const Callable &p_callable) {
+ _p->array.sort_custom<CallableComparator, true>(p_callable);
}
void Array::shuffle() {
@@ -524,13 +508,10 @@ int Array::bsearch(const Variant &p_value, bool p_before) {
return avs.bisect(_p->array.ptrw(), _p->array.size(), p_value, p_before);
}
-int Array::bsearch_custom(const Variant &p_value, Callable p_callable, bool p_before) {
+int Array::bsearch_custom(const Variant &p_value, const Callable &p_callable, bool p_before) {
ERR_FAIL_COND_V(!_p->typed.validate(p_value, "custom binary search"), -1);
- SearchArray<Variant, _ArrayVariantSortCustom> avs;
- avs.compare.func = p_callable;
-
- return avs.bisect(_p->array.ptrw(), _p->array.size(), p_value, p_before);
+ return _p->array.bsearch_custom<CallableComparator>(p_value, p_before, p_callable);
}
void Array::reverse() {
diff --git a/core/variant/array.h b/core/variant/array.h
index 72bed5932c..ab5f7cd50f 100644
--- a/core/variant/array.h
+++ b/core/variant/array.h
@@ -82,10 +82,10 @@ public:
Variant back() const;
void sort();
- void sort_custom(Callable p_callable);
+ void sort_custom(const Callable &p_callable);
void shuffle();
int bsearch(const Variant &p_value, bool p_before = true);
- int bsearch_custom(const Variant &p_value, Callable p_callable, bool p_before = true);
+ int bsearch_custom(const Variant &p_value, const Callable &p_callable, bool p_before = true);
void reverse();
int find(const Variant &p_value, int p_from = 0) const;
diff --git a/core/variant/callable.cpp b/core/variant/callable.cpp
index 48ed48d120..516b8f2d51 100644
--- a/core/variant/callable.cpp
+++ b/core/variant/callable.cpp
@@ -429,3 +429,13 @@ Signal::Signal(ObjectID p_object, const StringName &p_name) {
object = p_object;
name = p_name;
}
+
+bool CallableComparator::operator()(const Variant &p_l, const Variant &p_r) const {
+ const Variant *args[2] = { &p_l, &p_r };
+ Callable::CallError err;
+ Variant res;
+ func.call(args, 2, res, err);
+ ERR_FAIL_COND_V_MSG(err.error != Callable::CallError::CALL_OK, false,
+ "Error calling compare method: " + Variant::get_callable_error_text(func, args, 1, err));
+ return res;
+}
diff --git a/core/variant/callable.h b/core/variant/callable.h
index c61870f194..6a760958d6 100644
--- a/core/variant/callable.h
+++ b/core/variant/callable.h
@@ -170,4 +170,10 @@ public:
Signal() {}
};
+struct CallableComparator {
+ const Callable &func;
+
+ bool operator()(const Variant &p_l, const Variant &p_r) const;
+};
+
#endif // CALLABLE_H
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 3163ac5610..78150af9dd 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -943,9 +943,9 @@
</method>
<method name="warp_mouse">
<return type="void" />
- <argument index="0" name="to_position" type="Vector2" />
+ <argument index="0" name="position" type="Vector2" />
<description>
- Moves the mouse cursor to [code]to_position[/code], relative to [member position] of this [Control].
+ Moves the mouse cursor to [code]position[/code], relative to [member position] of this [Control].
</description>
</method>
</methods>
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index 47bc496100..16a2019149 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -670,13 +670,6 @@
<description>
</description>
</method>
- <method name="mouse_warp_to_position">
- <return type="void" />
- <argument index="0" name="position" type="Vector2i" />
- <description>
- Sets the mouse cursor position to the given [code]position[/code].
- </description>
- </method>
<method name="process_events">
<return type="void" />
<description>
@@ -852,6 +845,13 @@
[b]Note:[/b] This method is implemented on Android, iOS and UWP.
</description>
</method>
+ <method name="warp_mouse">
+ <return type="void" />
+ <argument index="0" name="position" type="Vector2i" />
+ <description>
+ Sets the mouse cursor position to the given [code]position[/code] relative to an origin at the upper left corner of the currently focused game Window Manager window.
+ </description>
+ </method>
<method name="window_attach_instance_id">
<return type="void" />
<argument index="0" name="instance_id" type="int" />
diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml
index 42047a68c8..641d73e333 100644
--- a/doc/classes/HTTPRequest.xml
+++ b/doc/classes/HTTPRequest.xml
@@ -247,7 +247,7 @@
<member name="max_redirects" type="int" setter="set_max_redirects" getter="get_max_redirects" default="8">
Maximum number of allowed redirects.
</member>
- <member name="timeout" type="int" setter="set_timeout" getter="get_timeout" default="0">
+ <member name="timeout" type="float" setter="set_timeout" getter="get_timeout" default="0.0">
</member>
<member name="use_threads" type="bool" setter="set_use_threads" getter="is_using_threads" default="false">
If [code]true[/code], multithreading is used to improve performance.
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml
index 64a914bb31..c3552c9f62 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/Input.xml
@@ -379,11 +379,11 @@
[b]Note:[/b] It needs [code]VIBRATE[/code] permission for Android at export settings. iOS does not support duration.
</description>
</method>
- <method name="warp_mouse_position">
+ <method name="warp_mouse">
<return type="void" />
- <argument index="0" name="to" type="Vector2" />
+ <argument index="0" name="position" type="Vector2" />
<description>
- Sets the mouse position to the specified vector, provided in pixels and relative to an origin at the upper left corner of the game window.
+ Sets the mouse position to the specified vector, provided in pixels and relative to an origin at the upper left corner of the currently focused Window Manager game window.
Mouse position is clipped to the limits of the screen resolution, or to the limits of the game window if [enum MouseMode] is set to [code]MOUSE_MODE_CONFINED[/code] or [code]MOUSE_MODE_CONFINED_HIDDEN[/code].
</description>
</method>
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index a72e7f1eb0..b5916f8c17 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -172,7 +172,7 @@
</method>
<method name="warp_mouse">
<return type="void" />
- <argument index="0" name="to_position" type="Vector2" />
+ <argument index="0" name="position" type="Vector2" />
<description>
Moves the mouse pointer to the specified position in this [Viewport] using the coordinate system of this [Viewport].
</description>
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index fe19e73db9..ab403c4212 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -1308,6 +1308,18 @@ void EditorFileDialog::_update_favorites() {
favorite->set_pressed(false);
Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
+
+ bool fav_changed = false;
+ for (int i = favorited.size() - 1; i >= 0; i--) {
+ if (!dir_access->dir_exists(favorited[i])) {
+ favorited.remove_at(i);
+ fav_changed = true;
+ }
+ }
+ if (fav_changed) {
+ EditorSettings::get_singleton()->set_favorites(favorited);
+ }
+
for (int i = 0; i < favorited.size(); i++) {
bool cres = favorited[i].begins_with("res://");
if (cres != res) {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 305fe5f6ff..65101792b7 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -546,6 +546,12 @@ void EditorNode::_update_from_settings() {
RS::get_singleton()->decals_set_filter(RS::DecalFilter(int(GLOBAL_GET("rendering/textures/decals/filter"))));
RS::get_singleton()->light_projectors_set_filter(RS::LightProjectorFilter(int(GLOBAL_GET("rendering/textures/light_projectors/filter"))));
+
+ SceneTree *tree = get_tree();
+ tree->set_debug_collisions_color(GLOBAL_GET("debug/shapes/collision/shape_color"));
+ tree->set_debug_collision_contact_color(GLOBAL_GET("debug/shapes/collision/contact_color"));
+ tree->set_debug_navigation_color(GLOBAL_GET("debug/shapes/navigation/geometry_color"));
+ tree->set_debug_navigation_disabled_color(GLOBAL_GET("debug/shapes/navigation/disabled_geometry_color"));
}
void EditorNode::_select_default_main_screen_plugin() {
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index 9bf3c4c590..32d28cd3a7 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -81,7 +81,7 @@ void EditorSpinSlider::gui_input(const Ref<InputEvent> &p_event) {
if (grabbing_spinner_attempt) {
if (grabbing_spinner) {
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
- Input::get_singleton()->warp_mouse_position(grabbing_spinner_mouse_pos);
+ Input::get_singleton()->warp_mouse(grabbing_spinner_mouse_pos);
update();
} else {
_focus_entered();
@@ -414,7 +414,7 @@ void EditorSpinSlider::_draw_spin_slider() {
grabber->set_position(get_global_position() + (grabber_rect.get_center() - grabber->get_size() * 0.5) * scale);
if (mousewheel_over_grabber) {
- Input::get_singleton()->warp_mouse_position(grabber->get_position() + grabber_rect.size);
+ Input::get_singleton()->warp_mouse(grabber->get_position() + grabber_rect.size);
}
grabber_range = width;
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 2100a787c8..ee7ed77957 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -224,6 +224,19 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
favorites->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0);
Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorites();
+
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ bool fav_changed = false;
+ for (int i = favorite_paths.size() - 1; i >= 0; i--) {
+ if (!da->dir_exists(favorite_paths[i])) {
+ favorite_paths.remove_at(i);
+ fav_changed = true;
+ }
+ }
+ if (fav_changed) {
+ EditorSettings::get_singleton()->set_favorites(favorite_paths);
+ }
+
for (int i = 0; i < favorite_paths.size(); i++) {
String fave = favorite_paths[i];
if (!fave.begins_with("res://")) {
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 8d6db7d1e0..e2fa624fc6 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -171,6 +171,11 @@ bool ResourceImporterTexture::get_option_visibility(const String &p_path, const
if (compress_mode < COMPRESS_VRAM_COMPRESSED) {
return false;
}
+ } else if (p_option == "compress/normal_map") {
+ int compress_mode = int(p_options["compress/mode"]);
+ if (compress_mode == COMPRESS_LOSSLESS) {
+ return false;
+ }
} else if (p_option == "mipmaps/limit") {
return p_options["mipmaps/generate"];
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index d713e70251..764f467192 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -4324,8 +4324,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_do_method(this, "emit_signal", "item_lock_status_changed");
undo_redo->add_undo_method(this, "emit_signal", "item_lock_status_changed");
}
- undo_redo->add_do_method(viewport, "update", Variant());
- undo_redo->add_undo_method(viewport, "update", Variant());
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
undo_redo->commit_action();
} break;
case UNLOCK_SELECTED: {
@@ -4346,8 +4346,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_do_method(this, "emit_signal", "item_lock_status_changed");
undo_redo->add_undo_method(this, "emit_signal", "item_lock_status_changed");
}
- undo_redo->add_do_method(viewport, "update", Variant());
- undo_redo->add_undo_method(viewport, "update", Variant());
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
undo_redo->commit_action();
} break;
case GROUP_SELECTED: {
@@ -4368,8 +4368,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_do_method(this, "emit_signal", "item_group_status_changed");
undo_redo->add_undo_method(this, "emit_signal", "item_group_status_changed");
}
- undo_redo->add_do_method(viewport, "update", Variant());
- undo_redo->add_undo_method(viewport, "update", Variant());
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
undo_redo->commit_action();
} break;
case UNGROUP_SELECTED: {
@@ -4390,8 +4390,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_do_method(this, "emit_signal", "item_group_status_changed");
undo_redo->add_undo_method(this, "emit_signal", "item_group_status_changed");
}
- undo_redo->add_do_method(viewport, "update", Variant());
- undo_redo->add_undo_method(viewport, "update", Variant());
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
undo_redo->commit_action();
} break;
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 52e60b606c..ea119a33fa 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -205,7 +205,7 @@ void ViewportRotationControl::gui_input(const Ref<InputEvent> &p_event) {
orbiting = false;
if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) {
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
- Input::get_singleton()->warp_mouse_position(orbiting_mouse_start);
+ Input::get_singleton()->warp_mouse(orbiting_mouse_start);
}
}
}
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 3b8c540592..44eb5c670d 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -96,8 +96,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
if (n->is_class("CanvasItem") || n->is_class("Node3D")) {
undo_redo->add_do_method(n, "remove_meta", "_edit_lock_");
undo_redo->add_undo_method(n, "set_meta", "_edit_lock_", true);
- undo_redo->add_do_method(this, "_update_tree", Variant());
- undo_redo->add_undo_method(this, "_update_tree", Variant());
+ undo_redo->add_do_method(this, "_update_tree");
+ undo_redo->add_undo_method(this, "_update_tree");
undo_redo->add_do_method(this, "emit_signal", "node_changed");
undo_redo->add_undo_method(this, "emit_signal", "node_changed");
}
@@ -114,8 +114,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
if (n->is_class("CanvasItem") || n->is_class("Node3D")) {
undo_redo->add_do_method(n, "remove_meta", "_edit_group_");
undo_redo->add_undo_method(n, "set_meta", "_edit_group_", true);
- undo_redo->add_do_method(this, "_update_tree", Variant());
- undo_redo->add_undo_method(this, "_update_tree", Variant());
+ undo_redo->add_do_method(this, "_update_tree");
+ undo_redo->add_undo_method(this, "_update_tree");
undo_redo->add_do_method(this, "emit_signal", "node_changed");
undo_redo->add_undo_method(this, "emit_signal", "node_changed");
}
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index baafef8639..72f77c859b 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -106,15 +106,7 @@ static Vector<String> _get_hierarchy(String p_class_name) {
void ScriptCreateDialog::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
- case NOTIFICATION_THEME_CHANGED: {
- for (int i = 0; i < ScriptServer::get_language_count(); i++) {
- Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons"));
- if (language_icon.is_valid()) {
- language_menu->set_item_icon(i, language_icon);
- }
- }
-
+ case NOTIFICATION_ENTER_TREE: {
String last_language = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
if (!last_language.is_empty()) {
for (int i = 0; i < language_menu->get_item_count(); i++) {
@@ -127,9 +119,15 @@ void ScriptCreateDialog::_notification(int p_what) {
} else {
language_menu->select(default_language);
}
- if (EditorSettings::get_singleton()->has_meta("script_setup/use_script_templates")) {
- is_using_templates = bool(EditorSettings::get_singleton()->get_meta("script_setup/use_script_templates"));
- use_templates->set_pressed(is_using_templates);
+
+ [[fallthrough]];
+ }
+ case NOTIFICATION_THEME_CHANGED: {
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons"));
+ if (language_icon.is_valid()) {
+ language_menu->set_item_icon(i, language_icon);
+ }
}
path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
@@ -332,13 +330,8 @@ void ScriptCreateDialog::_template_changed(int p_template) {
dic_templates_project[parent_name->get_text()] = sinfo.get_hash();
EditorSettings::get_singleton()->set_project_metadata("script_setup", "templates_dictionary", dic_templates_project);
} else {
- // Save template into to editor dictionary (not a project template).
- Dictionary dic_templates;
- if (EditorSettings::get_singleton()->has_meta("script_setup/templates_dictionary")) {
- dic_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup/templates_dictionary");
- }
- dic_templates[parent_name->get_text()] = sinfo.get_hash();
- EditorSettings::get_singleton()->set_meta("script_setup/templates_dictionary", dic_templates);
+ // Save template info to editor dictionary (not a project template).
+ templates_dictionary[parent_name->get_text()] = sinfo.get_hash();
// Remove template from project dictionary as we last used an editor level template.
Dictionary dic_templates_project = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary());
if (dic_templates_project.has(parent_name->get_text())) {
@@ -479,7 +472,6 @@ void ScriptCreateDialog::_built_in_pressed() {
void ScriptCreateDialog::_use_template_pressed() {
is_using_templates = use_templates->is_pressed();
- EditorSettings::get_singleton()->set_meta("script_setup/use_script_templates", is_using_templates);
_update_dialog();
}
@@ -597,10 +589,6 @@ void ScriptCreateDialog::_update_template_menu() {
if (is_language_using_templates) {
// Get the latest templates used for each type of node from project settings then global settings.
Dictionary last_local_templates = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary());
- Dictionary last_global_templates;
- if (EditorSettings::get_singleton()->has_meta("script_setup/templates_dictionary")) {
- last_global_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup/templates_dictionary");
- }
String inherits_base_type = parent_name->get_text();
// If it inherits from a script, get its parent class first.
@@ -655,7 +643,7 @@ void ScriptCreateDialog::_update_template_menu() {
// Check for last used template for this node in project settings then in global settings.
if (last_local_templates.has(parent_name->get_text()) && t.get_hash() == String(last_local_templates[parent_name->get_text()])) {
last_used_template = id;
- } else if (last_used_template == -1 && last_global_templates.has(parent_name->get_text()) && t.get_hash() == String(last_global_templates[parent_name->get_text()])) {
+ } else if (last_used_template == -1 && templates_dictionary.has(parent_name->get_text()) && t.get_hash() == String(templates_dictionary[parent_name->get_text()])) {
last_used_template = id;
}
t.id = id;
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index d7c43f322c..e9f634e2c0 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -83,6 +83,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
int current_language;
int default_language;
bool re_check_path = false;
+ Dictionary templates_dictionary;
Control *path_controls[2];
Control *name_controls[2];
diff --git a/modules/gdscript/editor_templates/CharacterBody2D/basic_movement.gd b/modules/gdscript/editor_templates/CharacterBody2D/basic_movement.gd
index 34b5ba45b7..a379d915a9 100644
--- a/modules/gdscript/editor_templates/CharacterBody2D/basic_movement.gd
+++ b/modules/gdscript/editor_templates/CharacterBody2D/basic_movement.gd
@@ -2,8 +2,9 @@
extends _BASE_
-const SPEED: float = 300.0
-const JUMP_VELOCITY: float = -400.0
+
+const SPEED = 300.0
+const JUMP_VELOCITY = -400.0
# Get the gravity from the project settings to be synced with RigidDynamicBody nodes.
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
diff --git a/modules/gdscript/editor_templates/CharacterBody3D/basic_movement.gd b/modules/gdscript/editor_templates/CharacterBody3D/basic_movement.gd
index cbc9cf1064..360b199e56 100644
--- a/modules/gdscript/editor_templates/CharacterBody3D/basic_movement.gd
+++ b/modules/gdscript/editor_templates/CharacterBody3D/basic_movement.gd
@@ -2,8 +2,9 @@
extends _BASE_
-const SPEED: float = 5.0
-const JUMP_VELOCITY: float = 4.5
+
+const SPEED = 5.0
+const JUMP_VELOCITY = 4.5
# Get the gravity from the project settings to be synced with RigidDynamicBody nodes.
var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
diff --git a/modules/gdscript/editor_templates/EditorPlugin/plugin.gd b/modules/gdscript/editor_templates/EditorPlugin/plugin.gd
index 8614bb8b17..b27b3e5655 100644
--- a/modules/gdscript/editor_templates/EditorPlugin/plugin.gd
+++ b/modules/gdscript/editor_templates/EditorPlugin/plugin.gd
@@ -2,10 +2,12 @@
@tool
extends EditorPlugin
+
func _enter_tree() -> void:
- # Initialization of the plugin goes here.
- pass
+ # Initialization of the plugin goes here.
+ pass
+
func _exit_tree() -> void:
- # Clean-up of the plugin goes here.
- pass
+ # Clean-up of the plugin goes here.
+ pass
diff --git a/modules/gdscript/editor_templates/EditorScript/basic_editor_script.gd b/modules/gdscript/editor_templates/EditorScript/basic_editor_script.gd
index fdb174c7ed..fdb8550d43 100644
--- a/modules/gdscript/editor_templates/EditorScript/basic_editor_script.gd
+++ b/modules/gdscript/editor_templates/EditorScript/basic_editor_script.gd
@@ -2,6 +2,7 @@
@tool
extends EditorScript
+
+# Called when the script is executed (using File -> Run in Script Editor).
func _run() -> void:
- # Called when the script is executed (using File -> Run in Script Editor).
- pass
+ pass
diff --git a/modules/gdscript/editor_templates/Node/default.gd b/modules/gdscript/editor_templates/Node/default.gd
index ee5c0b99cc..cb96a21537 100644
--- a/modules/gdscript/editor_templates/Node/default.gd
+++ b/modules/gdscript/editor_templates/Node/default.gd
@@ -2,10 +2,12 @@
extends _BASE_
+
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
+
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
diff --git a/modules/gdscript/editor_templates/VisualShaderNodeCustom/basic.gd b/modules/gdscript/editor_templates/VisualShaderNodeCustom/basic.gd
index cf6d68333d..283a95d3b4 100644
--- a/modules/gdscript/editor_templates/VisualShaderNodeCustom/basic.gd
+++ b/modules/gdscript/editor_templates/VisualShaderNodeCustom/basic.gd
@@ -1,38 +1,50 @@
# meta-description: Visual shader's node plugin template
@tool
-extends _BASE_
class_name VisualShaderNode_CLASS_
+extends _BASE_
+
func _get_name() -> String:
return "_CLASS_"
+
func _get_category() -> String:
return ""
+
func _get_description() -> String:
return ""
+
func _get_return_icon_type() -> int:
return PORT_TYPE_SCALAR
+
func _get_input_port_count() -> int:
return 0
+
func _get_input_port_name(port: int) -> String:
return ""
+
func _get_input_port_type(port: int) -> int:
return PORT_TYPE_SCALAR
+
func _get_output_port_count() -> int:
return 1
+
func _get_output_port_name(port: int) -> String:
return "result"
+
func _get_output_port_type(port: int) -> int:
return PORT_TYPE_SCALAR
-func _get_code(input_vars: Array[String], output_vars: Array[String], mode: int, type: int) -> String:
+
+func _get_code(input_vars: Array[String], output_vars: Array[String],
+ mode: int, type: int) -> String:
return output_vars[0] + " = 0.0;"
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index af3d65d4d6..27e1520ab8 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -2303,7 +2303,7 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
break;
#ifdef DEBUG_ENABLED
} else {
- if (par_type.builtin_type == Variant::INT && p_call->arguments[i]->get_datatype().builtin_type == Variant::FLOAT) {
+ if (par_type.builtin_type == Variant::INT && p_call->arguments[i]->get_datatype().builtin_type == Variant::FLOAT && builtin_type != Variant::INT) {
parser->push_warning(p_call, GDScriptWarning::NARROWING_CONVERSION, p_call->function_name);
}
#endif
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 993ecd68bd..4a6e1eb497 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -68,14 +68,21 @@ Ref<Script> GDScriptLanguage::make_template(const String &p_template, const Stri
if (!EDITOR_GET("text_editor/completion/add_type_hints")) {
processed_template = processed_template.replace(": int", "")
.replace(": String", "")
+ .replace(": Array[String]", "")
.replace(": float", "")
.replace(":=", "=")
+ .replace(" -> String", "")
+ .replace(" -> int", "")
.replace(" -> void", "");
}
#else
processed_template = processed_template.replace(": int", "")
.replace(": String", "")
+ .replace(": Array[String]", "")
.replace(": float", "")
+ .replace(":=", "=")
+ .replace(" -> String", "")
+ .replace(" -> int", "")
.replace(" -> void", "");
#endif
diff --git a/modules/mono/editor_templates/EditorPlugin/plugin.cs b/modules/mono/editor_templates/EditorPlugin/plugin.cs
index 6e6a799be6..eba5fd12a4 100644
--- a/modules/mono/editor_templates/EditorPlugin/plugin.cs
+++ b/modules/mono/editor_templates/EditorPlugin/plugin.cs
@@ -1,4 +1,5 @@
// meta-description: Basic plugin template
+
#if TOOLS
using _BINDINGS_NAMESPACE_;
using System;
diff --git a/modules/mono/editor_templates/EditorScript/basic_editor_script.cs b/modules/mono/editor_templates/EditorScript/basic_editor_script.cs
index 2088822890..1b347edc1c 100644
--- a/modules/mono/editor_templates/EditorScript/basic_editor_script.cs
+++ b/modules/mono/editor_templates/EditorScript/basic_editor_script.cs
@@ -1,4 +1,5 @@
// meta-description: Basic editor script template
+
#if TOOLS
using _BINDINGS_NAMESPACE_;
using System;
@@ -6,9 +7,9 @@ using System;
[Tool]
public partial class _CLASS_ : _BASE_
{
+ // Called when the script is executed (using File -> Run in Script Editor).
public override void _Run()
{
- // Called when the script is executed (using File -> Run in Script Editor).
}
}
#endif
diff --git a/modules/mono/editor_templates/Node/default.cs b/modules/mono/editor_templates/Node/default.cs
index 73d69dd993..4c86d1666f 100644
--- a/modules/mono/editor_templates/Node/default.cs
+++ b/modules/mono/editor_templates/Node/default.cs
@@ -8,12 +8,10 @@ public partial class _CLASS_ : _BASE_
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
-
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(float delta)
{
-
}
}
diff --git a/modules/mono/editor_templates/Object/empty.cs b/modules/mono/editor_templates/Object/empty.cs
index e5bee64fe1..34526d514f 100644
--- a/modules/mono/editor_templates/Object/empty.cs
+++ b/modules/mono/editor_templates/Object/empty.cs
@@ -5,5 +5,4 @@ using System;
public partial class _CLASS_ : _BASE_
{
-
}
diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub
index e999700d55..dfd3bb3f1e 100644
--- a/modules/text_server_adv/SCsub
+++ b/modules/text_server_adv/SCsub
@@ -37,7 +37,7 @@ def make_icu_data(target, source, env):
thirdparty_obj = []
freetype_enabled = env.module_check_dependencies("text_server_adv", ["freetype"], True)
-msdngen_enabled = env.module_check_dependencies("text_server_adv", ["msdfgen"], True)
+msdfgen_enabled = env.module_check_dependencies("text_server_adv", ["msdfgen"], True)
if env["builtin_harfbuzz"]:
env_harfbuzz = env_modules.Clone()
@@ -117,20 +117,25 @@ if env["builtin_harfbuzz"]:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_harfbuzz.Append(
- CPPPATH=[
- "#thirdparty/harfbuzz/src",
- "#thirdparty/icu4c/common/",
- ]
- )
+ env_harfbuzz.Append(CPPPATH=["#thirdparty/harfbuzz/src"])
+
+ env_harfbuzz.Append(CCFLAGS=["-DHAVE_ICU"])
+ if env["builtin_icu"]:
+ env_harfbuzz.Append(CPPPATH=["#thirdparty/icu4c/common/"])
+ env_harfbuzz.Append(CCFLAGS=["-DHAVE_ICU_BUILTIN"])
if freetype_enabled:
env_harfbuzz.Append(
- CPPPATH=[
- "#thirdparty/freetype/include",
- "#thirdparty/graphite/include",
+ CCFLAGS=[
+ "-DHAVE_FREETYPE",
+ "-DHAVE_GRAPHITE2",
]
)
+ if env["builtin_freetype"]:
+ env_harfbuzz.Append(CPPPATH=["#thirdparty/freetype/include"])
+ if env["builtin_graphite"]:
+ env_harfbuzz.Append(CPPPATH=["#thirdparty/graphite/include"])
+ env_harfbuzz.Append(CCFLAGS=["-DGRAPHITE2_STATIC"])
if env["platform"] == "android" or env["platform"] == "linuxbsd":
env_harfbuzz.Append(CCFLAGS=["-DHAVE_PTHREAD"])
@@ -141,21 +146,7 @@ if env["builtin_harfbuzz"]:
else:
env_harfbuzz.Append(CCFLAGS=["-DHB_NO_MT"])
- env_harfbuzz.Append(
- CCFLAGS=[
- "-DHAVE_ICU_BUILTIN",
- "-DHAVE_ICU",
- ]
- )
-
- if freetype_enabled:
- env_harfbuzz.Append(
- CCFLAGS=[
- "-DHAVE_FREETYPE",
- "-DHAVE_GRAPHITE2",
- "-DGRAPHITE2_STATIC",
- ]
- )
+ env_text_server_adv.Append(CPPPATH=["#thirdparty/harfbuzz/src"])
lib = env_harfbuzz.add_library("harfbuzz_builtin", thirdparty_sources)
thirdparty_obj += lib
@@ -481,6 +472,10 @@ if env["builtin_icu"]:
"-DICU_DATA_NAME=" + icu_data_name,
]
)
+ if env_text_server_adv["tools"]:
+ env_text_server_adv.Append(CXXFLAGS=["-DICU_STATIC_DATA"])
+
+ env_text_server_adv.Append(CPPPATH=["#thirdparty/icu4c/common/"])
lib = env_icu.add_library("icu_builtin", thirdparty_sources)
thirdparty_obj += lib
@@ -503,30 +498,14 @@ if env["builtin_icu"]:
module_obj = []
-if env_text_server_adv["tools"]:
- env_text_server_adv.Append(CXXFLAGS=["-DICU_STATIC_DATA"])
+if env["builtin_msdfgen"] and msdfgen_enabled:
+ env_text_server_adv.Append(CPPPATH=["#thirdparty/msdfgen"])
-env_text_server_adv.Append(
- CPPPATH=[
- "#thirdparty/harfbuzz/src",
- "#thirdparty/icu4c/common/",
- ]
-)
+if env["builtin_freetype"] and freetype_enabled:
+ env_text_server_adv.Append(CPPPATH=["#thirdparty/freetype/include"])
-if msdngen_enabled:
- env_text_server_adv.Append(
- CPPPATH=[
- "#thirdparty/msdfgen",
- ]
- )
-
-if freetype_enabled:
- env_text_server_adv.Append(
- CPPPATH=[
- "#thirdparty/freetype/include",
- "#thirdparty/graphite/include",
- ]
- )
+if env["builtin_graphite"] and freetype_enabled:
+ env_text_server_adv.Append(CPPPATH=["#thirdparty/graphite/include"])
env_text_server_adv.add_source_files(module_obj, "*.cpp")
env.modules_sources += module_obj
diff --git a/modules/text_server_fb/SCsub b/modules/text_server_fb/SCsub
index 31d1db6167..121f38fcd5 100644
--- a/modules/text_server_fb/SCsub
+++ b/modules/text_server_fb/SCsub
@@ -4,22 +4,14 @@ Import("env")
Import("env_modules")
freetype_enabled = env.module_check_dependencies("text_server_fb", ["freetype"], True)
-msdngen_enabled = env.module_check_dependencies("text_server_fb", ["msdfgen"], True)
+msdfgen_enabled = env.module_check_dependencies("text_server_fb", ["msdfgen"], True)
env_text_server_fb = env_modules.Clone()
-if msdngen_enabled:
- env_text_server_fb.Append(
- CPPPATH=[
- "#thirdparty/msdfgen",
- ]
- )
+if env["builtin_msdfgen"] and msdfgen_enabled:
+ env_text_server_fb.Append(CPPPATH=["#thirdparty/msdfgen"])
-if freetype_enabled:
- env_text_server_fb.Append(
- CPPPATH=[
- "#thirdparty/freetype/include",
- ]
- )
+if env["builtin_freetype"] and freetype_enabled:
+ env_text_server_fb.Append(CPPPATH=["#thirdparty/freetype/include"])
env_text_server_fb.add_source_files(env.modules_sources, "*.cpp")
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 07cb6a23e8..2ddccdb8bf 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -363,15 +363,15 @@ DisplayServerX11::MouseMode DisplayServerX11::mouse_get_mode() const {
return mouse_mode;
}
-void DisplayServerX11::mouse_warp_to_position(const Point2i &p_to) {
+void DisplayServerX11::warp_mouse(const Point2i &p_position) {
_THREAD_SAFE_METHOD_
if (mouse_mode == MOUSE_MODE_CAPTURED) {
- last_mouse_pos = p_to;
+ last_mouse_pos = p_position;
} else {
WindowID window_id = windows.has(last_focused_window) ? last_focused_window : MAIN_WINDOW_ID;
XWarpPointer(x11_display, None, windows[window_id].x11_window,
- 0, 0, 0, 0, (int)p_to.x, (int)p_to.y);
+ 0, 0, 0, 0, (int)p_position.x, (int)p_position.y);
}
}
diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h
index 63d32d939d..0f44aa4b11 100644
--- a/platform/linuxbsd/display_server_x11.h
+++ b/platform/linuxbsd/display_server_x11.h
@@ -301,7 +301,7 @@ public:
virtual void mouse_set_mode(MouseMode p_mode) override;
virtual MouseMode mouse_get_mode() const override;
- virtual void mouse_warp_to_position(const Point2i &p_to) override;
+ virtual void warp_mouse(const Point2i &p_position) override;
virtual Point2i mouse_get_position() const override;
virtual MouseButton mouse_get_button_state() const override;
diff --git a/platform/osx/display_server_osx.h b/platform/osx/display_server_osx.h
index d9a0d2ce17..fa3091ff81 100644
--- a/platform/osx/display_server_osx.h
+++ b/platform/osx/display_server_osx.h
@@ -271,7 +271,7 @@ public:
virtual MouseMode mouse_get_mode() const override;
bool update_mouse_wrap(WindowData &p_wd, NSPoint &r_delta, NSPoint &r_mpos, NSTimeInterval p_timestamp);
- virtual void mouse_warp_to_position(const Point2i &p_to) override;
+ virtual void warp_mouse(const Point2i &p_position) override;
virtual Point2i mouse_get_position() const override;
void mouse_set_button_state(MouseButton p_state);
virtual MouseButton mouse_get_button_state() const override;
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm
index 8820201c10..6cdadcae39 100644
--- a/platform/osx/display_server_osx.mm
+++ b/platform/osx/display_server_osx.mm
@@ -1646,7 +1646,7 @@ bool DisplayServerOSX::update_mouse_wrap(WindowData &p_wd, NSPoint &r_delta, NSP
return false;
}
-void DisplayServerOSX::mouse_warp_to_position(const Point2i &p_to) {
+void DisplayServerOSX::warp_mouse(const Point2i &p_position) {
_THREAD_SAFE_METHOD_
if (mouse_mode != MOUSE_MODE_CAPTURED) {
@@ -1656,7 +1656,7 @@ void DisplayServerOSX::mouse_warp_to_position(const Point2i &p_to) {
// Local point in window coords.
const NSRect contentRect = [wd.window_view frame];
const float scale = screen_get_max_scale();
- NSRect pointInWindowRect = NSMakeRect(p_to.x / scale, contentRect.size.height - (p_to.y / scale - 1), 0, 0);
+ NSRect pointInWindowRect = NSMakeRect(p_position.x / scale, contentRect.size.height - (p_position.y / scale - 1), 0, 0);
NSPoint pointOnScreen = [[wd.window_view window] convertRectToScreen:pointInWindowRect].origin;
// Point in scren coords.
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index d243d4c05d..16323dcc13 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -150,7 +150,7 @@ DisplayServer::MouseMode DisplayServerWindows::mouse_get_mode() const {
return mouse_mode;
}
-void DisplayServerWindows::mouse_warp_to_position(const Point2i &p_to) {
+void DisplayServerWindows::warp_mouse(const Point2i &p_position) {
_THREAD_SAFE_METHOD_
if (!windows.has(last_focused_window)) {
@@ -158,12 +158,12 @@ void DisplayServerWindows::mouse_warp_to_position(const Point2i &p_to) {
}
if (mouse_mode == MOUSE_MODE_CAPTURED) {
- old_x = p_to.x;
- old_y = p_to.y;
+ old_x = p_position.x;
+ old_y = p_position.y;
} else {
POINT p;
- p.x = p_to.x;
- p.y = p_to.y;
+ p.x = p_position.x;
+ p.y = p_position.y;
ClientToScreen(windows[last_focused_window].hWnd, &p);
SetCursorPos(p.x, p.y);
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index a56a2b83ac..71fedf2bca 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -457,7 +457,7 @@ public:
virtual void mouse_set_mode(MouseMode p_mode) override;
virtual MouseMode mouse_get_mode() const override;
- virtual void mouse_warp_to_position(const Point2i &p_to) override;
+ virtual void warp_mouse(const Point2i &p_position) override;
virtual Point2i mouse_get_position() const override;
virtual MouseButton mouse_get_button_state() const override;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index d2d1b5e9b7..ee35eee35d 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2937,9 +2937,9 @@ Control::MouseFilter Control::get_mouse_filter() const {
return data.mouse_filter;
}
-void Control::warp_mouse(const Point2 &p_to_pos) {
+void Control::warp_mouse(const Point2 &p_position) {
ERR_FAIL_COND(!is_inside_tree());
- get_viewport()->warp_mouse(get_global_transform().xform(p_to_pos));
+ get_viewport()->warp_mouse(get_global_transform().xform(p_position));
}
bool Control::is_text_field() const {
@@ -3331,7 +3331,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_drag_preview", "control"), &Control::set_drag_preview);
ClassDB::bind_method(D_METHOD("is_drag_successful"), &Control::is_drag_successful);
- ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Control::warp_mouse);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &Control::warp_mouse);
ClassDB::bind_method(D_METHOD("update_minimum_size"), &Control::update_minimum_size);
diff --git a/scene/gui/control.h b/scene/gui/control.h
index becb50a118..9f78d003ae 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -548,7 +548,7 @@ public:
void grab_click_focus();
- void warp_mouse(const Point2 &p_to_pos);
+ void warp_mouse(const Point2 &p_position);
virtual bool is_text_field() const;
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 700ba761f6..ac10c2bad8 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -558,12 +558,12 @@ void HTTPRequest::set_https_proxy(const String &p_host, int p_port) {
client->set_https_proxy(p_host, p_port);
}
-void HTTPRequest::set_timeout(int p_timeout) {
+void HTTPRequest::set_timeout(double p_timeout) {
ERR_FAIL_COND(p_timeout < 0);
timeout = p_timeout;
}
-int HTTPRequest::get_timeout() {
+double HTTPRequest::get_timeout() {
return timeout;
}
@@ -615,7 +615,7 @@ void HTTPRequest::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "accept_gzip"), "set_accept_gzip", "is_accepting_gzip");
ADD_PROPERTY(PropertyInfo(Variant::INT, "body_size_limit", PROPERTY_HINT_RANGE, "-1,2000000000"), "set_body_size_limit", "get_body_size_limit");
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_redirects", PROPERTY_HINT_RANGE, "-1,64"), "set_max_redirects", "get_max_redirects");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "timeout", PROPERTY_HINT_RANGE, "0,86400"), "set_timeout", "get_timeout");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "timeout", PROPERTY_HINT_RANGE, "0,3600,0.1,or_greater"), "set_timeout", "get_timeout");
ADD_SIGNAL(MethodInfo("request_completed", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::INT, "response_code"), PropertyInfo(Variant::PACKED_STRING_ARRAY, "headers"), PropertyInfo(Variant::PACKED_BYTE_ARRAY, "body")));
diff --git a/scene/main/http_request.h b/scene/main/http_request.h
index 62880fa282..26d648458f 100644
--- a/scene/main/http_request.h
+++ b/scene/main/http_request.h
@@ -96,7 +96,7 @@ private:
int max_redirects = 8;
- int timeout = 0;
+ double timeout = 0;
void _redirect_request(const String &p_new_url);
@@ -146,8 +146,8 @@ public:
Timer *timer;
- void set_timeout(int p_timeout);
- int get_timeout();
+ void set_timeout(double p_timeout);
+ double get_timeout();
void _timeout();
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 4525696071..0c7a9fda4a 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1124,9 +1124,9 @@ Vector2 Viewport::get_mouse_position() const {
return gui.last_mouse_pos;
}
-void Viewport::warp_mouse(const Vector2 &p_pos) {
- Vector2 gpos = (get_final_transform().affine_inverse() * _get_input_pre_xform()).affine_inverse().xform(p_pos);
- Input::get_singleton()->warp_mouse_position(gpos);
+void Viewport::warp_mouse(const Vector2 &p_position) {
+ Vector2 gpos = (get_final_transform().affine_inverse() * _get_input_pre_xform()).affine_inverse().xform(p_position);
+ Input::get_singleton()->warp_mouse(gpos);
}
void Viewport::_gui_sort_roots() {
@@ -2719,7 +2719,7 @@ void Viewport::push_input(const Ref<InputEvent> &p_event, bool p_local_coords) {
ev = p_event;
}
- if (is_embedding_subwindows() && _sub_windows_forward_input(p_event)) {
+ if (is_embedding_subwindows() && _sub_windows_forward_input(ev)) {
set_input_as_handled();
return;
}
@@ -3642,7 +3642,7 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_audio_listener_2d"), &Viewport::is_audio_listener_2d);
ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position);
- ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Viewport::warp_mouse);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &Viewport::warp_mouse);
ClassDB::bind_method(D_METHOD("gui_get_drag_data"), &Viewport::gui_get_drag_data);
ClassDB::bind_method(D_METHOD("gui_is_dragging"), &Viewport::gui_is_dragging);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index e4912f31c5..d5fca1b881 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -547,7 +547,7 @@ public:
bool is_input_disabled() const;
Vector2 get_mouse_position() const;
- void warp_mouse(const Vector2 &p_pos);
+ void warp_mouse(const Vector2 &p_position);
void set_physics_object_picking(bool p_enable);
bool get_physics_object_picking();
diff --git a/servers/display_server.cpp b/servers/display_server.cpp
index db65465c64..67bfc75426 100644
--- a/servers/display_server.cpp
+++ b/servers/display_server.cpp
@@ -228,7 +228,7 @@ DisplayServer::MouseMode DisplayServer::mouse_get_mode() const {
return MOUSE_MODE_VISIBLE;
}
-void DisplayServer::mouse_warp_to_position(const Point2i &p_to) {
+void DisplayServer::warp_mouse(const Point2i &p_position) {
WARN_PRINT("Mouse warping is not supported by this display server.");
}
@@ -481,7 +481,7 @@ void DisplayServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("mouse_set_mode", "mouse_mode"), &DisplayServer::mouse_set_mode);
ClassDB::bind_method(D_METHOD("mouse_get_mode"), &DisplayServer::mouse_get_mode);
- ClassDB::bind_method(D_METHOD("mouse_warp_to_position", "position"), &DisplayServer::mouse_warp_to_position);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &DisplayServer::warp_mouse);
ClassDB::bind_method(D_METHOD("mouse_get_position"), &DisplayServer::mouse_get_position);
ClassDB::bind_method(D_METHOD("mouse_get_button_state"), &DisplayServer::mouse_get_button_state);
@@ -729,7 +729,7 @@ Input::MouseMode DisplayServer::_input_get_mouse_mode() {
}
void DisplayServer::_input_warp(const Vector2 &p_to_pos) {
- singleton->mouse_warp_to_position(p_to_pos);
+ singleton->warp_mouse(p_to_pos);
}
Input::CursorShape DisplayServer::_input_get_current_cursor_shape() {
diff --git a/servers/display_server.h b/servers/display_server.h
index f3a910471f..4961b07ba3 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -183,7 +183,7 @@ public:
virtual void mouse_set_mode(MouseMode p_mode);
virtual MouseMode mouse_get_mode() const;
- virtual void mouse_warp_to_position(const Point2i &p_to);
+ virtual void warp_mouse(const Point2i &p_position);
virtual Point2i mouse_get_position() const;
virtual MouseButton mouse_get_button_state() const;