diff options
68 files changed, 1107 insertions, 118 deletions
diff --git a/doc/classes/AudioEffectCapture.xml b/doc/classes/AudioEffectCapture.xml index cf3d87c2e4..c7ee621ca6 100644 --- a/doc/classes/AudioEffectCapture.xml +++ b/doc/classes/AudioEffectCapture.xml @@ -67,7 +67,7 @@ </methods> <members> <member name="buffer_length" type="float" setter="set_buffer_length" getter="get_buffer_length" default="0.1"> - Length of the internal ring buffer, in seconds. + Length of the internal ring buffer, in seconds. Setting the buffer length will have no effect if already initialized. </member> </members> <constants> diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index d13f431a16..87b157db4e 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -318,7 +318,7 @@ <argument index="9" name="flags" type="int" default="3"> </argument> <description> - Draws [code]text[/code] using the specified [code]font[/code] at the [code]position[/code] (top-left corner). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width. + Draws [code]text[/code] using the specified [code]font[/code] at the [code]position[/code] (bottom-left corner using the baseline of the font). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width. [b]Example using the default project font:[/b] [codeblocks] [gdscript] diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml index 409e405551..bf5237422b 100644 --- a/doc/classes/Font.xml +++ b/doc/classes/Font.xml @@ -175,7 +175,7 @@ </argument> <description> Returns the size of a character, optionally taking kerning into account if the next character is provided. - [b]Note:[/b] Do not use this function to calculate width of the string character by character, use [method get_string_size] or [TextLine] instead. + [b]Note:[/b] Do not use this function to calculate width of the string character by character, use [method get_string_size] or [TextLine] instead. The height returned is the font height (see also [method get_height]) and has no relation to the glyph height. </description> </method> <method name="get_data" qualifiers="const"> @@ -248,6 +248,7 @@ </argument> <description> Returns the size size of a bounding box of a string, taking kerning and advance into account. + [b]Note:[/b] Real height of the string is context-dependent and can be significantly different from the value returned by [method get_height]. See also [method draw_string]. </description> </method> diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 50a675e8db..977f2bb565 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -49,9 +49,9 @@ <return type="Vector3"> </return> <description> - Returns the acceleration of the device's accelerometer sensor, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. + Returns the acceleration in m/s² of the device's accelerometer sensor, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. Note this method returns an empty [Vector3] when running from the editor even when your device has an accelerometer. You must export your project to a supported device to read values from the accelerometer. - [b]Note:[/b] This method only works on iOS, Android, and UWP. On other platforms, it always returns [constant Vector3.ZERO]. On Android the unit of measurement for each axis is m/s² while on iOS and UWP it's a multiple of the Earth's gravitational acceleration [code]g[/code] (~9.81 m/s²). + [b]Note:[/b] This method only works on iOS, Android, and UWP. On other platforms, it always returns [constant Vector3.ZERO]. </description> </method> <method name="get_action_raw_strength" qualifiers="const"> @@ -106,8 +106,8 @@ <return type="Vector3"> </return> <description> - Returns the gravity of the device's accelerometer sensor, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. - [b]Note:[/b] This method only works on Android and iOS. On other platforms, it always returns [constant Vector3.ZERO]. On Android the unit of measurement for each axis is m/s² while on iOS it's a multiple of the Earth's gravitational acceleration [code]g[/code] (~9.81 m/s²). + Returns the gravity in m/s² of the device's accelerometer sensor, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. + [b]Note:[/b] This method only works on Android and iOS. On other platforms, it always returns [constant Vector3.ZERO]. </description> </method> <method name="get_gyroscope" qualifiers="const"> diff --git a/main/main.cpp b/main/main.cpp index 67152bb52a..951fce35ba 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1662,7 +1662,13 @@ Error Main::setup2(Thread::ID p_main_tid_override) { } } - Color boot_bg_color = GLOBAL_DEF("application/boot_splash/bg_color", boot_splash_bg_color); +#if defined(TOOLS_ENABLED) && !defined(NO_EDITOR_SPLASH) + const Color boot_bg_color = + GLOBAL_DEF("application/boot_splash/bg_color", + (editor || project_manager) ? boot_splash_editor_bg_color : boot_splash_bg_color); +#else + const Color boot_bg_color = GLOBAL_DEF("application/boot_splash/bg_color", boot_splash_bg_color); +#endif if (boot_logo.is_valid()) { RenderingServer::get_singleton()->set_boot_image(boot_logo, boot_bg_color, boot_logo_scale, boot_logo_filter); diff --git a/main/main_builders.py b/main/main_builders.py index aa91201c3e..c880bfa3c4 100644 --- a/main/main_builders.py +++ b/main/main_builders.py @@ -17,6 +17,7 @@ def make_splash(target, source, env): g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef BOOT_SPLASH_H\n") g.write("#define BOOT_SPLASH_H\n") + # Use a neutral gray color to better fit various kinds of projects. g.write("static const Color boot_splash_bg_color = Color(0.14, 0.14, 0.14);\n") g.write("static const unsigned char boot_splash_png[] = {\n") for i in range(len(buf)): @@ -36,7 +37,9 @@ def make_splash_editor(target, source, env): g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef BOOT_SPLASH_EDITOR_H\n") g.write("#define BOOT_SPLASH_EDITOR_H\n") - g.write("static const Color boot_splash_editor_bg_color = Color(0.14, 0.14, 0.14);\n") + # The editor splash background color is taken from the default editor theme's background color. + # This helps achieve a visually "smoother" transition between the splash screen and the editor. + g.write("static const Color boot_splash_editor_bg_color = Color(0.125, 0.145, 0.192);\n") g.write("static const unsigned char boot_splash_editor_png[] = {\n") for i in range(len(buf)): g.write(str(buf[i]) + ",\n") diff --git a/misc/dist/html/manifest.json b/misc/dist/html/manifest.json index 6e0053c23c..6fbed737c7 100644 --- a/misc/dist/html/manifest.json +++ b/misc/dist/html/manifest.json @@ -3,7 +3,7 @@ "short_name": "Godot", "description": "Multi-platform 2D and 3D game engine with a feature-rich editor", "lang": "en", - "start_url": "/godot.tools.html", + "start_url": "./godot.tools.html", "display": "standalone", "orientation": "landscape", "theme_color": "#478cbf", diff --git a/modules/gdnative/gdnative/aabb.cpp b/modules/gdnative/gdnative/aabb.cpp index 5d3f224adc..c42b874b4b 100644 --- a/modules/gdnative/gdnative/aabb.cpp +++ b/modules/gdnative/gdnative/aabb.cpp @@ -42,6 +42,10 @@ void GDAPI godot_aabb_new(godot_aabb *p_self) { memnew_placement(p_self, AABB); } +void GDAPI godot_aabb_new_copy(godot_aabb *r_dest, const godot_aabb *p_src) { + memnew_placement(r_dest, AABB(*(AABB *)p_src)); +} + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp index e68b60c5e6..76e131dc06 100644 --- a/modules/gdnative/gdnative/array.cpp +++ b/modules/gdnative/gdnative/array.cpp @@ -43,6 +43,10 @@ void GDAPI godot_array_new(godot_array *p_self) { memnew_placement(p_self, Array); } +void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src) { + memnew_placement(r_dest, Array(*(Array *)p_src)); +} + void GDAPI godot_array_destroy(godot_array *p_self) { ((Array *)p_self)->~Array(); } diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp index df3e1255ac..4641f0bacc 100644 --- a/modules/gdnative/gdnative/basis.cpp +++ b/modules/gdnative/gdnative/basis.cpp @@ -42,6 +42,10 @@ void GDAPI godot_basis_new(godot_basis *p_self) { memnew_placement(p_self, Basis); } +void GDAPI godot_basis_new_copy(godot_basis *r_dest, const godot_basis *p_src) { + memnew_placement(r_dest, Basis(*(Basis *)p_src)); +} + godot_vector3 GDAPI *godot_basis_operator_index(godot_basis *p_self, godot_int p_index) { Basis *self = (Basis *)p_self; return (godot_vector3 *)&self->operator[](p_index); diff --git a/modules/gdnative/gdnative/callable.cpp b/modules/gdnative/gdnative/callable.cpp index 7c62b5928f..85274e5e22 100644 --- a/modules/gdnative/gdnative/callable.cpp +++ b/modules/gdnative/gdnative/callable.cpp @@ -43,6 +43,10 @@ void GDAPI godot_callable_new(godot_callable *p_self) { memnew_placement(p_self, Callable); } +void GDAPI godot_callable_new_copy(godot_callable *r_dest, const godot_callable *p_src) { + memnew_placement(r_dest, Callable(*(Callable *)p_src)); +} + void GDAPI godot_callable_destroy(godot_callable *p_self) { Callable *self = (Callable *)p_self; self->~Callable(); diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp index 12a800d333..502f89c027 100644 --- a/modules/gdnative/gdnative/color.cpp +++ b/modules/gdnative/gdnative/color.cpp @@ -42,6 +42,10 @@ void GDAPI godot_color_new(godot_color *p_self) { memnew_placement(p_self, Color); } +void GDAPI godot_color_new_copy(godot_color *r_dest, const godot_color *p_src) { + memnew_placement(r_dest, Color(*(Color *)p_src)); +} + float GDAPI *godot_color_operator_index(godot_color *p_self, godot_int p_index) { Color *self = (Color *)p_self; return (float *)&self->operator[](p_index); diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp index 9fa4a27a83..2bfad6e695 100644 --- a/modules/gdnative/gdnative/dictionary.cpp +++ b/modules/gdnative/gdnative/dictionary.cpp @@ -43,6 +43,10 @@ void GDAPI godot_dictionary_new(godot_dictionary *p_self) { memnew_placement(p_self, Dictionary); } +void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src) { + memnew_placement(r_dest, Dictionary(*(Dictionary *)p_src)); +} + void GDAPI godot_dictionary_destroy(godot_dictionary *p_self) { Dictionary *self = (Dictionary *)p_self; self->~Dictionary(); diff --git a/modules/gdnative/gdnative/node_path.cpp b/modules/gdnative/gdnative/node_path.cpp index 02c2f9b22b..57d67b9abb 100644 --- a/modules/gdnative/gdnative/node_path.cpp +++ b/modules/gdnative/gdnative/node_path.cpp @@ -42,6 +42,10 @@ void GDAPI godot_node_path_new(godot_node_path *p_self) { memnew_placement(p_self, NodePath); } +void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src) { + memnew_placement(r_dest, NodePath(*(NodePath *)p_src)); +} + void GDAPI godot_node_path_destroy(godot_node_path *p_self) { NodePath *self = (NodePath *)p_self; self->~NodePath(); diff --git a/modules/gdnative/gdnative/packed_arrays.cpp b/modules/gdnative/gdnative/packed_arrays.cpp index 63a2425b87..396109e576 100644 --- a/modules/gdnative/gdnative/packed_arrays.cpp +++ b/modules/gdnative/gdnative/packed_arrays.cpp @@ -59,6 +59,10 @@ void GDAPI godot_packed_byte_array_new(godot_packed_byte_array *p_self) { memnew_placement(p_self, PackedByteArray); } +void GDAPI godot_packed_byte_array_new_copy(godot_packed_byte_array *r_dest, const godot_packed_byte_array *p_src) { + memnew_placement(r_dest, PackedByteArray(*(PackedByteArray *)p_src)); +} + void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self) { ((PackedByteArray *)p_self)->~PackedByteArray(); } @@ -79,6 +83,10 @@ void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *p_self) { memnew_placement(p_self, PackedInt32Array); } +void GDAPI godot_packed_int32_array_new_copy(godot_packed_int32_array *r_dest, const godot_packed_int32_array *p_src) { + memnew_placement(r_dest, PackedInt32Array(*(PackedInt32Array *)p_src)); +} + void GDAPI godot_packed_int32_array_destroy(godot_packed_int32_array *p_self) { ((PackedInt32Array *)p_self)->~PackedInt32Array(); } @@ -99,6 +107,10 @@ void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *p_self) { memnew_placement(p_self, PackedInt64Array); } +void GDAPI godot_packed_int64_array_new_copy(godot_packed_int64_array *r_dest, const godot_packed_int64_array *p_src) { + memnew_placement(r_dest, PackedInt64Array(*(PackedInt64Array *)p_src)); +} + void GDAPI godot_packed_int64_array_destroy(godot_packed_int64_array *p_self) { ((PackedInt64Array *)p_self)->~PackedInt64Array(); } @@ -119,6 +131,10 @@ void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *p_self) { memnew_placement(p_self, PackedFloat32Array); } +void GDAPI godot_packed_float32_array_new_copy(godot_packed_float32_array *r_dest, const godot_packed_float32_array *p_src) { + memnew_placement(r_dest, PackedFloat32Array(*(PackedFloat32Array *)p_src)); +} + void GDAPI godot_packed_float32_array_destroy(godot_packed_float32_array *p_self) { ((PackedFloat32Array *)p_self)->~PackedFloat32Array(); } @@ -139,6 +155,10 @@ void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *p_self) { memnew_placement(p_self, PackedFloat64Array); } +void GDAPI godot_packed_float64_array_new_copy(godot_packed_float64_array *r_dest, const godot_packed_float64_array *p_src) { + memnew_placement(r_dest, PackedFloat64Array(*(PackedFloat64Array *)p_src)); +} + void GDAPI godot_packed_float64_array_destroy(godot_packed_float64_array *p_self) { ((PackedFloat64Array *)p_self)->~PackedFloat64Array(); } @@ -159,6 +179,10 @@ void GDAPI godot_packed_string_array_new(godot_packed_string_array *p_self) { memnew_placement(p_self, PackedStringArray); } +void GDAPI godot_packed_string_array_new_copy(godot_packed_string_array *r_dest, const godot_packed_string_array *p_src) { + memnew_placement(r_dest, PackedStringArray(*(PackedStringArray *)p_src)); +} + void GDAPI godot_packed_string_array_destroy(godot_packed_string_array *p_self) { ((PackedStringArray *)p_self)->~PackedStringArray(); } @@ -179,6 +203,10 @@ void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *p_self) { memnew_placement(p_self, PackedVector2Array); } +void GDAPI godot_packed_vector2_array_new_copy(godot_packed_vector2_array *r_dest, const godot_packed_vector2_array *p_src) { + memnew_placement(r_dest, PackedVector2Array(*(PackedVector2Array *)p_src)); +} + void GDAPI godot_packed_vector2_array_destroy(godot_packed_vector2_array *p_self) { ((PackedVector2Array *)p_self)->~PackedVector2Array(); } @@ -199,6 +227,10 @@ void GDAPI godot_packed_vector2i_array_new(godot_packed_vector2i_array *p_self) memnew_placement(p_self, Vector<Vector2i>); } +void GDAPI godot_packed_vector2i_array_new_copy(godot_packed_vector2i_array *r_dest, const godot_packed_vector2i_array *p_src) { + memnew_placement(r_dest, Vector<Vector2i>(*(Vector<Vector2i> *)p_src)); +} + void GDAPI godot_packed_vector2i_array_destroy(godot_packed_vector2i_array *p_self) { ((Vector<Vector2i> *)p_self)->~Vector(); } @@ -219,6 +251,10 @@ void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *p_self) { memnew_placement(p_self, PackedVector3Array); } +void GDAPI godot_packed_vector3_array_new_copy(godot_packed_vector3_array *r_dest, const godot_packed_vector3_array *p_src) { + memnew_placement(r_dest, PackedVector3Array(*(PackedVector3Array *)p_src)); +} + void GDAPI godot_packed_vector3_array_destroy(godot_packed_vector3_array *p_self) { ((PackedVector3Array *)p_self)->~PackedVector3Array(); } @@ -239,6 +275,10 @@ void GDAPI godot_packed_vector3i_array_new(godot_packed_vector3i_array *p_self) memnew_placement(p_self, Vector<Vector3i>); } +void GDAPI godot_packed_vector3i_array_new_copy(godot_packed_vector3i_array *r_dest, const godot_packed_vector3i_array *p_src) { + memnew_placement(r_dest, Vector<Vector3i>(*(Vector<Vector3i> *)p_src)); +} + void GDAPI godot_packed_vector3i_array_destroy(godot_packed_vector3i_array *p_self) { ((Vector<Vector3i> *)p_self)->~Vector(); } @@ -259,6 +299,10 @@ void GDAPI godot_packed_color_array_new(godot_packed_color_array *p_self) { memnew_placement(p_self, PackedColorArray); } +void GDAPI godot_packed_color_array_new_copy(godot_packed_color_array *r_dest, const godot_packed_color_array *p_src) { + memnew_placement(r_dest, PackedColorArray(*(PackedColorArray *)p_src)); +} + void GDAPI godot_packed_color_array_destroy(godot_packed_color_array *p_self) { ((PackedColorArray *)p_self)->~PackedColorArray(); } diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp index 61d5e09fad..8b8e84e3c1 100644 --- a/modules/gdnative/gdnative/plane.cpp +++ b/modules/gdnative/gdnative/plane.cpp @@ -42,6 +42,10 @@ void GDAPI godot_plane_new(godot_plane *p_self) { memnew_placement(p_self, Plane); } +void GDAPI godot_plane_new_copy(godot_plane *r_dest, const godot_plane *p_src) { + memnew_placement(r_dest, Plane(*(Plane *)p_src)); +} + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp index 836d6390d6..8ebcf7c91f 100644 --- a/modules/gdnative/gdnative/quat.cpp +++ b/modules/gdnative/gdnative/quat.cpp @@ -42,6 +42,10 @@ void GDAPI godot_quat_new(godot_quat *p_self) { memnew_placement(p_self, Quat); } +void GDAPI godot_quat_new_copy(godot_quat *r_dest, const godot_quat *p_src) { + memnew_placement(r_dest, Quat(*(Quat *)p_src)); +} + godot_real_t GDAPI *godot_quat_operator_index(godot_quat *p_self, godot_int p_index) { Quat *self = (Quat *)p_self; return (godot_real_t *)&self->operator[](p_index); diff --git a/modules/gdnative/gdnative/rect2.cpp b/modules/gdnative/gdnative/rect2.cpp index 086592ec22..a196a63188 100644 --- a/modules/gdnative/gdnative/rect2.cpp +++ b/modules/gdnative/gdnative/rect2.cpp @@ -43,10 +43,18 @@ void GDAPI godot_rect2_new(godot_rect2 *p_self) { memnew_placement(p_self, Rect2); } +void GDAPI godot_rect2_new_copy(godot_rect2 *r_dest, const godot_rect2 *p_src) { + memnew_placement(r_dest, Rect2(*(Rect2 *)p_src)); +} + void GDAPI godot_rect2i_new(godot_rect2i *p_self) { memnew_placement(p_self, Rect2i); } +void GDAPI godot_rect2i_new_copy(godot_rect2i *r_dest, const godot_rect2i *p_src) { + memnew_placement(r_dest, Rect2i(*(Rect2i *)p_src)); +} + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/gdnative/rid.cpp b/modules/gdnative/gdnative/rid.cpp index 5cab9a21ed..f8599afcf9 100644 --- a/modules/gdnative/gdnative/rid.cpp +++ b/modules/gdnative/gdnative/rid.cpp @@ -43,6 +43,10 @@ void GDAPI godot_rid_new(godot_rid *p_self) { memnew_placement(p_self, RID); } +void GDAPI godot_rid_new_copy(godot_rid *r_dest, const godot_rid *p_src) { + memnew_placement(r_dest, RID(*(RID *)p_src)); +} + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/gdnative/signal.cpp b/modules/gdnative/gdnative/signal.cpp index bcb4c93b62..5963c0e6c6 100644 --- a/modules/gdnative/gdnative/signal.cpp +++ b/modules/gdnative/gdnative/signal.cpp @@ -43,6 +43,10 @@ void GDAPI godot_signal_new(godot_signal *p_self) { memnew_placement(p_self, Signal); } +void GDAPI godot_signal_new_copy(godot_signal *r_dest, const godot_signal *p_src) { + memnew_placement(r_dest, Signal(*(Signal *)p_src)); +} + void GDAPI godot_signal_destroy(godot_signal *p_self) { Signal *self = (Signal *)p_self; self->~Signal(); diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp index 19d95f2048..1ad1ea8bdf 100644 --- a/modules/gdnative/gdnative/string.cpp +++ b/modules/gdnative/gdnative/string.cpp @@ -45,10 +45,7 @@ void GDAPI godot_string_new(godot_string *r_dest) { } void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src) { - String *dest = (String *)r_dest; - const String *src = (const String *)p_src; - memnew_placement(dest, String); - *dest = String(*src); + memnew_placement(r_dest, String(*(String *)p_src)); } void GDAPI godot_string_new_with_latin1_chars(godot_string *r_dest, const char *p_contents) { @@ -125,6 +122,45 @@ void GDAPI godot_string_new_with_wide_chars_and_len(godot_string *r_dest, const } } +const char GDAPI *godot_string_to_latin1_chars(const godot_string *p_self) { + String *self = (String *)p_self; + return self->ascii(true).get_data(); +} + +const char GDAPI *godot_string_to_utf8_chars(const godot_string *p_self) { + String *self = (String *)p_self; + return self->utf8().get_data(); +} + +const char16_t GDAPI *godot_string_to_utf16_chars(const godot_string *p_self) { + String *self = (String *)p_self; + return self->utf16().get_data(); +} + +const char32_t GDAPI *godot_string_to_utf32_chars(const godot_string *p_self) { + String *self = (String *)p_self; + return self->get_data(); +} + +const wchar_t GDAPI *godot_string_to_wide_chars(const godot_string *p_self) { + String *self = (String *)p_self; + if (sizeof(wchar_t) == 2) { + return (const wchar_t *)self->utf16().get_data(); + } else { + return (const wchar_t *)self->get_data(); + } +} + +char32_t GDAPI *godot_string_operator_index(godot_string *p_self, godot_int p_index) { + String *self = (String *)p_self; + return self->ptrw(); +} + +const char32_t GDAPI *godot_string_operator_index_const(const godot_string *p_self, godot_int p_index) { + const String *self = (const String *)p_self; + return self->ptr(); +} + void GDAPI godot_string_destroy(godot_string *p_self) { String *self = (String *)p_self; self->~String(); diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp index c9d2dd5bc3..bd8f69674e 100644 --- a/modules/gdnative/gdnative/string_name.cpp +++ b/modules/gdnative/gdnative/string_name.cpp @@ -44,9 +44,7 @@ void GDAPI godot_string_name_new(godot_string_name *r_dest) { } void GDAPI godot_string_name_new_copy(godot_string_name *r_dest, const godot_string_name *p_src) { - StringName *dest = (StringName *)r_dest; - const StringName *src = (const StringName *)p_src; - memnew_placement(dest, StringName(*src)); + memnew_placement(r_dest, StringName(*(StringName *)p_src)); } void GDAPI godot_string_name_new_with_latin1_chars(godot_string_name *r_dest, const char *p_contents) { diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp index eae981bd07..bfaaa13db2 100644 --- a/modules/gdnative/gdnative/transform.cpp +++ b/modules/gdnative/gdnative/transform.cpp @@ -42,6 +42,10 @@ void GDAPI godot_transform_new(godot_transform *p_self) { memnew_placement(p_self, Transform); } +void GDAPI godot_transform_new_copy(godot_transform *r_dest, const godot_transform *p_src) { + memnew_placement(r_dest, Transform(*(Transform *)p_src)); +} + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/gdnative/transform2d.cpp b/modules/gdnative/gdnative/transform2d.cpp index 679174d5a5..2864818831 100644 --- a/modules/gdnative/gdnative/transform2d.cpp +++ b/modules/gdnative/gdnative/transform2d.cpp @@ -42,6 +42,10 @@ void GDAPI godot_transform2d_new(godot_transform2d *p_self) { memnew_placement(p_self, Transform2D); } +void GDAPI godot_transform2d_new_copy(godot_transform2d *r_dest, const godot_transform2d *p_src) { + memnew_placement(r_dest, Transform2D(*(Transform2D *)p_src)); +} + godot_vector2 GDAPI *godot_transform2d_operator_index(godot_transform2d *p_self, godot_int p_index) { Transform2D *self = (Transform2D *)p_self; return (godot_vector2 *)&self->operator[](p_index); diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index ee4353bb48..7801e21ab2 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -577,6 +577,54 @@ void GDAPI godot_variant_call(godot_variant *p_self, const godot_string_name *p_ } } +void GDAPI godot_variant_call_with_cstring(godot_variant *p_self, const char *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant *r_return, godot_variant_call_error *r_error) { + Variant *self = (Variant *)p_self; + const StringName method(p_method); + const Variant **args = (const Variant **)p_args; + Variant ret; + Callable::CallError error; + self->call(method, args, p_argcount, ret, error); + memnew_placement_custom(r_return, Variant, Variant(ret)); + + if (r_error) { + r_error->error = (godot_variant_call_error_error)error.error; + r_error->argument = error.argument; + r_error->expected = (godot_variant_type)error.expected; + } +} + +void GDAPI godot_variant_call_static(godot_variant_type p_type, const godot_string_name *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant *r_return, godot_variant_call_error *r_error) { + Variant::Type type = (Variant::Type)p_type; + const StringName *method = (const StringName *)p_method; + const Variant **args = (const Variant **)p_args; + Variant ret; + Callable::CallError error; + Variant::call_static(type, *method, args, p_argcount, ret, error); + memnew_placement_custom(r_return, Variant, Variant(ret)); + + if (r_error) { + r_error->error = (godot_variant_call_error_error)error.error; + r_error->argument = error.argument; + r_error->expected = (godot_variant_type)error.expected; + } +} + +void GDAPI godot_variant_call_static_with_cstring(godot_variant_type p_type, const char *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant *r_return, godot_variant_call_error *r_error) { + Variant::Type type = (Variant::Type)p_type; + const StringName method(p_method); + const Variant **args = (const Variant **)p_args; + Variant ret; + Callable::CallError error; + Variant::call_static(type, method, args, p_argcount, ret, error); + memnew_placement_custom(r_return, Variant, Variant(ret)); + + if (r_error) { + r_error->error = (godot_variant_call_error_error)error.error; + r_error->argument = error.argument; + r_error->expected = (godot_variant_type)error.expected; + } +} + void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_return, bool *r_valid) { Variant::Operator op = (Variant::Operator)p_op; const Variant *a = (const Variant *)p_a; @@ -593,12 +641,20 @@ void GDAPI godot_variant_set(godot_variant *p_self, const godot_variant *p_key, self->set(*key, *value, r_valid); } -void GDAPI godot_variant_set_named(godot_variant *p_self, const godot_string_name *p_name, const godot_variant *p_value, bool *r_valid) { +void GDAPI godot_variant_set_named(godot_variant *p_self, const godot_string_name *p_key, const godot_variant *p_value, bool *r_valid) { + Variant *self = (Variant *)p_self; + const StringName *key = (const StringName *)p_key; + const Variant *value = (const Variant *)p_value; + + self->set_named(*key, *value, *r_valid); +} + +void GDAPI godot_variant_set_named_with_cstring(godot_variant *p_self, const char *p_key, const godot_variant *p_value, bool *r_valid) { Variant *self = (Variant *)p_self; - const StringName *name = (const StringName *)p_name; + const StringName key(p_key); const Variant *value = (const Variant *)p_value; - self->set_named(*name, *value, *r_valid); + self->set_named(key, *value, *r_valid); } void GDAPI godot_variant_set_keyed(godot_variant *p_self, const godot_variant *p_key, const godot_variant *p_value, bool *r_valid) { @@ -638,6 +694,17 @@ godot_variant GDAPI godot_variant_get_named(const godot_variant *p_self, const g return result; } +godot_variant GDAPI godot_variant_get_named_with_cstring(const godot_variant *p_self, const char *p_key, bool *r_valid) { + const Variant *self = (const Variant *)p_self; + const StringName *key = (const StringName *)p_key; + Variant ret; + + ret = self->get_named(*key, *r_valid); + godot_variant result; + memnew_placement_custom(&result, Variant, Variant(ret)); + return result; +} + godot_variant GDAPI godot_variant_get_keyed(const godot_variant *p_self, const godot_variant *p_key, bool *r_valid) { const Variant *self = (const Variant *)p_self; const Variant *key = (const Variant *)p_key; @@ -824,6 +891,14 @@ bool GDAPI godot_variant_is_builtin_method_const_with_cstring(godot_variant_type return Variant::is_builtin_method_const((Variant::Type)p_type, StringName(p_method)); } +bool GDAPI godot_variant_is_builtin_method_static(godot_variant_type p_type, const godot_string_name *p_method) { + return Variant::is_builtin_method_static((Variant::Type)p_type, *((const StringName *)p_method)); +} + +bool GDAPI godot_variant_is_builtin_method_static_with_cstring(godot_variant_type p_type, const char *p_method) { + return Variant::is_builtin_method_static((Variant::Type)p_type, StringName(p_method)); +} + bool GDAPI godot_variant_is_builtin_method_vararg(godot_variant_type p_type, const godot_string_name *p_method) { return Variant::is_builtin_method_vararg((Variant::Type)p_type, *((const StringName *)p_method)); } diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp index ebb1996649..6a01a7ad59 100644 --- a/modules/gdnative/gdnative/vector2.cpp +++ b/modules/gdnative/gdnative/vector2.cpp @@ -43,10 +43,18 @@ void GDAPI godot_vector2_new(godot_vector2 *p_self) { memnew_placement(p_self, Vector2); } +void GDAPI godot_vector2_new_copy(godot_vector2 *r_dest, const godot_vector2 *p_src) { + memnew_placement(r_dest, Vector2(*(Vector2 *)p_src)); +} + void GDAPI godot_vector2i_new(godot_vector2i *p_self) { memnew_placement(p_self, Vector2i); } +void GDAPI godot_vector2i_new_copy(godot_vector2i *r_dest, const godot_vector2i *p_src) { + memnew_placement(r_dest, Vector2i(*(Vector2i *)p_src)); +} + godot_real_t GDAPI *godot_vector2_operator_index(godot_vector2 *p_self, godot_int p_index) { Vector2 *self = (Vector2 *)p_self; return (godot_real_t *)&self->operator[](p_index); diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp index 0fe1b292a7..fb426c8ac4 100644 --- a/modules/gdnative/gdnative/vector3.cpp +++ b/modules/gdnative/gdnative/vector3.cpp @@ -43,10 +43,18 @@ void GDAPI godot_vector3_new(godot_vector3 *p_self) { memnew_placement(p_self, Vector3); } +void GDAPI godot_vector3_new_copy(godot_vector3 *r_dest, const godot_vector3 *p_src) { + memnew_placement(r_dest, Vector3(*(Vector3 *)p_src)); +} + void GDAPI godot_vector3i_new(godot_vector3i *p_self) { memnew_placement(p_self, Vector3i); } +void GDAPI godot_vector3i_new_copy(godot_vector3i *r_dest, const godot_vector3i *p_src) { + memnew_placement(r_dest, Vector3i(*(Vector3i *)p_src)); +} + godot_real_t GDAPI *godot_vector3_operator_index(godot_vector3 *p_self, godot_int p_index) { Vector3 *self = (Vector3 *)p_self; return (godot_real_t *)&self->operator[](p_index); diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index c163fbbc1b..59b078f2b6 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -1143,6 +1143,36 @@ ] }, { + "name": "godot_variant_call_with_cstring", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "p_self" + ], + [ + "const char *", + "p_method" + ], + [ + "const godot_variant **", + "p_args" + ], + [ + "const godot_int", + "p_argument_count" + ], + [ + "godot_variant *", + "r_return" + ], + [ + "godot_variant_call_error *", + "r_error" + ] + ] + }, + { "name": "godot_variant_evaluate", "return_type": "void", "arguments": [ @@ -1200,7 +1230,29 @@ ], [ "const godot_string_name *", - "p_name" + "p_key" + ], + [ + "const godot_variant *", + "p_value" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_set_named_with_cstring", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "p_self" + ], + [ + "const char *", + "p_key" ], [ "const godot_variant *", @@ -1297,6 +1349,24 @@ ] }, { + "name": "godot_variant_get_named_with_cstring", + "return_type": "godot_variant", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "const char *", + "p_key" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { "name": "godot_variant_get_keyed", "return_type": "godot_variant", "arguments": [ @@ -1815,6 +1885,34 @@ ] }, { + "name": "godot_variant_is_builtin_method_static", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_is_builtin_method_static_with_cstring", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ] + ] + }, + { "name": "godot_variant_is_builtin_method_vararg", "return_type": "bool", "arguments": [ @@ -2752,6 +2850,20 @@ ] }, { + "name": "godot_aabb_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_aabb *", + "r_dest" + ], + [ + "const godot_aabb *", + "p_src" + ] + ] + }, + { "name": "godot_array_new", "return_type": "void", "arguments": [ @@ -2762,6 +2874,20 @@ ] }, { + "name": "godot_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_array *", + "r_dest" + ], + [ + "const godot_array *", + "p_src" + ] + ] + }, + { "name": "godot_array_destroy", "return_type": "void", "arguments": [ @@ -2810,6 +2936,20 @@ ] }, { + "name": "godot_basis_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_basis *", + "r_dest" + ], + [ + "const godot_basis *", + "p_src" + ] + ] + }, + { "name": "godot_basis_operator_index", "return_type": "godot_vector3 *", "arguments": [ @@ -2848,6 +2988,20 @@ ] }, { + "name": "godot_callable_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_callable *", + "r_dest" + ], + [ + "const godot_callable *", + "p_src" + ] + ] + }, + { "name": "godot_callable_destroy", "return_type": "void", "arguments": [ @@ -2868,6 +3022,20 @@ ] }, { + "name": "godot_color_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_color *", + "r_dest" + ], + [ + "const godot_color *", + "p_src" + ] + ] + }, + { "name": "godot_color_operator_index", "return_type": "float *", "arguments": [ @@ -2906,6 +3074,20 @@ ] }, { + "name": "godot_dictionary_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_dictionary *", + "r_dest" + ], + [ + "const godot_dictionary *", + "p_src" + ] + ] + }, + { "name": "godot_dictionary_destroy", "return_type": "void", "arguments": [ @@ -2954,6 +3136,20 @@ ] }, { + "name": "godot_node_path_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_node_path *", + "r_dest" + ], + [ + "const godot_node_path *", + "p_src" + ] + ] + }, + { "name": "godot_node_path_destroy", "return_type": "void", "arguments": [ @@ -2974,6 +3170,20 @@ ] }, { + "name": "godot_packed_byte_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_byte_array *", + "r_dest" + ], + [ + "const godot_packed_byte_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_byte_array_destroy", "return_type": "void", "arguments": [ @@ -3022,6 +3232,20 @@ ] }, { + "name": "godot_packed_int32_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_int32_array *", + "r_dest" + ], + [ + "const godot_packed_int32_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_int32_array_destroy", "return_type": "void", "arguments": [ @@ -3070,6 +3294,20 @@ ] }, { + "name": "godot_packed_int64_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_int64_array *", + "r_dest" + ], + [ + "const godot_packed_int64_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_int64_array_destroy", "return_type": "void", "arguments": [ @@ -3118,6 +3356,20 @@ ] }, { + "name": "godot_packed_float32_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_float32_array *", + "r_dest" + ], + [ + "const godot_packed_float32_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_float32_array_destroy", "return_type": "void", "arguments": [ @@ -3166,6 +3418,20 @@ ] }, { + "name": "godot_packed_float64_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_float64_array *", + "r_dest" + ], + [ + "const godot_packed_float64_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_float64_array_destroy", "return_type": "void", "arguments": [ @@ -3214,6 +3480,20 @@ ] }, { + "name": "godot_packed_string_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_string_array *", + "r_dest" + ], + [ + "const godot_packed_string_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_string_array_destroy", "return_type": "void", "arguments": [ @@ -3262,6 +3542,20 @@ ] }, { + "name": "godot_packed_vector2_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector2_array *", + "r_dest" + ], + [ + "const godot_packed_vector2_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_vector2_array_destroy", "return_type": "void", "arguments": [ @@ -3310,6 +3604,20 @@ ] }, { + "name": "godot_packed_vector2i_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector2i_array *", + "r_dest" + ], + [ + "const godot_packed_vector2i_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_vector2i_array_destroy", "return_type": "void", "arguments": [ @@ -3358,6 +3666,20 @@ ] }, { + "name": "godot_packed_vector3_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector3_array *", + "r_dest" + ], + [ + "const godot_packed_vector3_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_vector3_array_destroy", "return_type": "void", "arguments": [ @@ -3406,6 +3728,20 @@ ] }, { + "name": "godot_packed_vector3i_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector3i_array *", + "r_dest" + ], + [ + "const godot_packed_vector3i_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_vector3i_array_destroy", "return_type": "void", "arguments": [ @@ -3454,6 +3790,20 @@ ] }, { + "name": "godot_packed_color_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_color_array *", + "r_dest" + ], + [ + "const godot_packed_color_array *", + "p_src" + ] + ] + }, + { "name": "godot_packed_color_array_destroy", "return_type": "void", "arguments": [ @@ -3502,6 +3852,20 @@ ] }, { + "name": "godot_plane_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_plane *", + "r_dest" + ], + [ + "const godot_plane *", + "p_src" + ] + ] + }, + { "name": "godot_quat_new", "return_type": "void", "arguments": [ @@ -3512,6 +3876,20 @@ ] }, { + "name": "godot_quat_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_quat *", + "r_dest" + ], + [ + "const godot_quat *", + "p_src" + ] + ] + }, + { "name": "godot_quat_operator_index", "return_type": "godot_real_t *", "arguments": [ @@ -3550,6 +3928,20 @@ ] }, { + "name": "godot_rect2_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_rect2 *", + "r_dest" + ], + [ + "const godot_rect2 *", + "p_src" + ] + ] + }, + { "name": "godot_rect2i_new", "return_type": "void", "arguments": [ @@ -3560,6 +3952,20 @@ ] }, { + "name": "godot_rect2i_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_rect2i *", + "r_dest" + ], + [ + "const godot_rect2i *", + "p_src" + ] + ] + }, + { "name": "godot_rid_new", "return_type": "void", "arguments": [ @@ -3570,6 +3976,20 @@ ] }, { + "name": "godot_rid_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_rid *", + "r_dest" + ], + [ + "const godot_rid *", + "p_src" + ] + ] + }, + { "name": "godot_signal_new", "return_type": "void", "arguments": [ @@ -3580,6 +4000,20 @@ ] }, { + "name": "godot_signal_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_signal *", + "r_dest" + ], + [ + "const godot_signal *", + "p_src" + ] + ] + }, + { "name": "godot_signal_destroy", "return_type": "void", "arguments": [ @@ -3784,6 +4218,84 @@ ] }, { + "name": "godot_string_to_latin1_chars", + "return_type": "const char *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_to_utf8_chars", + "return_type": "const char *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_to_utf16_chars", + "return_type": "const char16_t *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_to_utf32_chars", + "return_type": "const char32_t *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_to_wide_chars", + "return_type": "const wchar_t *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_operator_index", + "return_type": "char32_t *", + "arguments": [ + [ + "godot_string *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_string_operator_index_const", + "return_type": "const char32_t *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { "name": "godot_string_name_new", "return_type": "void", "arguments": [ @@ -3842,6 +4354,20 @@ ] }, { + "name": "godot_transform_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_transform *", + "r_dest" + ], + [ + "const godot_transform *", + "p_src" + ] + ] + }, + { "name": "godot_transform2d_new", "return_type": "void", "arguments": [ @@ -3852,6 +4378,20 @@ ] }, { + "name": "godot_transform2d_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_transform2d *", + "r_dest" + ], + [ + "const godot_transform2d *", + "p_src" + ] + ] + }, + { "name": "godot_transform2d_operator_index", "return_type": "godot_vector2 *", "arguments": [ @@ -3890,6 +4430,20 @@ ] }, { + "name": "godot_vector2_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_vector2 *", + "r_dest" + ], + [ + "const godot_vector2 *", + "p_src" + ] + ] + }, + { "name": "godot_vector2_operator_index", "return_type": "godot_real_t *", "arguments": [ @@ -3928,6 +4482,20 @@ ] }, { + "name": "godot_vector2i_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_vector2i *", + "r_dest" + ], + [ + "const godot_vector2i *", + "p_src" + ] + ] + }, + { "name": "godot_vector2i_operator_index", "return_type": "int32_t *", "arguments": [ @@ -3966,6 +4534,20 @@ ] }, { + "name": "godot_vector3_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_vector3 *", + "r_dest" + ], + [ + "const godot_vector3 *", + "p_src" + ] + ] + }, + { "name": "godot_vector3_operator_index", "return_type": "godot_real_t *", "arguments": [ @@ -4004,6 +4586,20 @@ ] }, { + "name": "godot_vector3i_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_vector3i *", + "r_dest" + ], + [ + "const godot_vector3i *", + "p_src" + ] + ] + }, + { "name": "godot_vector3i_operator_index", "return_type": "int32_t *", "arguments": [ diff --git a/modules/gdnative/include/gdnative/aabb.h b/modules/gdnative/include/gdnative/aabb.h index be0235221f..860675065d 100644 --- a/modules/gdnative/include/gdnative/aabb.h +++ b/modules/gdnative/include/gdnative/aabb.h @@ -49,6 +49,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_aabb_new(godot_aabb *p_self); +void GDAPI godot_aabb_new_copy(godot_aabb *r_dest, const godot_aabb *p_src); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/array.h b/modules/gdnative/include/gdnative/array.h index 7603edaa73..bf4b852449 100644 --- a/modules/gdnative/include/gdnative/array.h +++ b/modules/gdnative/include/gdnative/array.h @@ -50,6 +50,7 @@ typedef struct { #include <gdnative/variant_struct.h> void GDAPI godot_array_new(godot_array *p_self); +void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src); void GDAPI godot_array_destroy(godot_array *p_self); godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, godot_int p_index); const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, godot_int p_index); diff --git a/modules/gdnative/include/gdnative/basis.h b/modules/gdnative/include/gdnative/basis.h index af8d7cbdd3..5477dbf811 100644 --- a/modules/gdnative/include/gdnative/basis.h +++ b/modules/gdnative/include/gdnative/basis.h @@ -49,6 +49,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_basis_new(godot_basis *p_self); +void GDAPI godot_basis_new_copy(godot_basis *r_dest, const godot_basis *p_src); godot_vector3 GDAPI *godot_basis_operator_index(godot_basis *p_self, godot_int p_index); const godot_vector3 GDAPI *godot_basis_operator_index_const(const godot_basis *p_self, godot_int p_index); diff --git a/modules/gdnative/include/gdnative/callable.h b/modules/gdnative/include/gdnative/callable.h index 6f359ada5e..b84b0c1f1f 100644 --- a/modules/gdnative/include/gdnative/callable.h +++ b/modules/gdnative/include/gdnative/callable.h @@ -49,6 +49,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_callable_new(godot_callable *p_self); +void GDAPI godot_callable_new_copy(godot_callable *r_dest, const godot_callable *p_src); void GDAPI godot_callable_destroy(godot_callable *p_self); #ifdef __cplusplus diff --git a/modules/gdnative/include/gdnative/color.h b/modules/gdnative/include/gdnative/color.h index 17a021e6ea..3334013147 100644 --- a/modules/gdnative/include/gdnative/color.h +++ b/modules/gdnative/include/gdnative/color.h @@ -50,6 +50,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_color_new(godot_color *p_self); +void GDAPI godot_color_new_copy(godot_color *r_dest, const godot_color *p_src); float GDAPI *godot_color_operator_index(godot_color *p_self, godot_int p_index); const float GDAPI *godot_color_operator_index_const(const godot_color *p_self, godot_int p_index); diff --git a/modules/gdnative/include/gdnative/dictionary.h b/modules/gdnative/include/gdnative/dictionary.h index d2afbc4c94..b9525fb5e6 100644 --- a/modules/gdnative/include/gdnative/dictionary.h +++ b/modules/gdnative/include/gdnative/dictionary.h @@ -50,6 +50,7 @@ typedef struct { #include <gdnative/variant_struct.h> void GDAPI godot_dictionary_new(godot_dictionary *p_self); +void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src); void GDAPI godot_dictionary_destroy(godot_dictionary *p_self); godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key); const godot_variant GDAPI *godot_dictionary_operator_index_const(const godot_dictionary *p_self, const godot_variant *p_key); diff --git a/modules/gdnative/include/gdnative/node_path.h b/modules/gdnative/include/gdnative/node_path.h index 3c31b9a98f..a4607c0152 100644 --- a/modules/gdnative/include/gdnative/node_path.h +++ b/modules/gdnative/include/gdnative/node_path.h @@ -49,6 +49,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_node_path_new(godot_node_path *p_self); +void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src); void GDAPI godot_node_path_destroy(godot_node_path *p_self); #ifdef __cplusplus diff --git a/modules/gdnative/include/gdnative/packed_arrays.h b/modules/gdnative/include/gdnative/packed_arrays.h index 621ed60cdf..f9e4ba3a8d 100644 --- a/modules/gdnative/include/gdnative/packed_arrays.h +++ b/modules/gdnative/include/gdnative/packed_arrays.h @@ -163,6 +163,7 @@ typedef struct { // Byte. void GDAPI godot_packed_byte_array_new(godot_packed_byte_array *p_self); +void GDAPI godot_packed_byte_array_new_copy(godot_packed_byte_array *r_dest, const godot_packed_byte_array *p_src); void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self); uint8_t GDAPI *godot_packed_byte_array_operator_index(godot_packed_byte_array *p_self, godot_int p_index); const uint8_t GDAPI *godot_packed_byte_array_operator_index_const(const godot_packed_byte_array *p_self, godot_int p_index); @@ -170,6 +171,7 @@ const uint8_t GDAPI *godot_packed_byte_array_operator_index_const(const godot_pa // Int32. void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *p_self); +void GDAPI godot_packed_int32_array_new_copy(godot_packed_int32_array *r_dest, const godot_packed_int32_array *p_src); void GDAPI godot_packed_int32_array_destroy(godot_packed_int32_array *p_self); int32_t GDAPI *godot_packed_int32_array_operator_index(godot_packed_int32_array *p_self, godot_int p_index); const int32_t GDAPI *godot_packed_int32_array_operator_index_const(const godot_packed_int32_array *p_self, godot_int p_index); @@ -177,6 +179,7 @@ const int32_t GDAPI *godot_packed_int32_array_operator_index_const(const godot_p // Int64. void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *p_self); +void GDAPI godot_packed_int64_array_new_copy(godot_packed_int64_array *r_dest, const godot_packed_int64_array *p_src); void GDAPI godot_packed_int64_array_destroy(godot_packed_int64_array *p_self); int64_t GDAPI *godot_packed_int64_array_operator_index(godot_packed_int64_array *p_self, godot_int p_index); const int64_t GDAPI *godot_packed_int64_array_operator_index_const(const godot_packed_int64_array *p_self, godot_int p_index); @@ -184,6 +187,7 @@ const int64_t GDAPI *godot_packed_int64_array_operator_index_const(const godot_p // Float32. void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *p_self); +void GDAPI godot_packed_float32_array_new_copy(godot_packed_float32_array *r_dest, const godot_packed_float32_array *p_src); void GDAPI godot_packed_float32_array_destroy(godot_packed_float32_array *p_self); float GDAPI *godot_packed_float32_array_operator_index(godot_packed_float32_array *p_self, godot_int p_index); const float GDAPI *godot_packed_float32_array_operator_index_const(const godot_packed_float32_array *p_self, godot_int p_index); @@ -191,6 +195,7 @@ const float GDAPI *godot_packed_float32_array_operator_index_const(const godot_p // Float64. void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *p_self); +void GDAPI godot_packed_float64_array_new_copy(godot_packed_float64_array *r_dest, const godot_packed_float64_array *p_src); void GDAPI godot_packed_float64_array_destroy(godot_packed_float64_array *p_self); double GDAPI *godot_packed_float64_array_operator_index(godot_packed_float64_array *p_self, godot_int p_index); const double GDAPI *godot_packed_float64_array_operator_index_const(const godot_packed_float64_array *p_self, godot_int p_index); @@ -198,6 +203,7 @@ const double GDAPI *godot_packed_float64_array_operator_index_const(const godot_ // String. void GDAPI godot_packed_string_array_new(godot_packed_string_array *p_self); +void GDAPI godot_packed_string_array_new_copy(godot_packed_string_array *r_dest, const godot_packed_string_array *p_src); void GDAPI godot_packed_string_array_destroy(godot_packed_string_array *p_self); godot_string GDAPI *godot_packed_string_array_operator_index(godot_packed_string_array *p_self, godot_int p_index); const godot_string GDAPI *godot_packed_string_array_operator_index_const(const godot_packed_string_array *p_self, godot_int p_index); @@ -205,6 +211,7 @@ const godot_string GDAPI *godot_packed_string_array_operator_index_const(const g // Vector2. void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *p_self); +void GDAPI godot_packed_vector2_array_new_copy(godot_packed_vector2_array *r_dest, const godot_packed_vector2_array *p_src); void GDAPI godot_packed_vector2_array_destroy(godot_packed_vector2_array *p_self); godot_vector2 GDAPI *godot_packed_vector2_array_operator_index(godot_packed_vector2_array *p_self, godot_int p_index); const godot_vector2 GDAPI *godot_packed_vector2_array_operator_index_const(const godot_packed_vector2_array *p_self, godot_int p_index); @@ -212,6 +219,7 @@ const godot_vector2 GDAPI *godot_packed_vector2_array_operator_index_const(const // Vector2i. void GDAPI godot_packed_vector2i_array_new(godot_packed_vector2i_array *p_self); +void GDAPI godot_packed_vector2i_array_new_copy(godot_packed_vector2i_array *r_dest, const godot_packed_vector2i_array *p_src); void GDAPI godot_packed_vector2i_array_destroy(godot_packed_vector2i_array *p_self); godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index(godot_packed_vector2i_array *p_self, godot_int p_index); const godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index_const(const godot_packed_vector2i_array *p_self, godot_int p_index); @@ -219,6 +227,7 @@ const godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index_const(con // Vector3. void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *p_self); +void GDAPI godot_packed_vector3_array_new_copy(godot_packed_vector3_array *r_dest, const godot_packed_vector3_array *p_src); void GDAPI godot_packed_vector3_array_destroy(godot_packed_vector3_array *p_self); godot_vector3 GDAPI *godot_packed_vector3_array_operator_index(godot_packed_vector3_array *p_self, godot_int p_index); const godot_vector3 GDAPI *godot_packed_vector3_array_operator_index_const(const godot_packed_vector3_array *p_self, godot_int p_index); @@ -226,6 +235,7 @@ const godot_vector3 GDAPI *godot_packed_vector3_array_operator_index_const(const // Vector3i. void GDAPI godot_packed_vector3i_array_new(godot_packed_vector3i_array *p_self); +void GDAPI godot_packed_vector3i_array_new_copy(godot_packed_vector3i_array *r_dest, const godot_packed_vector3i_array *p_src); void GDAPI godot_packed_vector3i_array_destroy(godot_packed_vector3i_array *p_self); godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index(godot_packed_vector3i_array *p_self, godot_int p_index); const godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index_const(const godot_packed_vector3i_array *p_self, godot_int p_index); @@ -233,6 +243,7 @@ const godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index_const(con // Color. void GDAPI godot_packed_color_array_new(godot_packed_color_array *p_self); +void GDAPI godot_packed_color_array_new_copy(godot_packed_color_array *r_dest, const godot_packed_color_array *p_src); void GDAPI godot_packed_color_array_destroy(godot_packed_color_array *p_self); godot_color GDAPI *godot_packed_color_array_operator_index(godot_packed_color_array *p_self, godot_int p_index); const godot_color GDAPI *godot_packed_color_array_operator_index_const(const godot_packed_color_array *p_self, godot_int p_index); diff --git a/modules/gdnative/include/gdnative/plane.h b/modules/gdnative/include/gdnative/plane.h index ed10955e5f..6cd0ed6307 100644 --- a/modules/gdnative/include/gdnative/plane.h +++ b/modules/gdnative/include/gdnative/plane.h @@ -49,6 +49,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_plane_new(godot_plane *p_self); +void GDAPI godot_plane_new_copy(godot_plane *r_dest, const godot_plane *p_src); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/quat.h b/modules/gdnative/include/gdnative/quat.h index 69bf427611..00abdb4404 100644 --- a/modules/gdnative/include/gdnative/quat.h +++ b/modules/gdnative/include/gdnative/quat.h @@ -49,6 +49,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_quat_new(godot_quat *p_self); +void GDAPI godot_quat_new_copy(godot_quat *r_dest, const godot_quat *p_src); godot_real_t GDAPI *godot_quat_operator_index(godot_quat *p_self, godot_int p_index); const godot_real_t GDAPI *godot_quat_operator_index_const(const godot_quat *p_self, godot_int p_index); diff --git a/modules/gdnative/include/gdnative/rect2.h b/modules/gdnative/include/gdnative/rect2.h index 9e51254cfe..326462be43 100644 --- a/modules/gdnative/include/gdnative/rect2.h +++ b/modules/gdnative/include/gdnative/rect2.h @@ -58,7 +58,9 @@ typedef struct godot_rect2i { #include <gdnative/gdnative.h> void GDAPI godot_rect2_new(godot_rect2 *p_self); +void GDAPI godot_rect2_new_copy(godot_rect2 *r_dest, const godot_rect2 *p_src); void GDAPI godot_rect2i_new(godot_rect2i *p_self); +void GDAPI godot_rect2i_new_copy(godot_rect2i *r_dest, const godot_rect2i *p_src); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/rid.h b/modules/gdnative/include/gdnative/rid.h index 7ea8cfd174..bc832fbeb9 100644 --- a/modules/gdnative/include/gdnative/rid.h +++ b/modules/gdnative/include/gdnative/rid.h @@ -49,6 +49,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_rid_new(godot_rid *p_self); +void GDAPI godot_rid_new_copy(godot_rid *r_dest, const godot_rid *p_src); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/signal.h b/modules/gdnative/include/gdnative/signal.h index ad84542677..f4dc17e089 100644 --- a/modules/gdnative/include/gdnative/signal.h +++ b/modules/gdnative/include/gdnative/signal.h @@ -49,6 +49,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_signal_new(godot_signal *p_self); +void GDAPI godot_signal_new_copy(godot_signal *r_dest, const godot_signal *p_src); void GDAPI godot_signal_destroy(godot_signal *p_self); #ifdef __cplusplus diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h index 10fbb2c078..79de52c80f 100644 --- a/modules/gdnative/include/gdnative/string.h +++ b/modules/gdnative/include/gdnative/string.h @@ -55,6 +55,7 @@ typedef struct { #endif #include <gdnative/gdnative.h> +#include <gdnative/math_defs.h> void GDAPI godot_string_new(godot_string *r_dest); void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src); @@ -72,6 +73,15 @@ void GDAPI godot_string_new_with_utf16_chars_and_len(godot_string *r_dest, const void GDAPI godot_string_new_with_utf32_chars_and_len(godot_string *r_dest, const char32_t *p_contents, const int p_size); void GDAPI godot_string_new_with_wide_chars_and_len(godot_string *r_dest, const wchar_t *p_contents, const int p_size); +const char GDAPI *godot_string_to_latin1_chars(const godot_string *p_self); +const char GDAPI *godot_string_to_utf8_chars(const godot_string *p_self); +const char16_t GDAPI *godot_string_to_utf16_chars(const godot_string *p_self); +const char32_t GDAPI *godot_string_to_utf32_chars(const godot_string *p_self); +const wchar_t GDAPI *godot_string_to_wide_chars(const godot_string *p_self); + +char32_t GDAPI *godot_string_operator_index(godot_string *p_self, godot_int p_index); +const char32_t GDAPI *godot_string_operator_index_const(const godot_string *p_self, godot_int p_index); + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h index e67862d140..3861b5683a 100644 --- a/modules/gdnative/include/gdnative/transform.h +++ b/modules/gdnative/include/gdnative/transform.h @@ -49,6 +49,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_transform_new(godot_transform *p_self); +void GDAPI godot_transform_new_copy(godot_transform *r_dest, const godot_transform *p_src); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/transform2d.h b/modules/gdnative/include/gdnative/transform2d.h index 4a2bca7cfc..5acb172081 100644 --- a/modules/gdnative/include/gdnative/transform2d.h +++ b/modules/gdnative/include/gdnative/transform2d.h @@ -49,6 +49,7 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_transform2d_new(godot_transform2d *p_self); +void GDAPI godot_transform2d_new_copy(godot_transform2d *r_dest, const godot_transform2d *p_src); godot_vector2 GDAPI *godot_transform2d_operator_index(godot_transform2d *p_self, godot_int p_index); const godot_vector2 GDAPI *godot_transform2d_operator_index_const(const godot_transform2d *p_self, godot_int p_index); diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h index 329a6faf51..3e06ed9aa4 100644 --- a/modules/gdnative/include/gdnative/variant.h +++ b/modules/gdnative/include/gdnative/variant.h @@ -272,6 +272,8 @@ void GDAPI godot_variant_destroy(godot_variant *p_self); void GDAPI godot_variant_call(godot_variant *p_self, const godot_string_name *p_method, const godot_variant **p_args, const godot_int p_argument_count, godot_variant *r_return, godot_variant_call_error *r_error); void GDAPI godot_variant_call_with_cstring(godot_variant *p_self, const char *p_method, const godot_variant **p_args, const godot_int p_argument_count, godot_variant *r_return, godot_variant_call_error *r_error); +void GDAPI godot_variant_call_static(godot_variant_type p_type, const godot_string_name *p_method, const godot_variant **p_args, const godot_int p_argument_count, godot_variant *r_return, godot_variant_call_error *r_error); +void GDAPI godot_variant_call_static_with_cstring(godot_variant_type p_type, const char *p_method, const godot_variant **p_args, const godot_int p_argument_count, godot_variant *r_return, godot_variant_call_error *r_error); void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_return, bool *r_valid); void GDAPI godot_variant_set(godot_variant *p_self, const godot_variant *p_key, const godot_variant *p_value, bool *r_valid); void GDAPI godot_variant_set_named(godot_variant *p_self, const godot_string_name *p_name, const godot_variant *p_value, bool *r_valid); @@ -323,6 +325,8 @@ godot_variant_type GDAPI godot_variant_get_builtin_method_return_type(godot_vari godot_variant_type GDAPI godot_variant_get_builtin_method_return_type_with_cstring(godot_variant_type p_type, const char *p_method); bool GDAPI godot_variant_is_builtin_method_const(godot_variant_type p_type, const godot_string_name *p_method); bool GDAPI godot_variant_is_builtin_method_const_with_cstring(godot_variant_type p_type, const char *p_method); +bool GDAPI godot_variant_is_builtin_method_static(godot_variant_type p_type, const godot_string_name *p_method); +bool GDAPI godot_variant_is_builtin_method_static_with_cstring(godot_variant_type p_type, const char *p_method); bool GDAPI godot_variant_is_builtin_method_vararg(godot_variant_type p_type, const godot_string_name *p_method); bool GDAPI godot_variant_is_builtin_method_vararg_with_cstring(godot_variant_type p_type, const char *p_method); int GDAPI godot_variant_get_builtin_method_count(godot_variant_type p_type); diff --git a/modules/gdnative/include/gdnative/vector2.h b/modules/gdnative/include/gdnative/vector2.h index 5ebb705ba4..00faffbad7 100644 --- a/modules/gdnative/include/gdnative/vector2.h +++ b/modules/gdnative/include/gdnative/vector2.h @@ -58,7 +58,9 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_vector2_new(godot_vector2 *p_self); +void GDAPI godot_vector2_new_copy(godot_vector2 *r_dest, const godot_vector2 *p_src); void GDAPI godot_vector2i_new(godot_vector2i *p_self); +void GDAPI godot_vector2i_new_copy(godot_vector2i *r_dest, const godot_vector2i *p_src); godot_real_t GDAPI *godot_vector2_operator_index(godot_vector2 *p_self, godot_int p_index); const godot_real_t GDAPI *godot_vector2_operator_index_const(const godot_vector2 *p_self, godot_int p_index); int32_t GDAPI *godot_vector2i_operator_index(godot_vector2i *p_self, godot_int p_index); diff --git a/modules/gdnative/include/gdnative/vector3.h b/modules/gdnative/include/gdnative/vector3.h index d37ebd3cc9..7db093ce52 100644 --- a/modules/gdnative/include/gdnative/vector3.h +++ b/modules/gdnative/include/gdnative/vector3.h @@ -58,7 +58,9 @@ typedef struct { #include <gdnative/gdnative.h> void GDAPI godot_vector3_new(godot_vector3 *p_self); +void GDAPI godot_vector3_new_copy(godot_vector3 *r_dest, const godot_vector3 *p_src); void GDAPI godot_vector3i_new(godot_vector3i *p_self); +void GDAPI godot_vector3i_new_copy(godot_vector3i *r_dest, const godot_vector3i *p_src); godot_real_t GDAPI *godot_vector3_operator_index(godot_vector3 *p_self, godot_int p_index); const godot_real_t GDAPI *godot_vector3_operator_index_const(const godot_vector3 *p_self, godot_int p_index); int32_t GDAPI *godot_vector3i_operator_index(godot_vector3i *p_self, godot_int p_index); diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index 3e75478cd8..f184c84615 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -71,6 +71,7 @@ struct MethodAPI { bool is_editor = false; bool is_noscript = false; bool is_const = false; + bool is_static = false; // For builtin types. bool is_reverse = false; bool is_virtual = false; bool is_from_script = false; @@ -528,6 +529,7 @@ List<ClassAPI> generate_c_builtin_api_types() { method_api.argument_count = Variant::get_builtin_method_argument_count(type, method_name); method_api.has_varargs = Variant::is_builtin_method_vararg(type, method_name); method_api.is_const = Variant::is_builtin_method_const(type, method_name); + method_api.is_static = Variant::is_builtin_method_static(type, method_name); for (int i = 0; i < method_api.argument_count; i++) { method_api.argument_names.push_back(Variant::get_builtin_method_argument_name(type, method_name, i)); @@ -757,6 +759,7 @@ static void write_builtin_method(StringBuilder &p_source, const MethodAPI &p_met append_indented(p_source, vformat(R"("name": "%s",)", p_method.method_name)); append_indented(p_source, vformat(R"("return_type": "%s",)", p_method.return_type)); append_indented(p_source, vformat(R"("is_const": %s,)", p_method.is_const ? "true" : "false")); + append_indented(p_source, vformat(R"("is_static": %s,)", p_method.is_static ? "true" : "false")); append_indented(p_source, vformat(R"("has_varargs": %s,)", p_method.has_varargs ? "true" : "false")); append_indented(p_source, R"("arguments": [)"); diff --git a/platform/android/java/app/assets/.gitignore b/platform/android/java/app/assets/.gitignore new file mode 100644 index 0000000000..d6b7ef32c8 --- /dev/null +++ b/platform/android/java/app/assets/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/platform/android/java/app/build.gradle b/platform/android/java/app/build.gradle index 934c4bf441..f103f22db2 100644 --- a/platform/android/java/app/build.gradle +++ b/platform/android/java/app/build.gradle @@ -77,7 +77,7 @@ android { defaultConfig { // The default ignore pattern for the 'assets' directory includes hidden files and directories which are used by Godot projects. aaptOptions { - ignoreAssetsPattern "!.svn:!.git:!.ds_store:!*.scc:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~" + ignoreAssetsPattern "!.svn:!.git:!.gitignore:!.ds_store:!*.scc:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~" } ndk { @@ -106,8 +106,10 @@ android { exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' - // Should be uncommented for development purpose within Android Studio - // doNotStrip '**/*.so' + // 'doNotStrip' is enabled for development within Android Studio + if (shouldNotStrip()) { + doNotStrip '**/*.so' + } } signingConfigs { diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle index 585e517631..c0ae4007d2 100644 --- a/platform/android/java/app/config.gradle +++ b/platform/android/java/app/config.gradle @@ -209,10 +209,19 @@ ext.getReleaseKeyAlias = { -> return keyAlias } +ext.isAndroidStudio = { -> + def sysProps = System.getProperties() + return sysProps != null && sysProps['idea.platform.prefix'] != null +} + ext.shouldZipAlign = { -> String zipAlignFlag = project.hasProperty("perform_zipalign") ? project.property("perform_zipalign") : "" if (zipAlignFlag == null || zipAlignFlag.isEmpty()) { - zipAlignFlag = "false" + if (isAndroidStudio()) { + zipAlignFlag = "true" + } else { + zipAlignFlag = "false" + } } return Boolean.parseBoolean(zipAlignFlag) } @@ -220,7 +229,15 @@ ext.shouldZipAlign = { -> ext.shouldSign = { -> String signFlag = project.hasProperty("perform_signing") ? project.property("perform_signing") : "" if (signFlag == null || signFlag.isEmpty()) { - signFlag = "false" + if (isAndroidStudio()) { + signFlag = "true" + } else { + signFlag = "false" + } } return Boolean.parseBoolean(signFlag) } + +ext.shouldNotStrip = { -> + return isAndroidStudio() +} diff --git a/platform/android/java/lib/build.gradle b/platform/android/java/lib/build.gradle index 6fc9a11a08..663ba73d40 100644 --- a/platform/android/java/lib/build.gradle +++ b/platform/android/java/lib/build.gradle @@ -36,8 +36,10 @@ android { exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' - // Should be uncommented for development purpose within Android Studio - // doNotStrip '**/*.so' + // 'doNotStrip' is enabled for development within Android Studio + if (shouldNotStrip()) { + doNotStrip '**/*.so' + } } sourceSets { diff --git a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java index b966cda846..ec2ace4821 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java +++ b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java @@ -34,6 +34,7 @@ import android.content.Intent; import android.os.Bundle; import android.view.KeyEvent; +import androidx.annotation.CallSuper; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.FragmentActivity; @@ -69,6 +70,26 @@ public abstract class FullScreenGodotApp extends FragmentActivity implements God } } + @CallSuper + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (godotFragment != null) { + godotFragment.onActivityResult(requestCode, resultCode, data); + } else { + super.onActivityResult(requestCode, resultCode, data); + } + } + + @CallSuper + @Override + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + if (godotFragment != null) { + godotFragment.onRequestPermissionsResult(requestCode, permissions, grantResults); + } else { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + } + } + @Override public void onBackPressed() { if (godotFragment != null) { diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index 6da47bb0fe..c601864880 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -195,8 +195,10 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC godotHost = null; } + @CallSuper @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); if (result_callback != null) { result_callback.callback(requestCode, resultCode, data); result_callback = null; @@ -207,8 +209,10 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC } } + @CallSuper @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); for (GodotPlugin plugin : pluginRegistry.getAllPlugins()) { plugin.onMainRequestPermissionsResult(requestCode, permissions, grantResults); } diff --git a/platform/android/java/nativeSrcsConfigs/build.gradle b/platform/android/java/nativeSrcsConfigs/build.gradle index 66077060ea..158bb2b98e 100644 --- a/platform/android/java/nativeSrcsConfigs/build.gradle +++ b/platform/android/java/nativeSrcsConfigs/build.gradle @@ -20,9 +20,6 @@ android { packagingOptions { exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' - - // Should be uncommented for development purpose within Android Studio - // doNotStrip '**/*.so' } sourceSets { diff --git a/platform/iphone/godot_view.mm b/platform/iphone/godot_view.mm index 887297848e..468fa2928a 100644 --- a/platform/iphone/godot_view.mm +++ b/platform/iphone/godot_view.mm @@ -39,6 +39,7 @@ #import <CoreMotion/CoreMotion.h> static const int max_touches = 8; +static const float earth_gravity = 9.80665; @interface GodotView () { UITouch *godot_touches[max_touches]; @@ -402,10 +403,19 @@ static const int max_touches = 8; // https://developer.apple.com/reference/coremotion/cmmotionmanager?language=objc // Apple splits our accelerometer date into a gravity and user movement - // component. We add them back together + // component. We add them back together. CMAcceleration gravity = self.motionManager.deviceMotion.gravity; CMAcceleration acceleration = self.motionManager.deviceMotion.userAcceleration; + // To be consistent with Android we convert the unit of measurement from g (Earth's gravity) + // to m/s^2. + gravity.x *= earth_gravity; + gravity.y *= earth_gravity; + gravity.z *= earth_gravity; + acceleration.x *= earth_gravity; + acceleration.y *= earth_gravity; + acceleration.z *= earth_gravity; + ///@TODO We don't seem to be getting data here, is my device broken or /// is this code incorrect? CMMagneticField magnetic = self.motionManager.deviceMotion.magneticField.field; diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index fa97948395..33992069f9 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -62,6 +62,8 @@ using namespace Windows::Devices::Sensors; using namespace Windows::ApplicationModel::DataTransfer; using namespace concurrency; +static const float earth_gravity = 9.80665; + int OS_UWP::get_video_driver_count() const { return 2; } @@ -372,9 +374,9 @@ void OS_UWP::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ sende AccelerometerReading ^ reading = args->Reading; os->input->set_accelerometer(Vector3( - reading->AccelerationX, - reading->AccelerationY, - reading->AccelerationZ)); + reading->AccelerationX * earth_gravity, + reading->AccelerationY * earth_gravity, + reading->AccelerationZ * earth_gravity)); } void OS_UWP::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender, MagnetometerReadingChangedEventArgs ^ args) { diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 359044a576..dfc08583f2 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -382,6 +382,7 @@ bool AnimatedSprite2D::_is_playing() const { } void AnimatedSprite2D::play(const StringName &p_animation, const bool p_backwards) { + ERR_FAIL_NULL_MSG(frames, "Can't play AnimatedSprite2D without a valid SpriteFrames resource."); backwards = p_backwards; if (p_animation) { diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp index 849ef7a2bf..39880db29c 100644 --- a/scene/3d/collision_object_3d.cpp +++ b/scene/3d/collision_object_3d.cpp @@ -30,6 +30,7 @@ #include "collision_object_3d.h" +#include "core/config/engine.h" #include "mesh_instance_3d.h" #include "scene/scene_string_names.h" #include "servers/physics_server_3d.h" @@ -139,7 +140,7 @@ void CollisionObject3D::_update_debug_shapes() { } void CollisionObject3D::_update_shape_data(uint32_t p_owner) { - if (is_inside_tree() && get_tree()->is_debugging_collisions_hint()) { + if (is_inside_tree() && get_tree()->is_debugging_collisions_hint() && !Engine::get_singleton()->is_editor_hint()) { if (debug_shapes_to_update.is_empty()) { call_deferred("_update_debug_shapes"); } diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 24c73a6b1b..4b4d3943c9 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -1337,6 +1337,7 @@ void AnimationTree::_tree_changed() { } void AnimationTree::_update_properties_for_node(const String &p_base_path, Ref<AnimationNode> node) { + ERR_FAIL_COND(node.is_null()); if (!property_parent_map.has(p_base_path)) { property_parent_map[p_base_path] = HashMap<StringName, StringName>(); } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 1933bc8af0..bce30e7cd3 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -588,7 +588,8 @@ void RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref<Font> offset.x += table->columns[column].width + hseparation + frame->padding.size.x; row_height = MAX(yofs, row_height); - if (column == col_count - 1) { + // Add row height after last column of the row or last cell of the table. + if (column == col_count - 1 || E->next() == nullptr) { offset.x = 0; row_height += vseparation; table->total_height += row_height; diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 9d5871ef02..3bf163f670 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -645,7 +645,7 @@ int TabContainer::_get_tab_width(int p_index) const { // Get the width of the text displayed on the tab. Ref<Font> font = get_theme_font("font"); int font_size = get_theme_font_size("font_size"); - String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(control->get_name()); + String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(tr(control->get_name())); int width = font->get_string_size(text, font_size).width; // Add space for a tab icon. diff --git a/servers/audio/effects/audio_effect_capture.cpp b/servers/audio/effects/audio_effect_capture.cpp index 37e4122e50..78837c7531 100644 --- a/servers/audio/effects/audio_effect_capture.cpp +++ b/servers/audio/effects/audio_effect_capture.cpp @@ -91,8 +91,6 @@ Ref<AudioEffectInstance> AudioEffectCapture::instance() { } void AudioEffectCapture::set_buffer_length(float p_buffer_length_seconds) { - ERR_FAIL_COND(buffer_initialized); - buffer_length_seconds = p_buffer_length_seconds; } diff --git a/servers/physics_3d/collision_solver_3d_sat.cpp b/servers/physics_3d/collision_solver_3d_sat.cpp index 651961433c..33075a38be 100644 --- a/servers/physics_3d/collision_solver_3d_sat.cpp +++ b/servers/physics_3d/collision_solver_3d_sat.cpp @@ -1627,10 +1627,55 @@ static void _collision_capsule_cylinder(const Shape3DSW *p_a, const Transform &p SeparatorAxisTest<CapsuleShape3DSW, CylinderShape3DSW, withMargin> separator(capsule_A, p_transform_a, cylinder_B, p_transform_b, p_collector, p_margin_a, p_margin_b); + if (!separator.test_previous_axis()) { + return; + } + + // Cylinder B end caps. + Vector3 cylinder_B_axis = p_transform_b.basis.get_axis(1).normalized(); + if (!separator.test_axis(cylinder_B_axis)) { + return; + } + + // Cylinder edge against capsule balls. + + Vector3 capsule_A_axis = p_transform_a.basis.get_axis(1); + + Vector3 capsule_A_ball_1 = p_transform_a.origin + capsule_A_axis * (capsule_A->get_height() * 0.5); + Vector3 capsule_A_ball_2 = p_transform_a.origin - capsule_A_axis * (capsule_A->get_height() * 0.5); + + if (!separator.test_axis((p_transform_b.origin - capsule_A_ball_1).cross(cylinder_B_axis).cross(cylinder_B_axis).normalized())) { + return; + } + + if (!separator.test_axis((p_transform_b.origin - capsule_A_ball_2).cross(cylinder_B_axis).cross(cylinder_B_axis).normalized())) { + return; + } + + // Cylinder edge against capsule edge. + + Vector3 center_diff = p_transform_b.origin - p_transform_a.origin; + + if (!separator.test_axis(capsule_A_axis.cross(center_diff).cross(capsule_A_axis).normalized())) { + return; + } + + if (!separator.test_axis(cylinder_B_axis.cross(center_diff).cross(cylinder_B_axis).normalized())) { + return; + } + + real_t proj = capsule_A_axis.cross(cylinder_B_axis).cross(cylinder_B_axis).dot(capsule_A_axis); + if (Math::is_zero_approx(proj)) { + // Parallel capsule and cylinder axes, handle with specific axes only. + // Note: GJKEPA with no margin can lead to degenerate cases in this situation. + separator.generate_contacts(); + return; + } + CollisionSolver3DSW::CallbackResult callback = SeparatorAxisTest<CapsuleShape3DSW, CylinderShape3DSW, withMargin>::test_contact_points; // Fallback to generic algorithm to find the best separating axis. - if (!fallback_collision_solver(p_a, p_transform_a, p_b, p_transform_b, callback, &separator)) { + if (!fallback_collision_solver(p_a, p_transform_a, p_b, p_transform_b, callback, &separator, false, p_margin_a, p_margin_b)) { return; } @@ -1805,7 +1850,7 @@ static void _collision_cylinder_cylinder(const Shape3DSW *p_a, const Transform & CollisionSolver3DSW::CallbackResult callback = SeparatorAxisTest<CylinderShape3DSW, CylinderShape3DSW, withMargin>::test_contact_points; // Fallback to generic algorithm to find the best separating axis. - if (!fallback_collision_solver(p_a, p_transform_a, p_b, p_transform_b, callback, &separator)) { + if (!fallback_collision_solver(p_a, p_transform_a, p_b, p_transform_b, callback, &separator, false, p_margin_a, p_margin_b)) { return; } @@ -1822,7 +1867,7 @@ static void _collision_cylinder_convex_polygon(const Shape3DSW *p_a, const Trans CollisionSolver3DSW::CallbackResult callback = SeparatorAxisTest<CylinderShape3DSW, ConvexPolygonShape3DSW, withMargin>::test_contact_points; // Fallback to generic algorithm to find the best separating axis. - if (!fallback_collision_solver(p_a, p_transform_a, p_b, p_transform_b, callback, &separator)) { + if (!fallback_collision_solver(p_a, p_transform_a, p_b, p_transform_b, callback, &separator, false, p_margin_a, p_margin_b)) { return; } diff --git a/servers/physics_3d/gjk_epa.cpp b/servers/physics_3d/gjk_epa.cpp index aa7c11eec5..e44c92da79 100644 --- a/servers/physics_3d/gjk_epa.cpp +++ b/servers/physics_3d/gjk_epa.cpp @@ -110,26 +110,60 @@ struct MinkowskiDiff { Transform transform_A; Transform transform_B; + real_t margin_A = 0.0; + real_t margin_B = 0.0; + + Vector3 (*get_support)(const Shape3DSW*, const Vector3&, real_t); + + void Initialize(const Shape3DSW* shape0, const Transform& wtrs0, const real_t margin0, + const Shape3DSW* shape1, const Transform& wtrs1, const real_t margin1) { + m_shapes[0] = shape0; + m_shapes[1] = shape1; + transform_A = wtrs0; + transform_B = wtrs1; + margin_A = margin0; + margin_B = margin1; + + if ((margin0 > 0.0) || (margin1 > 0.0)) { + get_support = get_support_with_margin; + } else { + get_support = get_support_without_margin; + } + } + + static Vector3 get_support_without_margin(const Shape3DSW* p_shape, const Vector3& p_dir, real_t p_margin) { + return p_shape->get_support(p_dir.normalized()); + } + + static Vector3 get_support_with_margin(const Shape3DSW* p_shape, const Vector3& p_dir, real_t p_margin) { + Vector3 local_dir_norm = p_dir; + if (local_dir_norm.length_squared() < CMP_EPSILON2) { + local_dir_norm = Vector3(-1.0, -1.0, -1.0); + } + local_dir_norm.normalize(); + + return p_shape->get_support(local_dir_norm) + p_margin * local_dir_norm; + } + // i wonder how this could be sped up... if it can - _FORCE_INLINE_ Vector3 Support0 ( const Vector3& d ) const { - return transform_A.xform( m_shapes[0]->get_support( transform_A.basis.xform_inv(d).normalized() ) ); + _FORCE_INLINE_ Vector3 Support0(const Vector3& d) const { + return transform_A.xform(get_support(m_shapes[0], transform_A.basis.xform_inv(d), margin_A)); } - _FORCE_INLINE_ Vector3 Support1 ( const Vector3& d ) const { - return transform_B.xform( m_shapes[1]->get_support( transform_B.basis.xform_inv(d).normalized() ) ); + _FORCE_INLINE_ Vector3 Support1(const Vector3& d) const { + return transform_B.xform(get_support(m_shapes[1], transform_B.basis.xform_inv(d), margin_B)); } - _FORCE_INLINE_ Vector3 Support ( const Vector3& d ) const { - return ( Support0 ( d )-Support1 ( -d ) ); + _FORCE_INLINE_ Vector3 Support (const Vector3& d) const { + return (Support0(d) - Support1(-d)); } - _FORCE_INLINE_ Vector3 Support ( const Vector3& d,U index ) const - { - if ( index ) { - return ( Support1 ( d ) ); + _FORCE_INLINE_ Vector3 Support(const Vector3& d, U index) const { + if (index) { + return Support1(d); } else { - return ( Support0 ( d ) ); -} + return Support0(d); + } } }; @@ -828,22 +862,17 @@ struct GJK }; // - static void Initialize( const Shape3DSW* shape0,const Transform& wtrs0, - const Shape3DSW* shape1,const Transform& wtrs1, + static void Initialize( const Shape3DSW* shape0, const Transform& wtrs0, real_t margin0, + const Shape3DSW* shape1, const Transform& wtrs1, real_t margin1, sResults& results, - tShape& shape, - bool withmargins) + tShape& shape) { /* Results */ - results.witnesses[0] = - results.witnesses[1] = Vector3(0,0,0); + results.witnesses[0] = Vector3(0,0,0); + results.witnesses[1] = Vector3(0,0,0); results.status = sResults::Separated; /* Shape */ - shape.m_shapes[0] = shape0; - shape.m_shapes[1] = shape1; - shape.transform_A = wtrs0; - shape.transform_B = wtrs1; - + shape.Initialize(shape0, wtrs0, margin0, shape1, wtrs1, margin1); } @@ -857,13 +886,15 @@ struct GJK // bool Distance( const Shape3DSW* shape0, const Transform& wtrs0, - const Shape3DSW* shape1, + real_t margin0, + const Shape3DSW* shape1, const Transform& wtrs1, + real_t margin1, const Vector3& guess, sResults& results) { tShape shape; - Initialize(shape0,wtrs0,shape1,wtrs1,results,shape,false); + Initialize(shape0, wtrs0, margin0, shape1, wtrs1, margin1, results, shape); GJK gjk; GJK::eStatus::_ gjk_status=gjk.Evaluate(shape,guess); if(gjk_status==GJK::eStatus::Valid) @@ -896,14 +927,16 @@ bool Distance( const Shape3DSW* shape0, // bool Penetration( const Shape3DSW* shape0, const Transform& wtrs0, - const Shape3DSW* shape1, + real_t margin0, + const Shape3DSW* shape1, const Transform& wtrs1, - const Vector3& guess, + real_t margin1, + const Vector3& guess, sResults& results ) { tShape shape; - Initialize(shape0,wtrs0,shape1,wtrs1,results,shape,false); + Initialize(shape0, wtrs0, margin0, shape1, wtrs1, margin1, results, shape); GJK gjk; GJK::eStatus::_ gjk_status=gjk.Evaluate(shape,-guess); switch(gjk_status) @@ -963,7 +996,7 @@ bool Penetration( const Shape3DSW* shape0, bool gjk_epa_calculate_distance(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_result_A, Vector3 &r_result_B) { GjkEpa2::sResults res; - if (GjkEpa2::Distance(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_transform_B.origin - p_transform_A.origin, res)) { + if (GjkEpa2::Distance(p_shape_A, p_transform_A, 0.0, p_shape_B, p_transform_B, 0.0, p_transform_B.origin - p_transform_A.origin, res)) { r_result_A = res.witnesses[0]; r_result_B = res.witnesses[1]; return true; @@ -972,10 +1005,10 @@ bool gjk_epa_calculate_distance(const Shape3DSW *p_shape_A, const Transform &p_t return false; } -bool gjk_epa_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CollisionSolver3DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap) { +bool gjk_epa_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CollisionSolver3DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap, real_t p_margin_A, real_t p_margin_B) { GjkEpa2::sResults res; - if (GjkEpa2::Penetration(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_transform_B.origin - p_transform_A.origin, res)) { + if (GjkEpa2::Penetration(p_shape_A, p_transform_A, p_margin_A, p_shape_B, p_transform_B, p_margin_B, p_transform_B.origin - p_transform_A.origin, res)) { if (p_result_callback) { if (p_swap) { p_result_callback(res.witnesses[1], res.witnesses[0], p_userdata); diff --git a/servers/physics_3d/gjk_epa.h b/servers/physics_3d/gjk_epa.h index be3ba4e664..a7e2e1719e 100644 --- a/servers/physics_3d/gjk_epa.h +++ b/servers/physics_3d/gjk_epa.h @@ -34,7 +34,7 @@ #include "collision_solver_3d_sw.h" #include "shape_3d_sw.h" -bool gjk_epa_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CollisionSolver3DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false); +bool gjk_epa_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CollisionSolver3DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, real_t p_margin_A = 0.0, real_t p_margin_B = 0.0); bool gjk_epa_calculate_distance(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_result_A, Vector3 &r_result_B); #endif diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp index 2a34049675..ba5ace8f31 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp @@ -5121,6 +5121,7 @@ void RendererStorageRD::particles_collision_height_field_update(RID p_particles_ void RendererStorageRD::particles_collision_set_height_field_resolution(RID p_particles_collision, RS::ParticlesCollisionHeightfieldResolution p_resolution) { ParticlesCollision *particles_collision = particles_collision_owner.getornull(p_particles_collision); ERR_FAIL_COND(!particles_collision); + ERR_FAIL_INDEX(p_resolution, RS::PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_MAX); if (particles_collision->heightfield_resolution == p_resolution) { return; diff --git a/servers/rendering/renderer_rd/shaders/SCsub b/servers/rendering/renderer_rd/shaders/SCsub index 0f85e3fa30..fc513d3fb9 100644 --- a/servers/rendering/renderer_rd/shaders/SCsub +++ b/servers/rendering/renderer_rd/shaders/SCsub @@ -3,46 +3,15 @@ Import("env") if "RD_GLSL" in env["BUILDERS"]: - env.RD_GLSL("canvas.glsl") - env.RD_GLSL("canvas_occlusion.glsl") - env.RD_GLSL("canvas_sdf.glsl") - env.RD_GLSL("copy.glsl") - env.RD_GLSL("copy_to_fb.glsl") - env.RD_GLSL("cubemap_roughness.glsl") - env.RD_GLSL("cubemap_downsampler.glsl") - env.RD_GLSL("cubemap_filter.glsl") - env.RD_GLSL("scene_forward_clustered.glsl") - env.RD_GLSL("sky.glsl") - env.RD_GLSL("tonemap.glsl") - env.RD_GLSL("cube_to_dp.glsl") - env.RD_GLSL("giprobe.glsl") - env.RD_GLSL("giprobe_debug.glsl") - env.RD_GLSL("giprobe_sdf.glsl") - env.RD_GLSL("luminance_reduce.glsl") - env.RD_GLSL("bokeh_dof.glsl") - env.RD_GLSL("ssao.glsl") - env.RD_GLSL("ssao_downsample.glsl") - env.RD_GLSL("ssao_importance_map.glsl") - env.RD_GLSL("ssao_blur.glsl") - env.RD_GLSL("ssao_interleave.glsl") - env.RD_GLSL("roughness_limiter.glsl") - env.RD_GLSL("screen_space_reflection.glsl") - env.RD_GLSL("screen_space_reflection_filter.glsl") - env.RD_GLSL("screen_space_reflection_scale.glsl") - env.RD_GLSL("subsurface_scattering.glsl") - env.RD_GLSL("specular_merge.glsl") - env.RD_GLSL("gi.glsl") - env.RD_GLSL("resolve.glsl") - env.RD_GLSL("sdfgi_preprocess.glsl") - env.RD_GLSL("sdfgi_integrate.glsl") - env.RD_GLSL("sdfgi_direct_light.glsl") - env.RD_GLSL("sdfgi_debug.glsl") - env.RD_GLSL("sdfgi_debug_probes.glsl") - env.RD_GLSL("volumetric_fog.glsl") - env.RD_GLSL("particles.glsl") - env.RD_GLSL("particles_copy.glsl") - env.RD_GLSL("sort.glsl") - env.RD_GLSL("skeleton.glsl") - env.RD_GLSL("cluster_render.glsl") - env.RD_GLSL("cluster_store.glsl") - env.RD_GLSL("cluster_debug.glsl") + # find all include files + gl_include_files = [str(f) for f in Glob("*_inc.glsl")] + + # find all shader code(all glsl files excluding our include files) + glsl_files = [str(f) for f in Glob("*.glsl") if str(f) not in gl_include_files] + + # make sure we recompile shaders if include files change + env.Depends([f + ".gen.h" for f in glsl_files], gl_include_files) + + # compile shaders + for glsl_file in glsl_files: + env.RD_GLSL(glsl_file) |