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