mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 06:11:29 +03:00
Skip Object::to_string when Jolt Physics is on separate thread
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "jolt_object_3d.h"
|
||||
|
||||
#include "../jolt_physics_server_3d.h"
|
||||
#include "../jolt_project_settings.h"
|
||||
#include "../spaces/jolt_layers.h"
|
||||
#include "../spaces/jolt_space_3d.h"
|
||||
@@ -137,6 +138,12 @@ bool JoltObject3D::can_interact_with(const JoltObject3D &p_other) const {
|
||||
}
|
||||
|
||||
String JoltObject3D::to_string() const {
|
||||
static const String fallback_name = "<unknown>";
|
||||
|
||||
if (JoltPhysicsServer3D::get_singleton()->is_on_separate_thread()) {
|
||||
return fallback_name; // Calling `Object::to_string` is not thread-safe.
|
||||
}
|
||||
|
||||
Object *instance = get_instance();
|
||||
return instance != nullptr ? instance->to_string() : "<unknown>";
|
||||
return instance != nullptr ? instance->to_string() : fallback_name;
|
||||
}
|
||||
|
||||
@@ -727,8 +727,3 @@ bool JoltSoftBody3D::is_vertex_pinned(int p_index) const {
|
||||
|
||||
return pinned_vertices.has(physics_index);
|
||||
}
|
||||
|
||||
String JoltSoftBody3D::to_string() const {
|
||||
Object *instance = get_instance();
|
||||
return instance != nullptr ? instance->to_string() : "<unknown>";
|
||||
}
|
||||
|
||||
@@ -167,8 +167,6 @@ public:
|
||||
void unpin_all_vertices();
|
||||
|
||||
bool is_vertex_pinned(int p_index) const;
|
||||
|
||||
String to_string() const;
|
||||
};
|
||||
|
||||
#endif // JOLT_SOFT_BODY_3D_H
|
||||
|
||||
Reference in New Issue
Block a user