diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-10-14 14:09:56 -0500 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-10-14 14:09:56 -0500 |
commit | 3fcbb1d4365771687accbf09b88a77f44e9e34e8 (patch) | |
tree | 232bcb44f25ec2adb6db8437f17b815d5e96711f /scene/2d | |
parent | e15000eb4580f4171827a2103ec8d16f5ba5d30f (diff) | |
parent | 47f75547ce976988fd067c66ae6345d57771616b (diff) | |
download | redot-engine-3fcbb1d4365771687accbf09b88a77f44e9e34e8.tar.gz |
Merge pull request #97770 from tdaven/fix-94151
Fix immediate mesh modifications that don't call set_mesh
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/mesh_instance_2d.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp index ae45d431fe..1031a67343 100644 --- a/scene/2d/mesh_instance_2d.cpp +++ b/scene/2d/mesh_instance_2d.cpp @@ -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(); } |