From 63fe5da04ed03b48245bf88486ae998e14f587b6 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 01:51:59 -0700 Subject: [PATCH] feat(editor): selected NPC marker is larger and yellow-cyan tinted Marker geometry now reacts to npc.selected: 2.5x base radius (vs 1.5x), saturated yellow with cyan tinge, and full alpha. Marker rebuild also fires on selection change so the highlight appears immediately rather than only after the next placement. --- tools/editor/editor_app.cpp | 5 ++++- tools/editor/editor_app.hpp | 1 + tools/editor/editor_viewport.cpp | 11 +++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/editor/editor_app.cpp b/tools/editor/editor_app.cpp index 802e4b91..e51c7cbc 100644 --- a/tools/editor/editor_app.cpp +++ b/tools/editor/editor_app.cpp @@ -122,12 +122,15 @@ void EditorApp::run() { size_t objCount = objectPlacer_.objectCount(); size_t npcCount = npcSpawner_.spawnCount(); bool objChanged = (objCount != lastObjCount_); - bool npcChanged = (npcCount != lastNpcCount_) || objectsDirty_; + int npcSelIdx = npcSpawner_.getSelectedIndex(); + bool npcSelChanged = (npcSelIdx != lastNpcSelIdx_); + bool npcChanged = (npcCount != lastNpcCount_) || objectsDirty_ || npcSelChanged; if (npcChanged) { // NPC markers are cheap — always update viewport_.updateNpcMarkers(npcSpawner_.getSpawns()); lastNpcCount_ = npcCount; + lastNpcSelIdx_ = npcSelIdx; } // Show gizmo arrows on selected object or NPC. NPCs only support move diff --git a/tools/editor/editor_app.hpp b/tools/editor/editor_app.hpp index 2673f633..73587c24 100644 --- a/tools/editor/editor_app.hpp +++ b/tools/editor/editor_app.hpp @@ -175,6 +175,7 @@ public: private: size_t lastObjCount_ = 0; size_t lastNpcCount_ = 0; + int lastNpcSelIdx_ = -1; EditorMode mode_ = EditorMode::Sculpt; float waterHeight_ = 100.0f; uint16_t waterType_ = 0; diff --git a/tools/editor/editor_viewport.cpp b/tools/editor/editor_viewport.cpp index be4ef8c2..0916b285 100644 --- a/tools/editor/editor_viewport.cpp +++ b/tools/editor/editor_viewport.cpp @@ -520,11 +520,14 @@ void EditorViewport::updateNpcMarkers(const std::vector& npcs) { struct MV { float pos[3]; float color[4]; }; std::vector verts; for (const auto& npc : npcs) { - float s = 1.5f; // base radius (was 5) + // Selected NPC: larger marker in cyan-yellow so it pops out among + // hostile/friendly markers without losing the hostile colour signal. + float s = npc.selected ? 2.5f : 1.5f; float x = npc.position.x, y = npc.position.y, z = npc.position.z; - float r = npc.hostile ? 1.0f : 0.1f; - float g = npc.hostile ? 0.15f : 0.9f; - float b = 0.1f, a = 0.7f; + float r = npc.selected ? 1.0f : (npc.hostile ? 1.0f : 0.1f); + float g = npc.selected ? 1.0f : (npc.hostile ? 0.15f : 0.9f); + float b = npc.selected ? 0.2f : 0.1f; + float a = npc.selected ? 1.0f : 0.7f; MV v; v.color[0]=r; v.color[1]=g; v.color[2]=b; v.color[3]=a; // Small octagonal base