Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design-system/Config sizing #196

Merged
merged 7 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ homepage = "https://github.com/rewin123/space_editor"
repository = "https://github.com/rewin123/space_editor"

[workspace.package]
version = "0.3.1"
version = "0.4.0"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = ["rewin <[email protected]>", "Julia Naomi <[email protected]>"]
Expand All @@ -26,12 +26,12 @@ homepage = "https://github.com/rewin123/space_editor"
bevy = "0.12"

# Editor Crates
space_prefab = { version = "0.3.1", path = "crates/prefab" }
space_shared = { version = "0.3.1", path = "crates/shared" }
space_undo = { version = "0.3.1", path = "crates/undo" }
space_persistence = { version = "0.3.1", path = "crates/persistence"}
space_editor_core = { version = "0.3.1", path = "crates/editor_core", features = ["persistence_editor"] }
space_editor_ui = { version = "0.3.1", path = "crates/editor_ui", features = ["persistence_editor"] }
space_prefab = { version = "0.4.0", path = "crates/prefab" }
space_shared = { version = "0.4.0", path = "crates/shared" }
space_undo = { version = "0.4.0", path = "crates/undo" }
space_persistence = { version = "0.4.0", path = "crates/persistence"}
space_editor_core = { version = "0.4.0", path = "crates/editor_core", features = ["persistence_editor"] }
space_editor_ui = { version = "0.4.0", path = "crates/editor_ui", features = ["persistence_editor"] }

# Crates inner libraries
anyhow = "1.0"
Expand Down Expand Up @@ -61,7 +61,7 @@ resvg = "0.37"
serde = "1"

# Community Modules
space_bevy_xpbd_plugin = { version = "0.3.1", path = "modules/bevy_xpbd_plugin"}
space_bevy_xpbd_plugin = { version = "0.4.0", path = "modules/bevy_xpbd_plugin"}

[patch.crates-io]
egui-gizmo = { git = "https://github.com/naomijub/egui-gizmo.git" }
Expand Down
1 change: 1 addition & 0 deletions crates/editor_ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ bevy_egui_next.workspace = true
egui-gizmo.workspace = true
egui_dock.workspace = true
bevy_debug_grid.workspace = true
bevy-inspector-egui.workspace = true
bevy_mod_picking.workspace = true
bevy_asset_loader.workspace = true
bevy_panorbit_camera.workspace = true
Expand Down
15 changes: 11 additions & 4 deletions crates/editor_ui/src/editor_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use bevy::{prelude::*, utils::HashMap};
use bevy_egui_next::egui::{self, WidgetText};
use convert_case::{Case, Casing};

use crate::colors::ERROR_COLOR;
use crate::{
colors::ERROR_COLOR,
sizing::{to_label, Sizing},
};

use super::{EditorUiRef, EditorUiReg};

Expand Down Expand Up @@ -76,7 +79,8 @@ impl<'a, 'w, 's> egui_dock::TabViewer for EditorTabViewer<'a, 'w, 's> {
}

fn title(&mut self, tab: &mut Self::Tab) -> egui::WidgetText {
if let Some(reg) = self.registry.get_mut(tab) {
let sizing = self.world.resource::<Sizing>().clone();
if let Some(reg) = self.registry.get(tab) {
match reg {
EditorUiReg::ResourceBased {
show_command: _,
Expand All @@ -87,10 +91,13 @@ impl<'a, 'w, 's> egui_dock::TabViewer for EditorTabViewer<'a, 'w, 's> {
.resource_mut::<ScheduleEditorTabStorage>()
.0
.get(tab)
.map_or_else(|| format!("{tab:?}").into(), |tab| tab.title.clone()),
.map_or_else(
|| to_label(&format!("{tab:?}"), sizing.text).into(),
|tab| to_label(tab.title.text(), sizing.text).into(),
),
}
} else {
format!("{tab:?}").into()
to_label(&format!("{tab:?}"), sizing.text).into()
}
}

Expand Down
14 changes: 11 additions & 3 deletions crates/editor_ui/src/hierarchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl Plugin for SpaceHierarchyPlugin {
pub struct HierarchyTabState {
pub show_editor_entities: bool,
pub show_spawnable_bundles: bool,
pub entity_filter: String,
}

pub type HierarchyQueryIter<'a> = (
Expand All @@ -64,18 +65,25 @@ pub fn show_hierarchy(
mut clone_events: EventWriter<CloneEvent>,
mut ui: NonSendMut<EditorUiRef>,
mut changes: EventWriter<NewChange>,
state: Res<HierarchyTabState>,
mut state: ResMut<HierarchyTabState>,
) {
let mut all: Vec<_> = if state.show_editor_entities {
all_entites.iter().collect()
} else {
query.iter().collect()
};
all.sort_by_key(|a| a.0);

let ui = &mut ui.0;
ui.text_edit_singleline(&mut state.entity_filter);
ui.spacing();
let lower_filter = state.entity_filter.to_lowercase();

egui::ScrollArea::vertical().show(ui, |ui| {
for (entity, _name, _children, parent) in all.iter() {
for (entity, _name, _children, parent) in all.iter().filter(|(_, name, _, _)| {
name.map(|n| n.to_lowercase())
.unwrap_or_else(|| "entity".to_string())
.contains(&lower_filter)
}) {
if parent.is_none() {
if state.show_editor_entities {
draw_entity::<()>(
Expand Down
Loading
Loading