From 47662fe4ba5d8d3eaac4e66303a929f2ad60ea25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Rom=C3=A1n=20N=C3=BA=C3=B1ez?= Date: Mon, 14 Sep 2026 15:03:24 +0200 Subject: [PATCH] Fix absolute gltf asset paths too. --- src/fighter/baked_animation.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/fighter/baked_animation.rs b/src/fighter/baked_animation.rs index 50916c0..8c4e2c0 100644 --- a/src/fighter/baked_animation.rs +++ b/src/fighter/baked_animation.rs @@ -3,6 +3,7 @@ use std::{ collections::{HashMap, HashSet}, io, + path::Path, }; use bevy::{ @@ -547,12 +548,8 @@ impl AssetLoader for FighterBakeSourceLoader { let manifest: FighterManifest = ron::de::from_bytes(&manifest_bytes) .map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?; - let model_path = load_context - .path() - .resolve_embed_str(&manifest.model_path) - .map_err(|error| io::Error::other(error.to_string()))?; let model_bytes = load_context - .read_asset_bytes(model_path.clone_owned()) + .read_asset_bytes(&manifest.model_path) .await .map_err(|error| io::Error::other(error.to_string()))?; @@ -562,11 +559,12 @@ impl AssetLoader for FighterBakeSourceLoader { for buffer in gltf.buffers() { let bytes = match buffer.source() { gltf::buffer::Source::Uri(uri) => load_context - .read_asset_bytes( - model_path - .resolve_embed_str(uri) - .map_err(|error| io::Error::other(error.to_string()))?, - ) + .read_asset_bytes(AssetPath::from_path_buf( + Path::new(&manifest.model_path) + .parent() + .unwrap_or_else(|| Path::new("")) + .join(uri), + )) .await .map_err(|error| io::Error::other(error.to_string()))?, gltf::buffer::Source::Bin => gltf.blob.clone().ok_or_else(|| {