Merge pull request #97770 from tdaven/fix-94151

Fix immediate mesh modifications that don't call set_mesh
This commit is contained in:
Thaddeus Crews 2024-10-14 14:09:56 -05:00
commit 3fcbb1d436
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84
2 changed files with 15 additions and 0 deletions

View file

@ -54,7 +54,20 @@ void MeshInstance2D::_bind_methods() {
}
void MeshInstance2D::set_mesh(const Ref<Mesh> &p_mesh) {
if (mesh == p_mesh) {
return;
}
if (mesh.is_valid()) {
mesh->disconnect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
}
mesh = p_mesh;
if (mesh.is_valid()) {
mesh->connect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
}
queue_redraw();
}

View file

@ -312,6 +312,8 @@ void ImmediateMesh::surface_end() {
uses_uv2s = false;
surface_active = false;
emit_changed();
}
void ImmediateMesh::clear_surfaces() {