Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.3] Merge commit godotengine/godot@7f166be #956

Merged
merged 11 commits into from
Feb 4, 2025
Merged
6 changes: 3 additions & 3 deletions doc/classes/Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
var array = new Godot.Collections.Array{"First", 2, 3, "Last"};
GD.Print(array[0]); // Prints "First"
GD.Print(array[2]); // Prints 3
GD.Print(array[array.Count - 1]); // Prints "Last"
GD.Print(array[^1]); // Prints "Last"

array[2] = "Second";
array[1] = "Second";
GD.Print(array[1]); // Prints "Second"
GD.Print(array[array.Count - 3]); // Prints "Second"
GD.Print(array[^3]); // Prints "Second"
[/csharp]
[/codeblocks]
[b]Note:[/b] Arrays are always passed by [b]reference[/b]. To get a copy of an array that can be modified independently of the original array, use [method duplicate].
Expand Down
6 changes: 3 additions & 3 deletions doc/classes/DTLSServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
server.listen(4242)
var key = load("key.key") # Your private key.
var cert = load("cert.crt") # Your X509 certificate.
dtls.setup(key, cert)
dtls.setup(TlsOptions.server(key, cert))

func _process(delta):
while server.is_connection_available():
Expand Down Expand Up @@ -52,12 +52,12 @@
_server.Listen(4242);
var key = GD.Load<CryptoKey>("key.key"); // Your private key.
var cert = GD.Load<X509Certificate>("cert.crt"); // Your X509 certificate.
_dtls.Setup(key, cert);
_dtls.Setup(TlsOptions.Server(key, cert));
}

