Allow bevy_ui crate to compile without the text feature enabled (#8437)

# Objective

Allow `bevy_ui` crate to compile without the `text` feature enabled

## Solution

- Correctly conditionally compile `text_system`
This commit is contained in:
Nico Burns 2023-04-18 20:41:02 +01:00 committed by GitHub
parent 3220ad6b0b
commit 5ed6b628eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,17 +124,20 @@ impl Plugin for UiPlugin {
#[cfg(feature = "bevy_text")] #[cfg(feature = "bevy_text")]
app.add_systems( app.add_systems(
PostUpdate, PostUpdate,
widget::measure_text_system (
.before(UiSystem::Layout) widget::measure_text_system
// Potential conflict: `Assets<Image>` .before(UiSystem::Layout)
// In practice, they run independently since `bevy_render::camera_update_system` // Potential conflict: `Assets<Image>`
// will only ever observe its own render target, and `widget::measure_text_system` // In practice, they run independently since `bevy_render::camera_update_system`
// will never modify a pre-existing `Image` asset. // will only ever observe its own render target, and `widget::measure_text_system`
.ambiguous_with(CameraUpdateSystem) // will never modify a pre-existing `Image` asset.
// Potential conflict: `Assets<Image>` .ambiguous_with(CameraUpdateSystem)
// Since both systems will only ever insert new [`Image`] assets, // Potential conflict: `Assets<Image>`
// they will never observe each other's effects. // Since both systems will only ever insert new [`Image`] assets,
.ambiguous_with(bevy_text::update_text2d_layout), // they will never observe each other's effects.
.ambiguous_with(bevy_text::update_text2d_layout),
widget::text_system.after(UiSystem::Layout),
),
); );
#[cfg(feature = "bevy_text")] #[cfg(feature = "bevy_text")]
app.add_plugin(accessibility::AccessibilityPlugin); app.add_plugin(accessibility::AccessibilityPlugin);
@ -159,7 +162,6 @@ impl Plugin for UiPlugin {
.before(TransformSystem::TransformPropagate), .before(TransformSystem::TransformPropagate),
ui_stack_system.in_set(UiSystem::Stack), ui_stack_system.in_set(UiSystem::Stack),
update_clipping_system.after(TransformSystem::TransformPropagate), update_clipping_system.after(TransformSystem::TransformPropagate),
widget::text_system.after(UiSystem::Layout),
), ),
); );