tirbofish/dropbear · commit
f184d55ac41afc5e8c2c27d424d00e1a1076c4ff
fix: ensured all CollapsibleHeaders are open and they have their own ID salt.
Signature present but could not be verified.
Unverified
@@ -105,12 +105,13 @@ impl InspectableComponent for AnimationComponent { fn inspect( &mut self, _world: &World, - _entity: Entity, + entity: Entity, ui: &mut Ui, _graphics: Arc<SharedGraphicsContext>, ) { CollapsingHeader::new("Animation") .default_open(true) + .id_salt(format!("Animation {}", entity.to_bits())) .show(ui, |ui| { let has_animations = !self.available_animations.is_empty(); let mut enabled = self.active_animation_index.is_some() && has_animations; @@ -79,6 +79,7 @@ impl InspectableComponent for BillboardComponent { ) { CollapsingHeader::new("Billboard") .default_open(true) + .id_salt(format!("Billboard {}", entity.to_bits())) .show(ui, |ui| { if ui.button("Edit in UI Editor").clicked() { ui.ctx().data_mut(|d| { @@ -77,12 +77,13 @@ impl InspectableComponent for Camera { fn inspect( &mut self, _world: &World, - _entity: Entity, + entity: Entity, ui: &mut Ui, _graphics: Arc<SharedGraphicsContext>, ) { CollapsingHeader::new("Camera3D") .default_open(true) + .id_salt(format!("Camera3D {}", entity.to_bits())) .show(ui, |ui| { let mut changed = false; @@ -712,7 +712,7 @@ impl InspectableComponent for MeshRenderer { fn inspect( &mut self, _world: &hecs::World, - _entity: hecs::Entity, + entity: hecs::Entity, ui: &mut egui::Ui, graphics: Arc<SharedGraphicsContext>, ) { @@ -817,6 +817,7 @@ impl InspectableComponent for MeshRenderer { CollapsingHeader::new("Mesh Renderer") .default_open(true) + .id_salt(format!("Mesh Renderer {}", entity.to_bits())) .show(ui, |ui| { let (model_reference, model_title, model_list) = { let registry = ASSET_REGISTRY.read(); @@ -1094,6 +1095,7 @@ impl InspectableComponent for MeshRenderer { ui.add_space(4.0); CollapsingHeader::new("Materials") .default_open(true) + .id_salt(format!("Materials {}", entity.to_bits())) .show(ui, |ui| { let mut texture_options = { let registry = ASSET_REGISTRY.read(); @@ -1174,8 +1176,8 @@ impl InspectableComponent for MeshRenderer { }; let material_id = format!("material_{}", material_name); CollapsingHeader::new(material_name.as_str()) - .id_salt(material_id) - .default_open(false) + .id_salt(format!("{} {}", material_id, entity.to_bits())) + .default_open(true) .show(ui, |ui| { ui.add_space(4.0); ui.label( @@ -88,12 +88,13 @@ impl InspectableComponent for Light { fn inspect( &mut self, _world: &World, - _entity: Entity, + entity: Entity, ui: &mut Ui, _graphics: Arc<SharedGraphicsContext>, ) { CollapsingHeader::new("Light") .default_open(true) + .id_salt(format!("Light {}", entity.to_bits())) .show(ui, |ui| { ui.add_space(6.0); ui.label("Uniform"); @@ -105,12 +105,13 @@ impl InspectableComponent for ColliderGroup { fn inspect( &mut self, _world: &World, - _entity: Entity, + entity: Entity, ui: &mut Ui, _graphics: Arc<SharedGraphicsContext>, ) { CollapsingHeader::new("Colliders") .default_open(true) + .id_salt(format!("Colliders {}", entity.to_bits())) .show(ui, |ui| { let mut remove_index: Option<usize> = None; @@ -118,6 +119,7 @@ impl InspectableComponent for ColliderGroup { ui.push_id(index, |ui| { CollapsingHeader::new(format!("Collider {}", index + 1)) .default_open(true) + .id_salt(format!("Collider {} {}", index + 1, entity.to_bits())) .show(ui, |ui| { collider.inspect(ui); @@ -111,12 +111,13 @@ impl InspectableComponent for KCC { fn inspect( &mut self, _world: &World, - _entity: Entity, + entity: Entity, ui: &mut Ui, _graphics: Arc<SharedGraphicsContext>, ) { egui::CollapsingHeader::new("Kinematic Character Controller") .default_open(true) + .id_salt(format!("Kinematic Character Controller {}", entity.to_bits())) .show(ui, |ui| { fn edit_character_length( ui: &mut Ui, @@ -236,12 +236,13 @@ impl InspectableComponent for RigidBody { fn inspect( &mut self, _world: &World, - _entity: Entity, + entity: Entity, ui: &mut Ui, _graphics: Arc<SharedGraphicsContext>, ) { CollapsingHeader::new("RigidBody") .default_open(true) + .id_salt(format!("RigidBody {}", entity.to_bits())) .show(ui, |ui| { ui.vertical(|ui| { let mut selected = self.mode; @@ -64,12 +64,13 @@ impl InspectableComponent for CustomProperties { fn inspect( &mut self, _world: &World, - _entity: Entity, + entity: Entity, ui: &mut Ui, _graphics: Arc<SharedGraphicsContext>, ) { CollapsingHeader::new("Custom Properties") .default_open(true) + .id_salt(format!("Custom Properties {}", entity.to_bits())) .show(ui, |ui| { ui.vertical(|ui| { Grid::new("properties").striped(true).show(ui, |ui| { @@ -199,15 +199,17 @@ impl InspectableComponent for Script { fn inspect( &mut self, _world: &World, - _entity: Entity, + entity: Entity, ui: &mut Ui, _graphics: Arc<SharedGraphicsContext>, ) { CollapsingHeader::new("Scripting") .default_open(true) + .id_salt(format!("Scripting {}", entity.to_bits())) .show(ui, |ui| { CollapsingHeader::new("Tags") .default_open(true) + .id_salt(format!("Scripting Tags {}", entity.to_bits())) .show(ui, |ui| { let mut local_del: Option<usize> = None; for (i, tag) in self.tags.iter_mut().enumerate() { @@ -56,18 +56,19 @@ impl InspectableComponent for EntityTransform { fn inspect( &mut self, _world: &World, - _entity: Entity, + entity: Entity, ui: &mut Ui, _graphics: Arc<SharedGraphicsContext>, ) { CollapsingHeader::new("Entity Transform") .default_open(true) + .id_salt(format!("Entity Transform {}", entity.to_bits())) .show(ui, |ui| { - CollapsingHeader::new("Local").default_open(true).show(ui, |ui| { + CollapsingHeader::new("Local").default_open(true).id_salt(format!("Local {}", entity.to_bits())).show(ui, |ui| { self.local_mut().inspect(ui); }); ui.add_space(4.0); - CollapsingHeader::new("World").default_open(true).show(ui, |ui| { + CollapsingHeader::new("World").default_open(true).id_salt(format!("World {}", entity.to_bits())).show(ui, |ui| { self.world_mut().inspect(ui); }); }); @@ -51,7 +51,10 @@ impl Component for HUDComponent { impl InspectableComponent for HUDComponent { fn inspect(&mut self, _world: &World, entity: Entity, ui: &mut Ui, _graphics: Arc<SharedGraphicsContext>) { - CollapsingHeader::new("HUD").show(ui, |ui| { + CollapsingHeader::new("HUD") + .default_open(true) + .id_salt(format!("HUD {}", entity.to_bits())) + .show(ui, |ui| { if ui.button("Edit in UI Editor").clicked() { ui.ctx().data_mut(|d| { d.insert_temp::<Option<Entity>>(egui::Id::new("open_ui_editor"), Some(entity)); @@ -1344,7 +1344,20 @@ impl Editor { }; ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { - ui.colored_label(text_color, format!("Viewing through {label}")); + if self.current_page.contains(EditorTabVisibility::GameEditor) { + ui.colored_label(text_color, format!("Viewing through {label}")); + } else if self.current_page.contains(EditorTabVisibility::UIEditor) { + if let Some(e) = self.ui_editor.active_entity { + let label = self.world.get::<&Label>(e); + if let Ok(l) = label { + ui.colored_label(text_color, format!("Editing {l}")); + } else { + ui.colored_label(egui::Color32::from_rgb(255, 0, 0), format!("error: unable to fetch label for entity {:?}", e)); + } + } else { + ui.label("Not editing anything"); + } + } }); }); @@ -8,6 +8,8 @@ impl UiEditor { active_entity: None, } } - - + + pub fn update(&mut self) { + + } }