public override void _Process(double delta)
{
while (Server.IsConnectionAvailable())
while (_server.IsConnectionAvailable())
{
PacketPeerUdp peer = _server.TakeConnection();
PacketPeerDtls dtlsPeer = _dtls.TakeConnection(peer);
Expand Down
6 changes: 3 additions & 3 deletions doc/classes/Window.xml
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,13 @@
[/gdscript]
[csharp]
// Set region, using Path2D node.
GetNode<Window>("Window").MousePassthrough = GetNode<Path2D>("Path2D").Curve.GetBakedPoints();
GetNode<Window>("Window").MousePassthroughPolygon = GetNode<Path2D>("Path2D").Curve.GetBakedPoints();

// Set region, using Polygon2D node.
GetNode<Window>("Window").MousePassthrough = GetNode<Polygon2D>("Polygon2D").Polygon;
GetNode<Window>("Window").MousePassthroughPolygon = GetNode<Polygon2D>("Polygon2D").Polygon;

// Reset region to default.
GetNode<Window>("Window").MousePassthrough = new Vector2[] {};
GetNode<Window>("Window").MousePassthroughPolygon = new Vector2[] {};
[/csharp]
[/codeblocks]
[b]Note:[/b] This property is ignored if [member mouse_passthrough] is set to [code]true[/code].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ void GLTFDocumentExtensionConvertImporterMesh::_copy_meta(Object *p_src_object,
}
}

MeshInstance3D *GLTFDocumentExtensionConvertImporterMesh::convert_importer_mesh_instance_3d(ImporterMeshInstance3D *p_importer_mesh_instance_3d) {
// Convert the node itself first.
MeshInstance3D *mesh_instance_node_3d = memnew(MeshInstance3D);
ERR_FAIL_NULL_V(p_importer_mesh_instance_3d, mesh_instance_node_3d);
mesh_instance_node_3d->set_name(p_importer_mesh_instance_3d->get_name());
mesh_instance_node_3d->set_transform(p_importer_mesh_instance_3d->get_transform());
mesh_instance_node_3d->set_skin(p_importer_mesh_instance_3d->get_skin());
mesh_instance_node_3d->set_skeleton_path(p_importer_mesh_instance_3d->get_skeleton_path());
mesh_instance_node_3d->set_visible(p_importer_mesh_instance_3d->is_visible());
p_importer_mesh_instance_3d->replace_by(mesh_instance_node_3d);
_copy_meta(p_importer_mesh_instance_3d, mesh_instance_node_3d);
// Convert the mesh data in the mesh resource.
Ref<ImporterMesh> importer_mesh = p_importer_mesh_instance_3d->get_mesh();
if (importer_mesh.is_valid()) {
Ref<ArrayMesh> array_mesh = importer_mesh->get_mesh();
mesh_instance_node_3d->set_mesh(array_mesh);
_copy_meta(importer_mesh.ptr(), array_mesh.ptr());
} else {
WARN_PRINT("glTF: ImporterMeshInstance3D does not have a valid mesh. This should not happen. Continuing anyway.");
}
return mesh_instance_node_3d;
}

Error GLTFDocumentExtensionConvertImporterMesh::import_post(Ref<GLTFState> p_state, Node *p_root) {
ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
Expand All @@ -59,24 +82,8 @@ Error GLTFDocumentExtensionConvertImporterMesh::import_post(Ref<GLTFState> p_sta
Node *node = E->get();
ImporterMeshInstance3D *importer_mesh_3d = Object::cast_to<ImporterMeshInstance3D>(node);
if (importer_mesh_3d) {
MeshInstance3D *mesh_instance_node_3d = memnew(MeshInstance3D);
Ref<ImporterMesh> mesh = importer_mesh_3d->get_mesh();
if (mesh.is_valid()) {
Ref<ArrayMesh> array_mesh = mesh->get_mesh();
mesh_instance_node_3d->set_name(node->get_name());
mesh_instance_node_3d->set_transform(importer_mesh_3d->get_transform());
mesh_instance_node_3d->set_mesh(array_mesh);
mesh_instance_node_3d->set_skin(importer_mesh_3d->get_skin());
mesh_instance_node_3d->set_skeleton_path(importer_mesh_3d->get_skeleton_path());
mesh_instance_node_3d->set_visible(importer_mesh_3d->is_visible());
node->replace_by(mesh_instance_node_3d);
_copy_meta(importer_mesh_3d, mesh_instance_node_3d);
_copy_meta(mesh.ptr(), array_mesh.ptr());
delete_queue.push_back(node);
node = mesh_instance_node_3d;
} else {
memdelete(mesh_instance_node_3d);
}
delete_queue.push_back(importer_mesh_3d);
node = convert_importer_mesh_instance_3d(importer_mesh_3d);
}
int child_count = node->get_child_count();
for (int i = 0; i < child_count; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

#include "gltf_document_extension.h"

class MeshInstance3D;

class GLTFDocumentExtensionConvertImporterMesh : public GLTFDocumentExtension {
GDCLASS(GLTFDocumentExtensionConvertImporterMesh, GLTFDocumentExtension);

Expand All @@ -43,6 +45,7 @@ class GLTFDocumentExtensionConvertImporterMesh : public GLTFDocumentExtension {
static void _copy_meta(Object *p_src_object, Object *p_dst_object);

public:
static MeshInstance3D *convert_importer_mesh_instance_3d(ImporterMeshInstance3D *p_importer_mesh_instance_3d);
Error import_post(Ref<GLTFState> p_state, Node *p_root) override;
};

Expand Down
6 changes: 6 additions & 0 deletions modules/gltf/gltf_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "gltf_document.h"

#include "extensions/gltf_document_extension_convert_importer_mesh.h"
#include "extensions/gltf_spec_gloss.h"
#include "gltf_state.h"
#include "skin_tool.h"
Expand Down Expand Up @@ -7338,6 +7339,11 @@ Node *GLTFDocument::generate_scene(Ref<GLTFState> p_state, float p_bake_fps, boo
ERR_CONTINUE(err != OK);
}
}
ImporterMeshInstance3D *root_importer_mesh = Object::cast_to<ImporterMeshInstance3D>(root);
if (unlikely(root_importer_mesh)) {
root = GLTFDocumentExtensionConvertImporterMesh::convert_importer_mesh_instance_3d(root_importer_mesh);
memdelete(root_importer_mesh);
}
for (Ref<GLTFDocumentExtension> ext : document_extensions) {
ERR_CONTINUE(ext.is_null());
err = ext->import_post(p_state, root);
Expand Down
3 changes: 0 additions & 3 deletions modules/navigation/nav_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@ Vector3 NavMap::get_closest_point_to_segment(const Vector3 &p_from, const Vector
}

Vector3 NavMap::get_closest_point(const Vector3 &p_point) const {
RWLockRead read_lock(map_rwlock);
if (iteration_id == 0) {
NAVMAP_ITERATION_ZERO_ERROR_MSG();
return Vector3();
Expand All @@ -682,7 +681,6 @@ Vector3 NavMap::get_closest_point(const Vector3 &p_point) const {
}

Vector3 NavMap::get_closest_point_normal(const Vector3 &p_point) const {
RWLockRead read_lock(map_rwlock);
if (iteration_id == 0) {
NAVMAP_ITERATION_ZERO_ERROR_MSG();
return Vector3();
Expand All @@ -692,7 +690,6 @@ Vector3 NavMap::get_closest_point_normal(const Vector3 &p_point) const {
}

RID NavMap::get_closest_point_owner(const Vector3 &p_point) const {
RWLockRead read_lock(map_rwlock);
if (iteration_id == 0) {
NAVMAP_ITERATION_ZERO_ERROR_MSG();
return RID();
Expand Down
1 change: 1 addition & 0 deletions thirdparty/glslang/SPIRV/SpvBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ namespace spv {
}

#include <algorithm>
#include <cstdint>
#include <map>
#include <memory>
#include <set>
Expand Down
12 changes: 12 additions & 0 deletions thirdparty/glslang/patches/fix-build-gcc15.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/thirdparty/glslang/SPIRV/SpvBuilder.h b/thirdparty/glslang/SPIRV/SpvBuilder.h
index a65a98e337..1499592c4f 100644
--- a/thirdparty/glslang/SPIRV/SpvBuilder.h
+++ b/thirdparty/glslang/SPIRV/SpvBuilder.h
@@ -56,6 +56,7 @@ namespace spv {
}

#include <algorithm>
+#include <cstdint>
#include <map>
#include <memory>
#include <set>
1 change: 1 addition & 0 deletions thirdparty/thorvg/inc/thorvg.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef _THORVG_H_
#define _THORVG_H_

#include <cstdint>
#include <functional>
#include <memory>
#include <string>
Expand Down
12 changes: 12 additions & 0 deletions thirdparty/thorvg/patches/fix-build-gcc15.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/thirdparty/thorvg/inc/thorvg.h b/thirdparty/thorvg/inc/thorvg.h
index 8e3ab4e6ce..f515a03136 100644
--- a/thirdparty/thorvg/inc/thorvg.h
+++ b/thirdparty/thorvg/inc/thorvg.h
@@ -1,6 +1,7 @@
#ifndef _THORVG_H_
#define _THORVG_H_

+#include <cstdint>
#include <functional>
#include <memory>
#include <string>