feat(blueprints): added gltf file path for more informative error in case a gltf is missing

This commit is contained in:
kaosat.dev 2024-03-18 16:51:45 +01:00
parent d2e25a1a23
commit 6bee4ae25b

View File

@ -150,7 +150,7 @@ pub(crate) fn prepare_blueprints(
commands.entity(entity).insert(BlueprintAssetsLoaded); commands.entity(entity).insert(BlueprintAssetsLoaded);
} }
} else { } else {
// in case there are no blueprintsList // in case there are no blueprintsList, we revert back to the old behaviour
commands.entity(entity).insert(BlueprintAssetsLoaded); commands.entity(entity).insert(BlueprintAssetsLoaded);
} }
} }
@ -243,11 +243,14 @@ pub(crate) fn spawn_from_blueprints(
let model_path = Path::new(&library_path).join(Path::new(model_file_name.as_str())); let model_path = Path::new(&library_path).join(Path::new(model_file_name.as_str()));
// info!("attempting to spawn {:?}", model_path); // info!("attempting to spawn {:?}", model_path);
let model_handle: Handle<Gltf> = asset_server.load(model_path); // FIXME: kinda weird now let model_handle: Handle<Gltf> = asset_server.load(model_path.clone()); // FIXME: kinda weird now
let gltf = assets_gltf let gltf = assets_gltf.get(&model_handle).unwrap_or_else(|| {
.get(&model_handle) panic!(
.expect("this gltf should have been loaded"); "gltf file {:?} should have been loaded",
model_path.to_str()
)
});
// WARNING we work under the assumtion that there is ONLY ONE named scene, and that the first one is the right one // WARNING we work under the assumtion that there is ONLY ONE named scene, and that the first one is the right one
let main_scene_name = gltf let main_scene_name = gltf