Merge pull request #74347 from JohanAR/master

Fixed incorrect ERROR message when setting new PrimitiveMesh
This commit is contained in:
Rémi Verschelde 2023-03-08 08:55:24 +01:00
commit 02a35522f0
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -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();