Skip to content

Commit 82f2f20

Browse files
committed
Bind SurfaceTool::generate_tangents to a separate zero-arg helper
This avoids compatibility problems with default arguments in bindings.
1 parent e9f56b2 commit 82f2f20

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

scene/resources/surface_tool.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,10 @@ static void _propagate_tangents_or_split(LocalVector<SurfaceTool::Vertex> &r_ver
10961096
}
10971097
}
10981098

1099+
void SurfaceTool::_generate_tangents_bind() {
1100+
generate_tangents(/*split*/ false);
1101+
}
1102+
10991103
void SurfaceTool::generate_tangents(bool p_split) {
11001104
ERR_FAIL_COND_MSG(!generate_tangents_func, "Meshoptimizer library is not initialized.");
11011105
ERR_FAIL_COND_MSG(!(format & Mesh::ARRAY_FORMAT_TEX_UV), "UVs are required to generate tangents.");
@@ -1334,7 +1338,7 @@ void SurfaceTool::_bind_methods() {
13341338
ClassDB::bind_method(D_METHOD("index"), &SurfaceTool::index);
13351339
ClassDB::bind_method(D_METHOD("deindex"), &SurfaceTool::deindex);
13361340
ClassDB::bind_method(D_METHOD("generate_normals", "flip"), &SurfaceTool::generate_normals, DEFVAL(false));
1337-
ClassDB::bind_method(D_METHOD("generate_tangents", "split"), &SurfaceTool::generate_tangents, DEFVAL(false));
1341+
ClassDB::bind_method(D_METHOD("generate_tangents"), &SurfaceTool::_generate_tangents_bind);
13381342

13391343
ClassDB::bind_method(D_METHOD("optimize_indices_for_cache"), &SurfaceTool::optimize_indices_for_cache);
13401344

scene/resources/surface_tool.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ class SurfaceTool : public RefCounted {
180180

181181
void _add_triangle_fan(const Vector<Vector3> &p_vertices, const Vector<Vector2> &p_uvs = Vector<Vector2>(), const Vector<Color> &p_colors = Vector<Color>(), const Vector<Vector2> &p_uv2s = Vector<Vector2>(), const Vector<Vector3> &p_normals = Vector<Vector3>(), const TypedArray<Plane> &p_tangents = TypedArray<Plane>());
182182

183+
void _generate_tangents_bind();
184+
183185
protected:
184186
static void _bind_methods();
185187

0 commit comments

Comments
 (0)