diff options
Diffstat (limited to 'modules')
43 files changed, 192 insertions, 159 deletions
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index 26e9f5a044..7c27292e59 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -461,7 +461,7 @@ void BulletPhysicsServer3D::body_set_space(RID p_body, RID p_space) { } if (body->get_space() == space) { - return; //pointles + return; //pointless } body->set_space(space); @@ -617,11 +617,11 @@ uint32_t BulletPhysicsServer3D::body_get_collision_mask(RID p_body) const { } void BulletPhysicsServer3D::body_set_user_flags(RID p_body, uint32_t p_flags) { - // This function si not currently supported + // This function is not currently supported } uint32_t BulletPhysicsServer3D::body_get_user_flags(RID p_body) const { - // This function si not currently supported + // This function is not currently supported return 0; } @@ -898,7 +898,7 @@ void BulletPhysicsServer3D::soft_body_set_space(RID p_body, RID p_space) { } if (body->get_space() == space) { - return; //pointles + return; //pointless } body->set_space(space); diff --git a/modules/bullet/bullet_types_converter.cpp b/modules/bullet/bullet_types_converter.cpp index 7b21e4e4b2..19d4816372 100644 --- a/modules/bullet/bullet_types_converter.cpp +++ b/modules/bullet/bullet_types_converter.cpp @@ -116,7 +116,7 @@ void UNSCALE_BT_BASIS(btTransform &scaledBasis) { } } else { // Column 1 scale not fuzzy zero. if (column2.fuzzyZero()) { - // Create two vectors othogonal to column 1. + // Create two vectors orthogonal to column 1. // Ensure that a default basis is created if column 1 = <0, 1, 0> column0 = btVector3(column1[1], -column1[0], 0); column2 = column0.cross(column1); diff --git a/modules/bullet/godot_collision_dispatcher.cpp b/modules/bullet/godot_collision_dispatcher.cpp index 5d1e4d34d8..423166c408 100644 --- a/modules/bullet/godot_collision_dispatcher.cpp +++ b/modules/bullet/godot_collision_dispatcher.cpp @@ -43,7 +43,7 @@ GodotCollisionDispatcher::GodotCollisionDispatcher(btCollisionConfiguration *col bool GodotCollisionDispatcher::needsCollision(const btCollisionObject *body0, const btCollisionObject *body1) { if (body0->getUserIndex() == CASTED_TYPE_AREA || body1->getUserIndex() == CASTED_TYPE_AREA) { - // Avoide area narrow phase + // Avoid area narrow phase return false; } return btCollisionDispatcher::needsCollision(body0, body1); @@ -51,7 +51,7 @@ bool GodotCollisionDispatcher::needsCollision(const btCollisionObject *body0, co bool GodotCollisionDispatcher::needsResponse(const btCollisionObject *body0, const btCollisionObject *body1) { if (body0->getUserIndex() == CASTED_TYPE_AREA || body1->getUserIndex() == CASTED_TYPE_AREA) { - // Avoide area narrow phase + // Avoid area narrow phase return false; } return btCollisionDispatcher::needsResponse(body0, body1); diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp index 15d625afeb..e92b6c189c 100644 --- a/modules/bullet/godot_result_callbacks.cpp +++ b/modules/bullet/godot_result_callbacks.cpp @@ -113,7 +113,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo PhysicsDirectSpaceState3D::ShapeResult &result = m_results[count]; - result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID + result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is an odd name but contains the compound shape ID result.rid = gObj->get_self(); result.collider_id = gObj->get_instance_id(); result.collider = result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(result.collider_id); @@ -176,7 +176,7 @@ bool GodotClosestConvexResultCallback::needsCollision(btBroadphaseProxy *proxy0) btScalar GodotClosestConvexResultCallback::addSingleResult(btCollisionWorld::LocalConvexResult &convexResult, bool normalInWorldSpace) { if (convexResult.m_localShapeInfo) { - m_shapeId = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID + m_shapeId = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is an odd name but contains the compound shape ID } else { m_shapeId = 0; } diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index a5093afe9d..433bff8c38 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -515,7 +515,7 @@ real_t RigidBodyBullet::get_param(PhysicsServer3D::BodyParameter p_param) const } void RigidBodyBullet::set_mode(PhysicsServer3D::BodyMode p_mode) { - // This is necessary to block force_integration untile next move + // This is necessary to block force_integration until next move can_integrate_forces = false; destroy_kinematic_utilities(); // The mode change is relevant to its mass @@ -725,7 +725,7 @@ void RigidBodyBullet::set_continuous_collision_detection(bool p_enable) { // 1 meter in one simulation frame btBody->setCcdMotionThreshold(1e-7); - /// Calculate using the rule writte below the CCD swept sphere radius + /// Calculate using the rule write below the CCD swept sphere radius /// CCD works on an embedded sphere of radius, make sure this radius /// is embedded inside the convex objects, preferably smaller: /// for an object of dimensions 1 meter, try 0.2 diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index 91a1934e07..a8980984a7 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -336,7 +336,7 @@ void SoftBodyBullet::set_trimesh_body_shape(Vector<int> p_indices, Vector<Vector Map<Vector3, int>::Element *e = unique_vertices.find(p_vertices_read[vs_vertex_index]); int vertex_id; if (e) { - // Already rxisting + // Already existing vertex_id = e->value(); } else { // Create new one diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index 7d337bc4d0..ceae3be8bc 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -81,7 +81,7 @@ int BulletPhysicsDirectSpaceState::intersect_point(const Vector3 &p_point, Shape btResult.m_collisionFilterMask = p_collision_mask; space->dynamicsWorld->contactTest(&collision_object_point, btResult); - // The results is already populated by GodotAllConvexResultCallback + // The results are already populated by GodotAllConvexResultCallback return btResult.m_count; } diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp index f0a2f17ba9..8b46447f04 100644 --- a/modules/csg/csg.cpp +++ b/modules/csg/csg.cpp @@ -970,7 +970,7 @@ void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector<int> &p_segment_ continue; } - // Check if point is on an each edge. + // Check if point is on each edge. for (int face_edge_idx = 0; face_edge_idx < 3; ++face_edge_idx) { Vector2 edge_points[2] = { face_points[face_edge_idx], @@ -1076,7 +1076,7 @@ void CSGBrushOperation::Build2DFaces::_find_edge_intersections(const Vector2 p_s break; } - // If opposite point is on the segemnt, add its index to segment indices too. + // If opposite point is on the segment, add its index to segment indices too. Vector2 closest_point = Geometry2D::get_closest_point_to_segment(vertices[opposite_vertex_idx].point, p_segment_points); if ((closest_point - vertices[opposite_vertex_idx].point).length_squared() < vertex_snap2) { _add_vertex_idx_sorted(r_segment_indices, opposite_vertex_idx); @@ -1137,7 +1137,7 @@ int CSGBrushOperation::Build2DFaces::_insert_point(const Vector2 &p_point) { } } - // Check if point is on an each edge. + // Check if point is on each edge. bool on_edge = false; for (int face_edge_idx = 0; face_edge_idx < 3; ++face_edge_idx) { Vector2 edge_points[2] = { @@ -1400,7 +1400,7 @@ void CSGBrushOperation::update_faces(const CSGBrush &p_brush_a, const int p_face under_count++; } } - // If all points under or over the plane, there is no intesection. + // If all points under or over the plane, there is no intersection. if (over_count == 3 || under_count == 3) { return; } @@ -1421,7 +1421,7 @@ void CSGBrushOperation::update_faces(const CSGBrush &p_brush_a, const int p_face under_count++; } } - // If all points under or over the plane, there is no intesection. + // If all points under or over the plane, there is no intersection. if (over_count == 3 || under_count == 3) { return; } diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 40ba457e43..b97ee6ce4c 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -1160,7 +1160,7 @@ CSGBrush *CSGBox3D::_build_brush() { materialsw[face] = material; face++; - //face 1 + //face 2 facesw[face * 3 + 0] = face_points[2] * vertex_mul; facesw[face * 3 + 1] = face_points[3] * vertex_mul; facesw[face * 3 + 2] = face_points[0] * vertex_mul; diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index 276f13e553..25b87145b6 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -248,7 +248,7 @@ void NetworkedMultiplayerENet::poll() { int *new_id = memnew(int); *new_id = event.data; - if (*new_id == 0) { // Data zero is sent by server (enet won't let you configure this). Server is always 1. + if (*new_id == 0) { // Data zero is sent by server (ENet won't let you configure this). Server is always 1. *new_id = 1; } diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 1bdbb0b03b..0025f4bb06 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -173,7 +173,7 @@ bool NativeScript::can_instance() const { #ifdef TOOLS_ENABLED // Only valid if this is either a tool script or a "regular" script. - // (so an environment whre scripting is disabled (and not the editor) would not + // (so, an environment where scripting is disabled (and not the editor) would not // create objects). return script_data && (is_tool() || ScriptServer::is_scripting_enabled()); #else diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 31f4fecb19..d08bde9e23 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -142,7 +142,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty } } - // Add symbols for staticaly linked libraries on iOS + // Add symbols for statically linked libraries on iOS if (p_features.has("iOS")) { bool should_fake_dynamic = false; diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 06d628d23f..63ca34fc24 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -1511,17 +1511,17 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui codegen.start_block(); // Evaluate the match expression. - GDScriptCodeGenerator::Address value_local = codegen.add_local("@match_value", _gdtype_from_datatype(match->test->get_datatype())); - GDScriptCodeGenerator::Address value = _parse_expression(codegen, error, match->test); + GDScriptCodeGenerator::Address value = codegen.add_local("@match_value", _gdtype_from_datatype(match->test->get_datatype())); + GDScriptCodeGenerator::Address value_expr = _parse_expression(codegen, error, match->test); if (error) { return error; } // Assign to local. // TODO: This can be improved by passing the target to parse_expression(). - gen->write_assign(value_local, value); + gen->write_assign(value, value_expr); - if (value.mode == GDScriptCodeGenerator::Address::TEMPORARY) { + if (value_expr.mode == GDScriptCodeGenerator::Address::TEMPORARY) { codegen.generator->pop_temporary(); } @@ -2419,7 +2419,7 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa p_script->initializer->call(instance, nullptr, 0, ce); if (ce.error != Callable::CallError::CALL_OK) { - //well, tough luck, not goinna do anything here + //well, tough luck, not gonna do anything here } } #endif diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index c6c9a439df..7b37aa40a2 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -244,7 +244,7 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) { bool completed = true; // If the return value is a GDScriptFunctionState reference, - // then the function did awaited again after resuming. + // then the function did await again after resuming. if (ret.is_ref()) { GDScriptFunctionState *gdfs = Object::cast_to<GDScriptFunctionState>(ret); if (gdfs && gdfs->function == function) { diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 15cb3146ee..7f3dd6b2e5 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -3018,7 +3018,7 @@ GDScriptParser::ParseRule *GDScriptParser::get_rule(GDScriptTokenizer::Token::Ty // Avoid desync. static_assert(sizeof(rules) / sizeof(rules[0]) == GDScriptTokenizer::Token::TK_MAX, "Amount of parse rules don't match the amount of token types."); - // Let's assume this this never invalid, since nothing generates a TK_MAX. + // Let's assume this is never invalid, since nothing generates a TK_MAX. return &rules[p_token_type]; } diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index 315b8ee3b4..319778daab 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -1169,7 +1169,7 @@ GDScriptTokenizer::Token GDScriptTokenizer::scan() { if (pending_newline) { pending_newline = false; if (!multiline_mode) { - // Don't return newline tokens on multine mode. + // Don't return newline tokens on multiline mode. return last_newline; } } diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index 4e098d7a6d..2216fcab2d 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -649,7 +649,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a if (scr_B) { //if B is a script, the only valid condition is that A has an instance which inherits from the script - //in other situation, this shoul return false. + //in other situation, this should return false. if (obj_A->get_script_instance() && obj_A->get_script_instance()->get_language() == GDScriptLanguage::get_singleton()) { GDScript *cmp = static_cast<GDScript *>(obj_A->get_script_instance()->get_script().ptr()); diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index e90475a60e..93b709a613 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -85,7 +85,7 @@ public: return; } - // TODO: Readd compiled GDScript on export. + // TODO: Re-add compiled GDScript on export. return; } }; diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 0a4d4055b4..caf8e3f48f 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -63,7 +63,6 @@ #ifdef MODULE_GRIDMAP_ENABLED #include "modules/gridmap/grid_map.h" #endif // MODULE_GRIDMAP_ENABLED -#include "modules/regex/regex.h" #include "scene/2d/node_2d.h" #include "scene/3d/bone_attachment_3d.h" #include "scene/3d/camera_3d.h" @@ -505,25 +504,11 @@ String GLTFDocument::_gen_unique_animation_name(Ref<GLTFState> state, const Stri return name; } -String GLTFDocument::_sanitize_bone_name(const String &name) { - String p_name = name.camelcase_to_underscore(true); - - RegEx pattern_nocolon(":"); - p_name = pattern_nocolon.sub(p_name, "_", true); - - RegEx pattern_noslash("/"); - p_name = pattern_noslash.sub(p_name, "_", true); - - RegEx pattern_nospace(" +"); - p_name = pattern_nospace.sub(p_name, "_", true); - - RegEx pattern_multiple("_+"); - p_name = pattern_multiple.sub(p_name, "_", true); - - RegEx pattern_padded("0+(\\d+)"); - p_name = pattern_padded.sub(p_name, "$1", true); - - return p_name; +String GLTFDocument::_sanitize_bone_name(const String &p_name) { + String name = p_name; + name = name.replace(":", "_"); + name = name.replace("/", "_"); + return name; } String GLTFDocument::_gen_unique_bone_name(Ref<GLTFState> state, const GLTFSkeletonIndex skel_i, const String &p_name) { diff --git a/modules/mbedtls/stream_peer_mbedtls.cpp b/modules/mbedtls/stream_peer_mbedtls.cpp index d7597aa435..b39a6ecc2f 100644 --- a/modules/mbedtls/stream_peer_mbedtls.cpp +++ b/modules/mbedtls/stream_peer_mbedtls.cpp @@ -242,7 +242,7 @@ void StreamPeerMbedTLS::poll() { return; } - // We could pass NULL as second parameter, but some behaviour sanitizers doesn't seem to like that. + // We could pass NULL as second parameter, but some behaviour sanitizers don't seem to like that. // Passing a 1 byte buffer to workaround it. uint8_t byte; int ret = mbedtls_ssl_read(ssl_ctx->get_context(), &byte, 0); diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp index 25b110dc62..5140cfbbaf 100644 --- a/modules/mobile_vr/mobile_vr_interface.cpp +++ b/modules/mobile_vr/mobile_vr_interface.cpp @@ -153,8 +153,8 @@ void MobileVRInterface::set_position_from_sensors() { last_magnetometer_data = magneto; if (grav.length() < 0.1) { - // not ideal but use our accelerometer, this will contain shakey shakey user behaviour - // maybe look into some math but I'm guessing that if this isn't available, its because we lack the gyro sensor to actually work out + // not ideal but use our accelerometer, this will contain shaky user behaviour + // maybe look into some math but I'm guessing that if this isn't available, it's because we lack the gyro sensor to actually work out // what a stable gravity vector is grav = acc; if (grav.length() > 0.1) { @@ -181,8 +181,8 @@ void MobileVRInterface::set_position_from_sensors() { tracking_state = XRInterface::XR_NORMAL_TRACKING; }; - ///@TODO improve this, the magnetometer is very fidgity sometimes flipping the axis for no apparent reason (probably a bug on my part) - // if you have a gyro + accelerometer that combo tends to be better then combining all three but without a gyro you need the magnetometer.. + ///@TODO improve this, the magnetometer is very fidgety sometimes flipping the axis for no apparent reason (probably a bug on my part) + // if you have a gyro + accelerometer that combo tends to be better than combining all three but without a gyro you need the magnetometer.. if (has_magneto && has_grav && !has_gyro) { // convert to quaternions, easier to smooth those out Quat transform_quat(orientation); @@ -372,7 +372,7 @@ Transform MobileVRInterface::get_transform_for_eye(XRInterface::Eyes p_eye, cons if (initialized) { float world_scale = xr_server->get_world_scale(); - // we don't need to check for the existence of our HMD, doesn't effect our values... + // we don't need to check for the existence of our HMD, doesn't affect our values... // note * 0.01 to convert cm to m and * 0.5 as we're moving half in each direction... if (p_eye == XRInterface::EYE_LEFT) { transform_for_eye.origin.x = -(intraocular_dist * 0.01 * 0.5 * world_scale); @@ -402,7 +402,7 @@ CameraMatrix MobileVRInterface::get_projection_for_eye(XRInterface::Eyes p_eye, CameraMatrix eye; if (p_eye == XRInterface::EYE_MONO) { - ///@TODO for now hardcode some of this, what is really needed here is that this needs to be in sync with the real cameras properties + ///@TODO for now hardcode some of this, what is really needed here is that this needs to be in sync with the real camera's properties // which probably means implementing a specific class for iOS and Android. For now this is purely here as an example. // Note also that if you use a normal viewport with AR/VR turned off you can still use the tracker output of this interface // to position a stock standard Godot camera and have control over this. diff --git a/modules/mono/SdkPackageVersions.props b/modules/mono/SdkPackageVersions.props index 396443f30e..df3ebe581c 100644 --- a/modules/mono/SdkPackageVersions.props +++ b/modules/mono/SdkPackageVersions.props @@ -1,6 +1,6 @@ <Project> <PropertyGroup> - <PackageVersion_Godot_NET_Sdk>4.0.0-dev4</PackageVersion_Godot_NET_Sdk> - <PackageVersion_Godot_SourceGenerators>4.0.0-dev1</PackageVersion_Godot_SourceGenerators> + <PackageVersion_Godot_NET_Sdk>4.0.0-dev5</PackageVersion_Godot_NET_Sdk> + <PackageVersion_Godot_SourceGenerators>4.0.0-dev2</PackageVersion_Godot_SourceGenerators> </PropertyGroup> </Project> diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 4fca80fca0..43f57a7caa 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -328,7 +328,7 @@ Ref<Script> CSharpLanguage::get_template(const String &p_class_name, const Strin String script_template = "using " BINDINGS_NAMESPACE ";\n" "using System;\n" "\n" - "public class %CLASS% : %BASE%\n" + "public partial class %CLASS% : %BASE%\n" "{\n" " // Declare member variables here. Examples:\n" " // private int a = 2;\n" @@ -2018,22 +2018,20 @@ void CSharpInstance::connect_event_signals() { // TODO: Use pooling for ManagedCallable instances. auto event_signal_callable = memnew(EventSignalCallable(owner, &event_signal)); - owner->connect(signal_name, Callable(event_signal_callable)); + Callable callable(event_signal_callable); + connected_event_signals.push_back(callable); + owner->connect(signal_name, callable); } } void CSharpInstance::disconnect_event_signals() { - for (const Map<StringName, CSharpScript::EventSignal>::Element *E = script->event_signals.front(); E; E = E->next()) { - const CSharpScript::EventSignal &event_signal = E->value(); - - StringName signal_name = event_signal.field->get_name(); - - // TODO: It would be great if we could store this EventSignalCallable on the stack. - // The problem is that Callable memdeletes it when it's destructed... - auto event_signal_callable = memnew(EventSignalCallable(owner, &event_signal)); - - owner->disconnect(signal_name, Callable(event_signal_callable)); + for (const List<Callable>::Element *E = connected_event_signals.front(); E; E = E->next()) { + const Callable &callable = E->get(); + auto event_signal_callable = static_cast<const EventSignalCallable *>(callable.get_custom()); + owner->disconnect(event_signal_callable->get_signal(), callable); } + + connected_event_signals.clear(); } void CSharpInstance::refcount_incremented() { diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 40f7ed4552..dd93a86d7a 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -271,6 +271,8 @@ class CSharpInstance : public ScriptInstance { Ref<CSharpScript> script; MonoGCHandleData gchandle; + List<Callable> connected_event_signals; + bool _reference_owner_unsafe(); /* diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Godot.NET.Sdk.csproj b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Godot.NET.Sdk.csproj index ef8add0ba8..4e9e7184da 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Godot.NET.Sdk.csproj +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Godot.NET.Sdk.csproj @@ -23,11 +23,12 @@ <ItemGroup> <!-- Package Sdk\Sdk.props and Sdk\Sdk.targets file --> - <None Include="Sdk\Sdk.props" Pack="true" PackagePath="Sdk" Visible="false" /> - <None Include="Sdk\Sdk.targets" Pack="true" PackagePath="Sdk" Visible="false" /> + <None Include="Sdk\Sdk.props" Pack="true" PackagePath="Sdk" /> + <None Include="Sdk\Sdk.targets" Pack="true" PackagePath="Sdk" /> <!-- SdkPackageVersions.props --> - - <None Include="..\..\..\SdkPackageVersions.props" Pack="true" PackagePath="Sdk" Visible="false" /> + <None Include="..\..\..\SdkPackageVersions.props" Pack="true" PackagePath="Sdk"> + <Link>Sdk\SdkPackageVersions.props</Link> + </None> </ItemGroup> <Target Name="CopyNupkgToSConsOutputDir" AfterTargets="Pack"> diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs index c3e74822d5..e16f72f43a 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs @@ -82,5 +82,8 @@ namespace Godot.SourceGenerators public static string FullQualifiedName(this INamedTypeSymbol symbol) => symbol.ToDisplayString(NullableFlowState.NotNull, FullyQualifiedFormatOmitGlobal); + + public static string FullQualifiedName(this INamespaceSymbol namespaceSymbol) + => namespaceSymbol.ToDisplayString(FullyQualifiedFormatOmitGlobal); } } diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPathAttributeGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPathAttributeGenerator.cs index 150e59e414..a51728e221 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPathAttributeGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPathAttributeGenerator.cs @@ -69,7 +69,7 @@ namespace Godot.SourceGenerators IEnumerable<ClassDeclarationSyntax> classDeclarations ) { - var attributesBuilder = new StringBuilder(); + var attributes = new StringBuilder(); // Remember syntax trees for which we already added an attribute, to prevent unnecessary duplicates. var attributedTrees = new List<SyntaxTree>(); @@ -81,28 +81,54 @@ namespace Godot.SourceGenerators attributedTrees.Add(cds.SyntaxTree); - if (attributesBuilder.Length != 0) - attributesBuilder.Append("\n "); + if (attributes.Length != 0) + attributes.Append("\n"); - attributesBuilder.Append(@"[ScriptPathAttribute(""res://"); - attributesBuilder.Append(RelativeToDir(cds.SyntaxTree.FilePath, godotProjectDir)); - attributesBuilder.Append(@""")]"); + attributes.Append(@"[ScriptPathAttribute(""res://"); + attributes.Append(RelativeToDir(cds.SyntaxTree.FilePath, godotProjectDir)); + attributes.Append(@""")]"); } - string classNs = symbol.ContainingNamespace.Name; string className = symbol.Name; - var source = $@"using Godot; -namespace {classNs} -{{ - {attributesBuilder} - partial class {className} - {{ - }} -}} -"; - context.AddSource(classNs + "." + className + "_ScriptPath_Generated", - SourceText.From(source, Encoding.UTF8)); + INamespaceSymbol namespaceSymbol = symbol.ContainingNamespace; + string classNs = namespaceSymbol != null && !namespaceSymbol.IsGlobalNamespace ? + namespaceSymbol.FullQualifiedName() : + string.Empty; + bool hasNamespace = classNs.Length != 0; + + string uniqueName = hasNamespace ? + classNs + "." + className + "_ScriptPath_Generated" : + className + "_ScriptPath_Generated"; + + var source = new StringBuilder(); + + // using Godot; + // namespace {classNs} { + // {attributesBuilder} + // partial class {className} { } + // } + + source.Append("using Godot;\n"); + + if (hasNamespace) + { + source.Append("namespace "); + source.Append(classNs); + source.Append(" {\n\n"); + } + + source.Append(attributes); + source.Append("\n partial class "); + source.Append(className); + source.Append("\n{\n}\n"); + + if (hasNamespace) + { + source.Append("\n}\n"); + } + + context.AddSource(uniqueName, SourceText.From(source.ToString(), Encoding.UTF8)); } private static void AddScriptTypesAssemblyAttr(GeneratorExecutionContext context, diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index b1875aec3f..b48e5df9eb 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -3631,11 +3631,44 @@ void BindingsGenerator::_initialize() { initialized = true; } +static String generate_all_glue_option = "--generate-mono-glue"; +static String generate_cs_glue_option = "--generate-mono-cs-glue"; +static String generate_cpp_glue_option = "--generate-mono-cpp-glue"; + +static void handle_cmdline_options(String glue_dir_path, String cs_dir_path, String cpp_dir_path) { + BindingsGenerator bindings_generator; + bindings_generator.set_log_print_enabled(true); + + if (!bindings_generator.is_initialized()) { + ERR_PRINT("Failed to initialize the bindings generator"); + return; + } + + if (glue_dir_path.length()) { + if (bindings_generator.generate_glue(glue_dir_path) != OK) { + ERR_PRINT(generate_all_glue_option + ": Failed to generate the C++ glue."); + } + + if (bindings_generator.generate_cs_api(glue_dir_path.plus_file(API_SOLUTION_NAME)) != OK) { + ERR_PRINT(generate_all_glue_option + ": Failed to generate the C# API."); + } + } + + if (cs_dir_path.length()) { + if (bindings_generator.generate_cs_api(cs_dir_path) != OK) { + ERR_PRINT(generate_cs_glue_option + ": Failed to generate the C# API."); + } + } + + if (cpp_dir_path.length()) { + if (bindings_generator.generate_glue(cpp_dir_path) != OK) { + ERR_PRINT(generate_cpp_glue_option + ": Failed to generate the C++ glue."); + } + } +} + void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) { const int NUM_OPTIONS = 2; - String generate_all_glue_option = "--generate-mono-glue"; - String generate_cs_glue_option = "--generate-mono-cs-glue"; - String generate_cpp_glue_option = "--generate-mono-cpp-glue"; String glue_dir_path; String cs_dir_path; @@ -3643,6 +3676,8 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) int options_left = NUM_OPTIONS; + bool exit_godot = false; + const List<String>::Element *elem = p_cmdline_args.front(); while (elem && options_left) { @@ -3654,6 +3689,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) elem = elem->next(); } else { ERR_PRINT(generate_all_glue_option + ": No output directory specified (expected path to '{GODOT_ROOT}/modules/mono/glue')."); + exit_godot = true; } --options_left; @@ -3665,6 +3701,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) elem = elem->next(); } else { ERR_PRINT(generate_cs_glue_option + ": No output directory specified."); + exit_godot = true; } --options_left; @@ -3676,6 +3713,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) elem = elem->next(); } else { ERR_PRINT(generate_cpp_glue_option + ": No output directory specified."); + exit_godot = true; } --options_left; @@ -3685,37 +3723,11 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) } if (glue_dir_path.length() || cs_dir_path.length() || cpp_dir_path.length()) { - BindingsGenerator bindings_generator; - bindings_generator.set_log_print_enabled(true); - - if (!bindings_generator.initialized) { - ERR_PRINT("Failed to initialize the bindings generator"); - Main::cleanup(true); - ::exit(0); - } - - if (glue_dir_path.length()) { - if (bindings_generator.generate_glue(glue_dir_path) != OK) { - ERR_PRINT(generate_all_glue_option + ": Failed to generate the C++ glue."); - } - - if (bindings_generator.generate_cs_api(glue_dir_path.plus_file(API_SOLUTION_NAME)) != OK) { - ERR_PRINT(generate_all_glue_option + ": Failed to generate the C# API."); - } - } - - if (cs_dir_path.length()) { - if (bindings_generator.generate_cs_api(cs_dir_path) != OK) { - ERR_PRINT(generate_cs_glue_option + ": Failed to generate the C# API."); - } - } - - if (cpp_dir_path.length()) { - if (bindings_generator.generate_glue(cpp_dir_path) != OK) { - ERR_PRINT(generate_cpp_glue_option + ": Failed to generate the C++ glue."); - } - } + handle_cmdline_options(glue_dir_path, cs_dir_path, cpp_dir_path); + exit_godot = true; + } + if (exit_godot) { // Exit once done Main::cleanup(true); ::exit(0); diff --git a/modules/mono/mono_gd/support/android_support.cpp b/modules/mono/mono_gd/support/android_support.cpp index cba29d63cd..5dd33b036a 100644 --- a/modules/mono/mono_gd/support/android_support.cpp +++ b/modules/mono/mono_gd/support/android_support.cpp @@ -415,8 +415,7 @@ GD_PINVOKE_EXPORT int32_t monodroid_get_system_property(const char *p_name, char if (r_value) { if (len >= 0) { *r_value = (char *)malloc(len + 1); - if (!*r_value) - return -1; + ERR_FAIL_NULL_V_MSG(*r_value, -1, "Out of memory."); memcpy(*r_value, prop_value_str, len); (*r_value)[len] = '\0'; } else { @@ -637,6 +636,7 @@ GD_PINVOKE_EXPORT int32_t _monodroid_get_dns_servers(void **r_dns_servers_array) if (dns_servers_count > 0) { size_t ret_size = sizeof(char *) * (size_t)dns_servers_count; *r_dns_servers_array = malloc(ret_size); // freed by the BCL + ERR_FAIL_NULL_MSG(*r_dns_servers_array, "Out of memory."); memcpy(*r_dns_servers_array, dns_servers, ret_size); } diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub index b4067d41c2..e7863f88a3 100644 --- a/modules/text_server_adv/SCsub +++ b/modules/text_server_adv/SCsub @@ -83,8 +83,8 @@ if env["builtin_harfbuzz"]: "src/hb-ot-shape-complex-indic.cc", "src/hb-ot-shape-complex-khmer.cc", "src/hb-ot-shape-complex-myanmar.cc", + "src/hb-ot-shape-complex-syllabic.cc", "src/hb-ot-shape-complex-thai.cc", - "src/hb-ot-shape-complex-use-table.cc", "src/hb-ot-shape-complex-use.cc", "src/hb-ot-shape-complex-vowel-constraints.cc", "src/hb-ot-shape-fallback.cc", diff --git a/modules/text_server_adv/dynamic_font_adv.cpp b/modules/text_server_adv/dynamic_font_adv.cpp index b60b9ddaec..2521e68dda 100644 --- a/modules/text_server_adv/dynamic_font_adv.cpp +++ b/modules/text_server_adv/dynamic_font_adv.cpp @@ -129,7 +129,7 @@ DynamicFontDataAdvanced::DataAtSize *DynamicFontDataAdvanced::get_data_for_size( fds->underline_position = (-FT_MulFix(fds->face->underline_position, fds->face->size->metrics.y_scale) / 64.0) / oversampling * fds->scale_color_font; fds->underline_thickness = (FT_MulFix(fds->face->underline_thickness, fds->face->size->metrics.y_scale) / 64.0) / oversampling * fds->scale_color_font; - //Load os2 TTF pable + //Load os2 TTF table fds->os2 = (TT_OS2 *)FT_Get_Sfnt_Table(fds->face, FT_SFNT_OS2); fds->hb_handle = hb_ft_font_create(fds->face, nullptr); diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 2e3c2d1cab..43b8f18101 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -166,7 +166,7 @@ bool TextServerAdvanced::load_support_data(const String &p_filename) { #ifdef ICU_STATIC_DATA if (icu_data == nullptr) { UErrorCode err = U_ZERO_ERROR; - u_init(&err); // Do not check for errors, since we only load part the of data. + u_init(&err); // Do not check for errors, since we only load part of the data. icu_data = (uint8_t *)&U_ICUDATA_ENTRY_POINT; } #else @@ -244,7 +244,7 @@ struct FeatureInfo { }; static FeatureInfo feature_set[] = { - // Registred OpenType feature tags. + // Registered OpenType feature tags. { HB_TAG('a', 'a', 'l', 't'), "access_all_alternates" }, { HB_TAG('a', 'b', 'v', 'f'), "above_base_forms" }, { HB_TAG('a', 'b', 'v', 'm'), "above_base_mark_positioning" }, @@ -484,7 +484,7 @@ static FeatureInfo feature_set[] = { { HB_TAG('v', 'r', 't', '2'), "vertical_alternates_and_rotation" }, { HB_TAG('v', 'r', 't', 'r'), "vertical_alternates_for_rotation" }, { HB_TAG('z', 'e', 'r', 'o'), "slashed_zero" }, - // Registred OpenType variation tags. + // Registered OpenType variation tags. { HB_TAG('i', 't', 'a', 'l'), "italic" }, { HB_TAG('o', 'p', 's', 'z'), "optical_size" }, { HB_TAG('s', 'l', 'n', 't'), "slant" }, @@ -1660,7 +1660,7 @@ bool TextServerAdvanced::shaped_text_update_breaks(RID p_shaped) { } if (sd->line_breaks_valid) { - return true; // Noting to do. + return true; // Nothing to do. } const UChar *data = sd->utf16.ptr(); @@ -1845,7 +1845,7 @@ bool TextServerAdvanced::shaped_text_update_justification_ops(RID p_shaped) { } if (sd->justification_ops_valid) { - return true; // Noting to do. + return true; // Nothing to do. } const UChar *data = sd->utf16.ptr(); diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 60ab14738a..f46f96d30d 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -1091,7 +1091,7 @@ bool TextServerFallback::shaped_text_update_breaks(RID p_shaped) { } if (sd->line_breaks_valid) { - return true; // Noting to do. + return true; // Nothing to do. } int sd_size = sd->glyphs.size(); diff --git a/modules/upnp/SCsub b/modules/upnp/SCsub index bc0b215be3..b2fed0cb23 100644 --- a/modules/upnp/SCsub +++ b/modules/upnp/SCsub @@ -12,18 +12,19 @@ thirdparty_obj = [] if env["builtin_miniupnpc"]: thirdparty_dir = "#thirdparty/miniupnpc/" thirdparty_sources = [ + "igd_desc_parse.c", "miniupnpc.c", - "upnpcommands.c", + "minixml.c", + "minisoap.c", + "minissdpc.c", "miniwget.c", + "upnpcommands.c", "upnpdev.c", - "igd_desc_parse.c", - "minissdpc.c", - "minisoap.c", - "minixml.c", + "upnpreplyparse.c", "connecthostport.c", - "receivedata.c", "portlistingparse.c", - "upnpreplyparse.c", + "receivedata.c", + "addr_is_reserved.c", ] thirdparty_sources = [thirdparty_dir + "miniupnpc/" + file for file in thirdparty_sources] diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp index cff13251ce..8e4e833d45 100644 --- a/modules/upnp/upnp.cpp +++ b/modules/upnp/upnp.cpp @@ -52,10 +52,12 @@ int UPNP::discover(int timeout, int ttl, const String &device_filter) { int error = 0; struct UPNPDev *devlist; + CharString cs = discover_multicast_if.utf8(); + const char *m_if = cs.length() ? cs.get_data() : nullptr; if (is_common_device(device_filter)) { - devlist = upnpDiscover(timeout, discover_multicast_if.utf8().get_data(), nullptr, discover_local_port, discover_ipv6, ttl, &error); + devlist = upnpDiscover(timeout, m_if, nullptr, discover_local_port, discover_ipv6, ttl, &error); } else { - devlist = upnpDiscoverAll(timeout, discover_multicast_if.utf8().get_data(), nullptr, discover_local_port, discover_ipv6, ttl, &error); + devlist = upnpDiscoverAll(timeout, m_if, nullptr, discover_local_port, discover_ipv6, ttl, &error); } if (error != UPNPDISCOVER_SUCCESS) { diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 2517b17168..e91ae46a57 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -1369,7 +1369,7 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int // Is a default value (unassigned input port). input_args[i] = &default_values[index]; } else { - // Rregular temporary in stack. + // Regular temporary in stack. input_args[i] = &variant_stack[index]; } } @@ -1391,7 +1391,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p ERR_FAIL_COND_V(!F, Variant()); Function *f = &F->get(); - // This call goes separate, so it can e yielded and suspended. + // This call goes separate, so it can be yielded and suspended. Variant *variant_stack = (Variant *)p_stack; bool *sequence_bits = (bool *)(variant_stack + f->max_stack); const Variant **input_args = (const Variant **)(sequence_bits + f->node_count); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index fcd55b3049..3b2cd50544 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -3958,7 +3958,7 @@ void VisualScriptEditor::_menu_option(int p_what) { if (start_node == -1) { // If we still don't have a start node then, // run through the nodes and select the first tree node, - // ie node without any input sequence but output sequence. + // i.e. node without any input sequence but output sequence. for (Set<int>::Element *E = nodes_from.front(); E; E = E->next()) { if (!nodes_to.has(E->get())) { start_node = E->get(); diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp index f673cbb06d..cb4230bea9 100644 --- a/modules/visual_script/visual_script_expression.cpp +++ b/modules/visual_script/visual_script_expression.cpp @@ -1054,7 +1054,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() { } } - /* Reduce the set set of expressions and place them in an operator tree, respecting precedence */ + /* Reduce the set of expressions and place them in an operator tree, respecting precedence */ while (expression.size() > 1) { int next_op = -1; diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index e2a8323509..e977f9c96b 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -800,7 +800,7 @@ public: } if (!ResourceCache::has(script)) { - //if the script is not in use by anyone, we can safely assume whathever we got is not casting to it. + //if the script is not in use by anyone, we can safely assume whatever we got is not casting to it. return 1; } Ref<Script> cast_script = Ref<Resource>(ResourceCache::get(script)); diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index b5aacb0506..9310b86627 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -547,7 +547,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to loong string + property.hint_string = bnode->get_path(); //convert to long string } } } @@ -1292,7 +1292,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to loong string + property.hint_string = bnode->get_path(); //convert to long string } } } @@ -1970,7 +1970,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to loong string + property.hint_string = bnode->get_path(); //convert to long string } } } diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp index 25fabd7b87..52fe659983 100644 --- a/modules/visual_script/visual_script_yield_nodes.cpp +++ b/modules/visual_script/visual_script_yield_nodes.cpp @@ -425,7 +425,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const { } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to loong string + property.hint_string = bnode->get_path(); //convert to long string } } } diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp index 011cb86535..758ed66c80 100644 --- a/modules/websocket/websocket_multiplayer_peer.cpp +++ b/modules/websocket/websocket_multiplayer_peer.cpp @@ -53,7 +53,7 @@ int WebSocketMultiplayerPeer::_gen_unique_id() const { (uint32_t)((uint64_t)this), hash); //rely on aslr heap hash = hash_djb2_one_32( (uint32_t)((uint64_t)&hash), hash); //rely on aslr stack - hash = hash & 0x7FFFFFFF; // make it compatible with unsigned, since negatie id is used for exclusion + hash = hash & 0x7FFFFFFF; // make it compatible with unsigned, since negative id is used for exclusion } return hash; @@ -186,7 +186,7 @@ void WebSocketMultiplayerPeer::_send_add(int32_t p_peer_id) { for (Map<int, Ref<WebSocketPeer>>::Element *E = _peer_map.front(); E; E = E->next()) { int32_t id = E->key(); if (p_peer_id == id) { - continue; // Skip the newwly added peer (already confirmed) + continue; // Skip the newly added peer (already confirmed) } // Send new peer to others @@ -314,7 +314,7 @@ void WebSocketMultiplayerPeer::_process_multiplayer(Ref<WebSocketPeer> p_peer, u _peer_map.erase(id); emit_signal("peer_disconnected", id); break; - case SYS_ID: // Helo, server assigned ID + case SYS_ID: // Hello, server assigned ID _peer_id = id; break; default: diff --git a/modules/xatlas_unwrap/register_types.cpp b/modules/xatlas_unwrap/register_types.cpp index fb4df10904..e1f9521a48 100644 --- a/modules/xatlas_unwrap/register_types.cpp +++ b/modules/xatlas_unwrap/register_types.cpp @@ -161,8 +161,11 @@ bool xatlas_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_ver const xatlas::Mesh &output = atlas->meshes[0]; *r_vertices = (int *)malloc(sizeof(int) * output.vertexCount); + ERR_FAIL_NULL_V_MSG(*r_vertices, false, "Out of memory."); *r_uvs = (float *)malloc(sizeof(float) * output.vertexCount * 2); + ERR_FAIL_NULL_V_MSG(*r_uvs, false, "Out of memory."); *r_indices = (int *)malloc(sizeof(int) * output.indexCount); + ERR_FAIL_NULL_V_MSG(*r_indices, false, "Out of memory."); float max_x = 0.0; float max_y = 0.0; |