diff --git a/crates/benilla-assets/src/lib.rs b/crates/benilla-assets/src/lib.rs index 82276256..164de307 100644 --- a/crates/benilla-assets/src/lib.rs +++ b/crates/benilla-assets/src/lib.rs @@ -290,6 +290,20 @@ mod tests { ), "mpq://world/azeroth/redridge/passivedoodads/trees/redtreecanopy_base02@cc.blp" ); + + // And a **WMO** material name, which ships bare on this realm too. `wmo.rs` built this + // URL by hand until it was routed through here, so a MOMT with no extension lost its + // texture outright: Bevy had no extension to pick the BLP loader with and answered + // `Multiple AssetLoaders found … Extension: None`, then `Path not found`. The one in + // grom's 2026-10-28 log: + assert_eq!( + texture_url( + "TEXTURES\\Wetlands_Grimbatol\\mm_irnfg_trim_02flip", + (true, true) + ), + "mpq://textures/wetlands_grimbatol/mm_irnfg_trim_02flip.blp", + "a bare WMO material name gets the reference's appended .blp" + ); } #[test] diff --git a/crates/benilla-assets/src/wmo.rs b/crates/benilla-assets/src/wmo.rs index cc7ba08b..77ea067c 100644 --- a/crates/benilla-assets/src/wmo.rs +++ b/crates/benilla-assets/src/wmo.rs @@ -477,14 +477,26 @@ impl AssetLoader for WmoModelLoader { *slot = wmo_group_liquid_mesh(&gbytes); } for sub in subs { - // Lowercased: Bevy's loader lookup is case-sensitive, and an uppercase `.BLP` falls - // to type-based resolution, ambiguous with Bevy's own image loader. - let texture = sub.texture.as_deref().map(|t| { - ctx.load::(format!( - "mpq://{}", - t.replace('\\', "/").to_ascii_lowercase() - )) - }); + // Through `texture_url`, which does the same backslash fold and lowercase this + // did by hand — Bevy's loader lookup is case-sensitive, and an uppercase `.BLP` + // falls to type-based resolution, ambiguous with Bevy's own image loader — **and + // one thing more: it appends `.blp` to a name that has no extension**, as the + // reference's `CImageManager::CreateTexture` does. + // + // Doing it by hand here cost the texture outright on any MOMT whose name ships + // bare. The M2 loader has gone through `texture_url` all along (`m2.rs:323`), and + // the realm's WMOs ship bare names too: grom's 2026-10-28 log holds + // `ERROR Path not found: textures/wetlands_grimbatol/mm_irnfg_trim_02flip`, with a + // `Multiple AssetLoaders found … Extension: None` beside it — Bevy could not pick + // the BLP loader, so that submesh drew untextured. + // + // Repeat/repeat, which is what the hand-rolled path was: `texture_url` returns the + // plain `mpq://…` for that pair and marks the path only for a clamped mode, and a + // WMO submesh carries no wrap flags here to ask about. + let texture = sub + .texture + .as_deref() + .map(|t| ctx.load::(crate::texture_url(t, (true, true)))); submeshes.push(ModelSubmesh { texture, skin_slot: sub.skin_slot,