mirror of
https://github.com/godotengine/godot.git
synced 2024-11-23 20:53:15 +00:00
Fixed incorrect ERROR message when setting new PrimitiveMesh
If calling set_mesh with a PrimitiveMesh that has pending update, the
_mesh_changed function would be called twice. The first time before
set_base had been called, which could lead to an ERROR message about
trying to set an invalid surface override material.
(cherry picked from commit 007b488a5c
)
This commit is contained in:
parent
89a40d317d
commit
d229ca2f27
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user