mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 17:43:51 +00:00
feat(editor): NPC spawn list has name filter for fast lookup
A zone with 50+ creatures made finding a specific spawn tedious. Added a case-insensitive name-filter input above the list, capped at 200 visible entries with a 'refine filter' hint when exceeded.
This commit is contained in:
parent
eadb6a5886
commit
590ec6b3a3
1 changed files with 14 additions and 0 deletions
|
|
@ -1910,10 +1910,24 @@ void EditorUI::renderNpcPanel(EditorApp& app) {
|
|||
|
||||
// ---- Spawned list ----
|
||||
if (ImGui::CollapsingHeader("Spawned Creatures", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
static char spawnFilter[128] = "";
|
||||
ImGui::Text("%zu placed (double-click to fly to)", spawner.spawnCount());
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
ImGui::InputTextWithHint("##spawnfilter", "Filter by name...", spawnFilter, sizeof(spawnFilter));
|
||||
std::string filterLower(spawnFilter);
|
||||
std::transform(filterLower.begin(), filterLower.end(), filterLower.begin(),
|
||||
[](unsigned char c) { return std::tolower(c); });
|
||||
int shown = 0;
|
||||
ImGui::BeginChild("SpawnList", ImVec2(0, 100), true);
|
||||
for (int i = 0; i < static_cast<int>(spawner.spawnCount()); i++) {
|
||||
auto& s = spawner.getSpawns()[i];
|
||||
if (!filterLower.empty()) {
|
||||
std::string nameLower = s.name;
|
||||
std::transform(nameLower.begin(), nameLower.end(), nameLower.begin(),
|
||||
[](unsigned char c) { return std::tolower(c); });
|
||||
if (nameLower.find(filterLower) == std::string::npos) continue;
|
||||
}
|
||||
if (++shown > 200) { ImGui::Text("... refine filter"); break; }
|
||||
bool sel = (i == spawner.getSelectedIndex());
|
||||
char label[128];
|
||||
std::snprintf(label, sizeof(label), "%s Lv%u (%.0f,%.0f,%.0f)",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue