Skip to content

Commit b80636b

Browse files
committed
don't render completely transparent UI nodes (#5537)
# Objective - I often have UI nodes that are completely transparent and just for organisation - Don't render them - I doesn't bring a lot of improvements, but it doesn't add a lot of complexity either
1 parent 992681b commit b80636b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

crates/bevy_render/src/color/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ impl Color {
379379
}
380380

381381
/// Get alpha.
382+
#[inline(always)]
382383
pub fn a(&self) -> f32 {
383384
match self {
384385
Color::Rgba { alpha, .. }

crates/bevy_ui/src/render/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ pub fn extract_uinodes(
197197
if !images.contains(&image) {
198198
continue;
199199
}
200+
// Skip completely transparent nodes
201+
if color.0.a() == 0.0 {
202+
continue;
203+
}
200204
extracted_uinodes.uinodes.push(ExtractedUiNode {
201205
transform: transform.compute_matrix(),
202206
color: color.0,

0 commit comments

Comments
 (0)