From b7182289236ea6ec49115aee7b131b49daf16ed0 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 13 Apr 2025 19:58:55 +0200 Subject: [PATCH] Write the spawner's name to the world in the WorldSpawner3DSpatialGizmoPlugin. --- .../editor/ess_editor_plugin.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/entity_spell_system/editor/ess_editor_plugin.cpp b/modules/entity_spell_system/editor/ess_editor_plugin.cpp index 8a0caf7c6..1128d59b5 100644 --- a/modules/entity_spell_system/editor/ess_editor_plugin.cpp +++ b/modules/entity_spell_system/editor/ess_editor_plugin.cpp @@ -36,6 +36,7 @@ #include "../world_spawners/ess_entity_world_spawner_3d.h" #include "scene/resources/mesh/mesh.h" +#include "scene/resources/mesh/primitive_meshes.h" void ESSEditorPlugin::fix_ids(Variant param) { } @@ -62,6 +63,7 @@ WorldSpawner3DSpatialGizmoPlugin::WorldSpawner3DSpatialGizmoPlugin() { const Color gizmo_color = EDITOR_DEF("editors/props/gizmo_colors/outline", Color(0.5, 0.5, 1)); create_material("outline_material", gizmo_color); + create_material("text_material", gizmo_color); } bool WorldSpawner3DSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) { @@ -81,7 +83,7 @@ bool WorldSpawner3DSpatialGizmoPlugin::can_be_hidden() const { } void WorldSpawner3DSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { - //ESSEntityWorldSpawner3D *ws = Object::cast_to(p_gizmo->get_spatial_node()); + ESSEntityWorldSpawner3D *ws = Object::cast_to(p_gizmo->get_spatial_node()); p_gizmo->clear(); @@ -138,4 +140,15 @@ void WorldSpawner3DSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { const Ref material = get_material("outline_material"); p_gizmo->add_mesh(cm, material); + + const Ref text_material = get_material("text_material"); + + Ref text_mesh; + text_mesh.instance(); + text_mesh->set_depth(0.01); + text_mesh->set_text(ws->get_name()); + text_mesh->set_font(EditorNode::get_singleton()->get_theme_base()->get_theme_font("main", "EditorFonts")); + Transform tt; + tt.set_origin(Vector3(0, 1.6, 0)); + p_gizmo->add_mesh(text_mesh, text_material, tt); }