bevy/crates/bevy_editor/src/inspector/selection.rs
jbuehler23 be278fb1dc feat(editor): introduce reusable UI widgets for the editor interface
- Added a new module for editor UI widgets, including ScrollViewBuilder, CoreScrollArea, ExpansionButton, BasicPanel, and ScrollableContainer.
- Implemented basic theme support with EditorTheme struct.
- Created a Panel widget with collapsible and resizable features.
- Developed a scrollable area widget with mouse wheel support and content height calculation methods.
- Added examples for using scroll widgets and programmatic scrolling.
- Introduced a simple panel widget with configurable dimensions and styling.
- Implemented a simple scrollable container with mouse wheel support.
- Established a theming system compatible with bevy_feathers, including themed UI elements and a theme management plugin.
2025-07-18 14:39:07 +01:00

19 lines
542 B
Rust

use bevy::{prelude::*, ecs::entity::Entities};
/// The currently selected entity in the editor.
#[derive(Resource, Default, Reflect)]
#[reflect(Resource, Default)]
pub struct SelectedEntity(pub Option<Entity>);
/// System to reset [`SelectedEntity`] when the entity is despawned.
pub fn reset_selected_entity_if_entity_despawned(
mut selected_entity: ResMut<SelectedEntity>,
entities: &Entities,
) {
if let Some(e) = selected_entity.0 {
if !entities.contains(e) {
selected_entity.0 = None;
}
}
}