Skip to content

Commit

Permalink
Add VisibilityBundle and use it to fix gltfs, scenes, and examples (#…
Browse files Browse the repository at this point in the history
…5335)

# Objective

Gltfs, and a few examples were broken by #5310. Fix em.

Closes #5334

## Solution

Add `VisibilityBundle` as described here: bevyengine/bevy#5334 (comment) and sprinkle it around where needed.
  • Loading branch information
rparrett committed Jul 16, 2022
1 parent ddc5033 commit 1d3a1f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use bevy_render::{
render_resource::{AddressMode, Face, FilterMode, PrimitiveTopology, SamplerDescriptor},
renderer::RenderDevice,
texture::{CompressedImageFormats, Image, ImageSampler, ImageType, TextureError},
view::VisibleEntities,
view::{VisibilityBundle, VisibleEntities},
};
use bevy_scene::Scene;
#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -466,6 +466,7 @@ async fn load_gltf<'a, 'b>(
world
.spawn()
.insert_bundle(TransformBundle::identity())
.insert_bundle(VisibilityBundle::default())
.with_children(|parent| {
for node in scene.nodes() {
let result = load_node(
Expand Down Expand Up @@ -707,6 +708,7 @@ fn load_node(
let mut node = world_builder.spawn_bundle(TransformBundle::from(Transform::from_matrix(
Mat4::from_cols_array_2d(&transform.matrix()),
)));
node.insert_bundle(VisibilityBundle::default());

node.insert(node_name(gltf_node));

Expand Down

0 comments on commit 1d3a1f7

Please sign in to comment.