diff --git a/doc/classes/EditorNode3DGizmo.xml b/doc/classes/EditorNode3DGizmo.xml index c804bb70e04..60c329935a6 100644 --- a/doc/classes/EditorNode3DGizmo.xml +++ b/doc/classes/EditorNode3DGizmo.xml @@ -135,7 +135,7 @@ - + diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index 154f9bd6b73..60ba98a706a 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -244,8 +244,10 @@ void EditorNode3DGizmo::Instance::create_instance(Node3D *p_base, bool p_hidden) RS::get_singleton()->instance_geometry_set_flag(instance, RS::INSTANCE_FLAG_IGNORE_OCCLUSION_CULLING, true); } -void EditorNode3DGizmo::add_mesh(const Ref &p_mesh, const Ref &p_material, const Transform3D &p_xform, const Ref &p_skin_reference) { +void EditorNode3DGizmo::add_mesh(const Ref &p_mesh, const Ref &p_material, const Transform3D &p_xform, const Ref &p_skin_reference) { ERR_FAIL_COND(!spatial_node); + ERR_FAIL_COND_MSG(!p_mesh.is_valid(), "EditorNode3DGizmo.add_mesh() requires a valid Mesh resource."); + Instance ins; ins.mesh = p_mesh; diff --git a/editor/plugins/node_3d_editor_gizmos.h b/editor/plugins/node_3d_editor_gizmos.h index 56e4ad55188..cf9a464b696 100644 --- a/editor/plugins/node_3d_editor_gizmos.h +++ b/editor/plugins/node_3d_editor_gizmos.h @@ -45,7 +45,7 @@ class EditorNode3DGizmo : public Node3DGizmo { struct Instance { RID instance; - Ref mesh; + Ref mesh; Ref material; Ref skin_reference; bool extra_margin = false; @@ -95,7 +95,7 @@ protected: public: void add_lines(const Vector &p_lines, const Ref &p_material, bool p_billboard = false, const Color &p_modulate = Color(1, 1, 1)); void add_vertices(const Vector &p_vertices, const Ref &p_material, Mesh::PrimitiveType p_primitive_type, bool p_billboard = false, const Color &p_modulate = Color(1, 1, 1)); - void add_mesh(const Ref &p_mesh, const Ref &p_material = Ref(), const Transform3D &p_xform = Transform3D(), const Ref &p_skin_reference = Ref()); + void add_mesh(const Ref &p_mesh, const Ref &p_material = Ref(), const Transform3D &p_xform = Transform3D(), const Ref &p_skin_reference = Ref()); void add_collision_segments(const Vector &p_lines); void add_collision_triangles(const Ref &p_tmesh); void add_unscaled_billboard(const Ref &p_material, real_t p_scale = 1, const Color &p_modulate = Color(1, 1, 1));