Skip to content

Commit cab065b

Browse files
committed
remove the image loaded check for nodes without images in extract_uinodes (#7280)
## Problem `extract_uinodes` checks if an image is loaded for nodes without images ## Solution Move the image loading skip check so that it is only performed for nodes with a `UiImage` component.
1 parent 2027af4 commit cab065b

File tree

1 file changed

+7
-9
lines changed
  • crates/bevy_ui/src/render

1 file changed

+7
-9
lines changed

crates/bevy_ui/src/render/mod.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,22 +203,20 @@ pub fn extract_uinodes(
203203
if let Ok((uinode, transform, color, maybe_image, visibility, clip)) =
204204
uinode_query.get(*entity)
205205
{
206-
if !visibility.is_visible() {
206+
// Skip invisible and completely transparent nodes
207+
if !visibility.is_visible() || color.0.a() == 0.0 {
207208
continue;
208209
}
210+
209211
let (image, flip_x, flip_y) = if let Some(image) = maybe_image {
212+
// Skip loading images
213+
if !images.contains(&image.texture) {
214+
continue;
215+
}
210216
(image.texture.clone_weak(), image.flip_x, image.flip_y)
211217
} else {
212218
(DEFAULT_IMAGE_HANDLE.typed().clone_weak(), false, false)
213219
};
214-
// Skip loading images
215-
if !images.contains(&image) {
216-
continue;
217-
}
218-
// Skip completely transparent nodes
219-
if color.0.a() == 0.0 {
220-
continue;
221-
}
222220

223221
extracted_uinodes.uinodes.push(ExtractedUiNode {
224222
stack_index,

0 commit comments

Comments
 (0)