bevy/examples/2d
Félix Lescaudey de Maneville e0c296ee14
Optional ImageScaleMode (#11780)
> Follow up to #11600 and #10588 

@mockersf expressed some [valid
concerns](https://github.com/bevyengine/bevy/pull/11600#issuecomment-1932796498)
about the current system this PR attempts to fix:

The `ComputedTextureSlices` reacts to asset change in both `bevy_sprite`
and `bevy_ui`, meaning that if the `ImageScaleMode` is inserted by
default in the bundles, we will iterate through most 2d items every time
an asset is updated.

# Solution

- `ImageScaleMode` only has two variants: `Sliced` and `Tiled`. I
removed the `Stretched` default
- `ImageScaleMode` is no longer part of any bundle, but the relevant
bundles explain that this additional component can be inserted

This way, the *absence* of `ImageScaleMode` means the image will be
stretched, and its *presence* will include the entity to the various
slicing systems

Optional components in bundles would make this more straigthfoward

# Additional work

Should I add new bundles with the `ImageScaleMode` component ?
2024-02-09 20:36:32 +00:00
..
2d_gizmos.rs Drawing Primitives with Gizmos (#11072) 2024-02-02 21:13:03 +00:00
2d_shapes.rs Implement meshing for Capsule2d (#11639) 2024-02-03 18:03:43 +00:00
2d_viewport_to_world.rs Add example for Camera::viewport_to_world (#7179) 2023-09-11 18:52:11 +00:00
bloom_2d.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
bounding_2d.rs Add example for bounding volumes and intersection tests (#11666) 2024-02-03 17:11:01 +00:00
custom_gltf_vertex_attribute.rs Reorder impl to be the same as the trait (#11076) 2023-12-24 17:43:55 +00:00
mesh2d.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
mesh2d_manual.rs Mesh insert indices (#11745) 2024-02-06 23:31:48 +00:00
mesh2d_vertex_color_texture.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
move_sprite.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
pixel_grid_snap.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
rotation.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
sprite.rs Update color and naming for consistency (#10367) 2023-11-04 02:09:23 +00:00
sprite_flipping.rs Update color and naming for consistency (#10367) 2023-11-04 02:09:23 +00:00
sprite_sheet.rs Texture Atlas rework (#5103) 2024-01-16 13:59:08 +00:00
sprite_slice.rs Optional ImageScaleMode (#11780) 2024-02-09 20:36:32 +00:00
sprite_tile.rs Optional ImageScaleMode (#11780) 2024-02-09 20:36:32 +00:00
text2d.rs Rename TextAlignment to JustifyText. (#10854) 2023-12-05 03:00:41 +00:00
texture_atlas.rs Allow TextureAtlasBuilder in AssetLoader (#11548) 2024-01-27 16:16:44 +00:00
transparency_2d.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00