mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 20:00:53 +00:00
fix(Blenvy:Bevy): added safeguard against files withouth scene level metadata
* normally this should NOT happen if the blueprints to spawn are correctly generated (by the Blender add-on) gltf files, but better safe (no unwrap!) than sorry
This commit is contained in:
parent
a618e0035e
commit
be0f4f1377
@ -156,7 +156,8 @@ pub(crate) fn blueprints_prepare_spawn(
|
|||||||
/* prefetch attempt */
|
/* prefetch attempt */
|
||||||
let gltf = RawGltf::open(format!("assets/{}", blueprint_info.path)).unwrap();
|
let gltf = RawGltf::open(format!("assets/{}", blueprint_info.path)).unwrap();
|
||||||
for scene in gltf.scenes() {
|
for scene in gltf.scenes() {
|
||||||
let scene_extras = scene.extras().clone().unwrap();
|
if let Some(scene_extras) = scene.extras().clone()
|
||||||
|
{
|
||||||
let lookup: HashMap<String, Value> = serde_json::from_str(scene_extras.get()).unwrap();
|
let lookup: HashMap<String, Value> = serde_json::from_str(scene_extras.get()).unwrap();
|
||||||
if lookup.contains_key("BlueprintAssets") {
|
if lookup.contains_key("BlueprintAssets") {
|
||||||
let assets_raw = &lookup["BlueprintAssets"];
|
let assets_raw = &lookup["BlueprintAssets"];
|
||||||
@ -195,6 +196,7 @@ pub(crate) fn blueprints_prepare_spawn(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// now insert load tracker
|
// now insert load tracker
|
||||||
// if there are assets to load
|
// if there are assets to load
|
||||||
|
Loading…
Reference in New Issue
Block a user