summaryrefslogtreecommitdiff
path: root/scene/3d/mesh_instance_3d.cpp
diff options
context:
space:
mode:
authorYuri Sizov <11782833+YuriSizov@users.noreply.github.com>2023-03-14 16:00:02 +0100
committerGitHub <noreply@github.com>2023-03-14 16:00:02 +0100
commitfc7adaab7b3856a7831d402ea2bbb27efe7b7d8a (patch)
tree23902b836784f4c823d69f200b6aa2c1cffbc9f6 /scene/3d/mesh_instance_3d.cpp
parent258ea41ffa00a71bbb6ba9844840f18ba5802816 (diff)
parent38c0ad7c6c6b70f1ecac0a7962a60c3105b3d8e8 (diff)
Merge pull request #74907 from YuriSizov/4.0-cherrypicks
Cherry-picks for the 4.0 branch (future 4.0.1) - 3rd batch
Diffstat (limited to 'scene/3d/mesh_instance_3d.cpp')
-rw-r--r--scene/3d/mesh_instance_3d.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp
index 10a7a4e78b..86301ee53f 100644
--- a/scene/3d/mesh_instance_3d.cpp
+++ b/scene/3d/mesh_instance_3d.cpp
@@ -117,8 +117,10 @@ void MeshInstance3D::set_mesh(const Ref<Mesh> &p_mesh) {
mesh = p_mesh;
if (mesh.is_valid()) {
- mesh->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &MeshInstance3D::_mesh_changed));
+ // If mesh is a PrimitiveMesh, calling get_rid on it can trigger a changed callback
+ // so do this before connecting _mesh_changed.
set_base(mesh->get_rid());
+ mesh->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &MeshInstance3D::_mesh_changed));
_mesh_changed();
} else {
blend_shape_tracks.clear();