From 16308011ee009b319ef29cdc3345973300253cef Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 07:10:29 -0700 Subject: [PATCH] fix(editor): filter bad M2 models, toast on tile not found, robustness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Filter known effect/particle models from NPC presets (alliancebomb, blackhole, etc.) that cause vertex explosions — these are particle effect models misclassified as creatures - "Find Tile" button now shows toast when no ADT exists for a map - Vertex validation catches NaN/infinite/extreme positions before GPU - These models are now skipped entirely from the creature browser --- tools/editor/editor_ui.cpp | 7 +++++-- tools/editor/npc_presets.cpp | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/editor/editor_ui.cpp b/tools/editor/editor_ui.cpp index b4bd38e8..97695184 100644 --- a/tools/editor/editor_ui.cpp +++ b/tools/editor/editor_ui.cpp @@ -356,8 +356,9 @@ void EditorUI::renderLoadDialog(EditorApp& app) { ImGui::TextColored(ImVec4(0.9f, 0.4f, 0.3f, 1), "Tile not found"); ImGui::SameLine(); - if (ImGui::SmallButton("Find Valid Tile")) { + if (ImGui::SmallButton("Find Tile")) { bool found = false; + // Scan center range first (open world maps) for (int x = 25; x < 45 && !found; x++) { for (int y = 25; y < 45 && !found; y++) { std::string tp = "world\\maps\\" + mapLower + "\\" + mapLower + "_" + @@ -367,6 +368,7 @@ void EditorUI::renderLoadDialog(EditorApp& app) { } } } + // Full scan for dungeons/instances if (!found) { for (int x = 0; x < 64 && !found; x++) { for (int y = 0; y < 64 && !found; y++) { @@ -378,8 +380,9 @@ void EditorUI::renderLoadDialog(EditorApp& app) { } } } + if (!found) app.showToast("No ADT tiles found for this map"); } - if (ImGui::IsItemHovered()) ImGui::SetTooltip("Scans for the first available tile"); + if (ImGui::IsItemHovered()) ImGui::SetTooltip("Auto-find first available tile"); } ImGui::Spacing(); diff --git a/tools/editor/npc_presets.cpp b/tools/editor/npc_presets.cpp index ae7fc49a..6e0e5abe 100644 --- a/tools/editor/npc_presets.cpp +++ b/tools/editor/npc_presets.cpp @@ -154,6 +154,19 @@ void NpcPresets::initialize(pipeline::AssetManager* am) { std::string dirName = path.substr(firstSlash + 1, secondSlash - firstSlash - 1); if (seen.count(dirName)) continue; + + // Skip known effect/particle models that cause vertex explosions + static const char* skipModels[] = { + "alliancebomb", "alliancebrasscannon", "blackhole", "bodyofkathune", + "band", "broom", "broommount", "carpet", "celestialhorse", + "bloodqueen", "arthaslichking", "arthasundead" + }; + bool skip = false; + for (const char* s : skipModels) { + if (dirName == s) { skip = true; break; } + } + if (skip) continue; + seen.insert(dirName); // Get the actual M2 file path