Allow to compile templates without physics servers

This commit is contained in:
Michael Alexsander
2025-02-27 19:01:23 -03:00
parent b13c96b097
commit 5ad414d046
72 changed files with 951 additions and 364 deletions

View File

@ -34,10 +34,10 @@
#include "core/templates/pair.h"
#include "scene/resources/surface_tool.h"
#ifndef _3D_DISABLED
#ifndef PHYSICS_3D_DISABLED
#include "scene/resources/3d/concave_polygon_shape_3d.h"
#include "scene/resources/3d/convex_polygon_shape_3d.h"
#endif // _3D_DISABLED
#endif // PHYSICS_3D_DISABLED
void MeshConvexDecompositionSettings::set_max_concavity(real_t p_max_concavity) {
max_concavity = CLAMP(p_max_concavity, 0.001, 1.0);
@ -201,7 +201,9 @@ void MeshConvexDecompositionSettings::_bind_methods() {
BIND_ENUM_CONSTANT(CONVEX_DECOMPOSITION_MODE_TETRAHEDRON);
}
#ifndef PHYSICS_3D_DISABLED
Mesh::ConvexDecompositionFunc Mesh::convex_decomposition_function = nullptr;
#endif // PHYSICS_3D_DISABLED
int Mesh::get_surface_count() const {
int ret = 0;
@ -521,7 +523,7 @@ Vector<Face3> Mesh::get_surface_faces(int p_surface) const {
return Vector<Face3>();
}
#ifndef _3D_DISABLED
#ifndef PHYSICS_3D_DISABLED
Ref<ConvexPolygonShape3D> Mesh::create_convex_shape(bool p_clean, bool p_simplify) const {
if (p_simplify) {
Ref<MeshConvexDecompositionSettings> settings = Ref<MeshConvexDecompositionSettings>();
@ -581,7 +583,7 @@ Ref<ConcavePolygonShape3D> Mesh::create_trimesh_shape() const {
shape->set_faces(face_points);
return shape;
}
#endif // _3D_DISABLED
#endif // PHYSICS_3D_DISABLED
Ref<Mesh> Mesh::create_outline(float p_margin) const {
Array arrays;
@ -900,7 +902,7 @@ void Mesh::clear_cache() const {
debug_lines.clear();
}
#ifndef _3D_DISABLED
#ifndef PHYSICS_3D_DISABLED
Vector<Ref<Shape3D>> Mesh::convex_decompose(const Ref<MeshConvexDecompositionSettings> &p_settings) const {
ERR_FAIL_NULL_V(convex_decomposition_function, Vector<Ref<Shape3D>>());
@ -937,7 +939,7 @@ Vector<Ref<Shape3D>> Mesh::convex_decompose(const Ref<MeshConvexDecompositionSet
return ret;
}
#endif // _3D_DISABLED
#endif // PHYSICS_3D_DISABLED
int Mesh::get_builtin_bind_pose_count() const {
return 0;
@ -2297,10 +2299,10 @@ void ArrayMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("surface_find_by_name", "name"), &ArrayMesh::surface_find_by_name);
ClassDB::bind_method(D_METHOD("surface_set_name", "surf_idx", "name"), &ArrayMesh::surface_set_name);
ClassDB::bind_method(D_METHOD("surface_get_name", "surf_idx"), &ArrayMesh::surface_get_name);
#ifndef _3D_DISABLED
#ifndef PHYSICS_3D_DISABLED
ClassDB::bind_method(D_METHOD("create_trimesh_shape"), &ArrayMesh::create_trimesh_shape);
ClassDB::bind_method(D_METHOD("create_convex_shape", "clean", "simplify"), &ArrayMesh::create_convex_shape, DEFVAL(true), DEFVAL(false));
#endif // _3D_DISABLED
#endif // PHYSICS_3D_DISABLED
ClassDB::bind_method(D_METHOD("create_outline", "margin"), &ArrayMesh::create_outline);
ClassDB::bind_method(D_METHOD("regen_normal_maps"), &ArrayMesh::regen_normal_maps);
ClassDB::set_method_flags(get_class_static(), _scs_create("regen_normal_maps"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);