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
This commit is contained in:
		
							parent
							
								
									992681b59b
								
							
						
					
					
						commit
						b80636b330
					
				@ -379,6 +379,7 @@ impl Color {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Get alpha.
 | 
					    /// Get alpha.
 | 
				
			||||||
 | 
					    #[inline(always)]
 | 
				
			||||||
    pub fn a(&self) -> f32 {
 | 
					    pub fn a(&self) -> f32 {
 | 
				
			||||||
        match self {
 | 
					        match self {
 | 
				
			||||||
            Color::Rgba { alpha, .. }
 | 
					            Color::Rgba { alpha, .. }
 | 
				
			||||||
 | 
				
			|||||||
@ -197,6 +197,10 @@ pub fn extract_uinodes(
 | 
				
			|||||||
        if !images.contains(&image) {
 | 
					        if !images.contains(&image) {
 | 
				
			||||||
            continue;
 | 
					            continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        // Skip completely transparent nodes
 | 
				
			||||||
 | 
					        if color.0.a() == 0.0 {
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        extracted_uinodes.uinodes.push(ExtractedUiNode {
 | 
					        extracted_uinodes.uinodes.push(ExtractedUiNode {
 | 
				
			||||||
            transform: transform.compute_matrix(),
 | 
					            transform: transform.compute_matrix(),
 | 
				
			||||||
            color: color.0,
 | 
					            color: color.0,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user