diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp index bc0b096c80..1d5f2ae700 100644 --- a/scene/2d/mesh_instance_2d.cpp +++ b/scene/2d/mesh_instance_2d.cpp @@ -86,6 +86,7 @@ void MeshInstance2D::set_mesh(const Ref &p_mesh) { } queue_redraw(); + update_configuration_warnings(); } Ref MeshInstance2D::get_mesh() const { @@ -217,5 +218,10 @@ void MeshInstance2D::navmesh_parse_source_geometry(const Ref } #endif // NAVIGATION_2D_DISABLED -MeshInstance2D::MeshInstance2D() { +PackedStringArray MeshInstance2D::get_configuration_warnings() const { + PackedStringArray warnings = Node2D::get_configuration_warnings(); + if (mesh.is_null()) { + warnings.push_back(RTR("MeshInstance2D requires a Mesh to render anything. Please add a mesh resource for it!")); + } + return warnings; } diff --git a/scene/2d/mesh_instance_2d.h b/scene/2d/mesh_instance_2d.h index 2f72dca9c1..733f8c3b79 100644 --- a/scene/2d/mesh_instance_2d.h +++ b/scene/2d/mesh_instance_2d.h @@ -69,5 +69,5 @@ public: static void navmesh_parse_source_geometry(const Ref &p_navigation_mesh, Ref p_source_geometry_data, Node *p_node); #endif // NAVIGATION_2D_DISABLED - MeshInstance2D(); + virtual PackedStringArray get_configuration_warnings() const override; }; diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index e7df431475..de9ff24677 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -136,6 +136,7 @@ void MeshInstance3D::set_mesh(const Ref &p_mesh) { } notify_property_list_changed(); + update_configuration_warnings(); } Ref MeshInstance3D::get_mesh() const { @@ -933,6 +934,14 @@ void MeshInstance3D::_bind_methods() { ADD_GROUP("", ""); } +PackedStringArray MeshInstance3D::get_configuration_warnings() const { + PackedStringArray warnings = GeometryInstance3D::get_configuration_warnings(); + if (mesh.is_null()) { + warnings.push_back(RTR("MeshInstance3D requires a Mesh to render anything. Please add a mesh resource for it!")); + } + return warnings; +} + MeshInstance3D::MeshInstance3D() { _define_ancestry(AncestralClass::MESH_INSTANCE_3D); #ifndef DISABLE_DEPRECATED @@ -941,6 +950,3 @@ MeshInstance3D::MeshInstance3D() { } #endif } - -MeshInstance3D::~MeshInstance3D() { -} diff --git a/scene/3d/mesh_instance_3d.h b/scene/3d/mesh_instance_3d.h index 34a344da69..fdd9f80aac 100644 --- a/scene/3d/mesh_instance_3d.h +++ b/scene/3d/mesh_instance_3d.h @@ -132,6 +132,7 @@ public: static void navmesh_parse_source_geometry(const Ref &p_navigation_mesh, Ref p_source_geometry_data, Node *p_node); #endif // NAVIGATION_3D_DISABLED + virtual PackedStringArray get_configuration_warnings() const override; + MeshInstance3D(); - ~MeshInstance3D(); };