Skip to content

Commit

Permalink
fix(bevy_gltf_blueprints): fixed aabb caching issue (kaosat-dev#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaosat-dev authored Nov 25, 2023
1 parent 9a765d5 commit 21ad422
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/bevy_gltf_blueprints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_gltf_blueprints"
version = "0.3.2"
version = "0.3.3"
authors = ["Mark 'kaosat-dev' Moissette"]
description = "Adds the ability to define Blueprints/Prefabs for [Bevy](https://bevyengine.org/) inside gltf files and spawn them in Bevy."
homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
Expand Down
9 changes: 7 additions & 2 deletions crates/bevy_gltf_blueprints/src/aabb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ pub fn compute_scene_aabbs(
let root_entity = root_entity.2.first().unwrap();

// only recompute aabb if it has not already been done before
if !blueprints_config.aabb_cache.contains_key(&name.to_string()) {
if blueprints_config.aabb_cache.contains_key(&name.to_string()) {
let aabb = blueprints_config
.aabb_cache
.get(&name.to_string())
.expect("we should have the aabb available");
commands.entity(*root_entity).insert(*aabb);
} else {
let aabb = compute_descendant_aabb(*root_entity, &children, &existing_aabbs);
commands.entity(*root_entity).insert(aabb);

blueprints_config.aabb_cache.insert(name.to_string(), aabb);
}
}
Expand Down

0 comments on commit 21ad422

Please sign in to comment.