Add missing Default impl to ExtendedMaterial. (#13008)
# Objective When trying to be generic over `Material + Default`, the lack of a `Default` impl for `ExtendedMaterial`, even when both of its components implement `Default`, is problematic. I think was probably just overlooked. ## Solution Impl `Default` if the material and extension both impl `Default`. --- ## Changelog ## Migration Guide
This commit is contained in:
		
							parent
							
								
									11afe16079
								
							
						
					
					
						commit
						ef7bafa68e
					
				| @ -128,6 +128,19 @@ pub struct ExtendedMaterial<B: Material, E: MaterialExtension> { | |||||||
|     pub extension: E, |     pub extension: E, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | impl<B, E> Default for ExtendedMaterial<B, E> | ||||||
|  | where | ||||||
|  |     B: Material + Default, | ||||||
|  |     E: MaterialExtension + Default, | ||||||
|  | { | ||||||
|  |     fn default() -> Self { | ||||||
|  |         Self { | ||||||
|  |             base: B::default(), | ||||||
|  |             extension: E::default(), | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // We don't use the `TypePath` derive here due to a bug where `#[reflect(type_path = false)]`
 | // We don't use the `TypePath` derive here due to a bug where `#[reflect(type_path = false)]`
 | ||||||
| // causes the `TypePath` derive to not generate an implementation.
 | // causes the `TypePath` derive to not generate an implementation.
 | ||||||
| impl_type_path!((in bevy_pbr::extended_material) ExtendedMaterial<B: Material, E: MaterialExtension>); | impl_type_path!((in bevy_pbr::extended_material) ExtendedMaterial<B: Material, E: MaterialExtension>); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 charlotte
						charlotte