summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scene/2d/mesh_instance_2d.cpp13
-rw-r--r--scene/resources/immediate_mesh.cpp2
2 files changed, 15 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();
}
diff --git a/scene/resources/immediate_mesh.cpp b/scene/resources/immediate_mesh.cpp
index 907c0ab4ca..072542f0ad 100644
--- a/scene/resources/immediate_mesh.cpp
+++ b/scene/resources/immediate_mesh.cpp
@@ -312,6 +312,8 @@ void ImmediateMesh::surface_end() {
uses_uv2s = false;
surface_active = false;
+
+ emit_changed();
}
void ImmediateMesh::clear_surfaces() {