diff options
author | Spartan322 <Megacake1234@gmail.com> | 2024-10-15 06:49:10 -0400 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2024-10-15 06:49:10 -0400 |
commit | 8043cc1e0d288d7b517d13f14c912c636293cc8b (patch) | |
tree | 79fdac1a76ad232c040f25a4fbae974ac245edda /scene/2d | |
parent | 7894cd1a5a680020c51e0df96ce8675ad647d91b (diff) | |
parent | af77100e394dcaca609b15bef815ed17475e51ed (diff) | |
download | redot-engine-8043cc1e0d288d7b517d13f14c912c636293cc8b.tar.gz |
Merge commit godotengine/godot@af77100e394dcaca609b15bef815ed17475e51ed
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 575cf3a94d..8aca977c97 100644 --- a/scene/2d/mesh_instance_2d.cpp +++ b/scene/2d/mesh_instance_2d.cpp @@ -56,7 +56,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(); } |