summaryrefslogtreecommitdiff
path: root/engine/src
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src')
-rw-r--r--engine/src/ui/view/world.rs68
1 files changed, 35 insertions, 33 deletions
diff --git a/engine/src/ui/view/world.rs b/engine/src/ui/view/world.rs
index 92c5de2..efa8663 100644
--- a/engine/src/ui/view/world.rs
+++ b/engine/src/ui/view/world.rs
@@ -243,7 +243,7 @@ fn create_entity_widgets(
if component_id.is_pair() {
create_pair_component_widgets(
frame,
- icon_textures,
+ // icon_textures,
ent_handle,
component_id,
world,
@@ -335,7 +335,7 @@ fn create_component_widgets(
fn create_pair_component_widgets(
frame: &dear_imgui_bindings::Ui,
- icon_textures: &IconTextures,
+ // icon_textures: &IconTextures,
ent_handle: &EntityHandle,
pair_id: Uid,
world: &World,
@@ -381,31 +381,33 @@ fn create_pair_component_widgets(
let pair_data_ty_id = (*pair_data).type_id();
- let pair_member_comp_infos = [pair_id.relation(), pair_id.target()]
- .map(|member_id| world.get_entity(member_id)?.get::<ComponentInfo>());
+ let Some((pair_data_ty, pair_data_comp_info)) =
+ [pair_id.relation(), pair_id.target()]
+ .into_iter()
+ .filter_map(|member_id| {
+ let comp_info = world.get_entity(member_id)?.get::<ComponentInfo>()?;
- let Some(pair_data_comp_info) = pair_member_comp_infos
- .into_iter()
- .filter_map(std::convert::identity)
- .find(|comp_info| comp_info.ty_id == pair_data_ty_id)
+ Some((comp_info.type_reflection?, comp_info))
+ })
+ .find(|(pair_member_ty, _)| pair_member_ty.ty_id() == pair_data_ty_id)
else {
return;
};
- let Some(pair_data_ty) = pair_data_comp_info.type_reflection else {
- frame.same_line();
-
- frame.image(icon_textures.warning, [16.0, 16.0]);
-
- if frame.is_item_hovered() {
- frame.tooltip_text(format!(
- "Pair data type {} does not have reflection",
- pair_data_comp_info.name
- ));
- }
-
- return;
- };
+ // let Some(pair_data_ty) = pair_data_comp_info.type_reflection else {
+ // frame.same_line();
+ //
+ // frame.image(icon_textures.warning, [16.0, 16.0]);
+ //
+ // if frame.is_item_hovered() {
+ // frame.tooltip_text(format!(
+ // "Pair data type {} does not have reflection",
+ // pair_data_comp_info.name
+ // ));
+ // }
+ //
+ // return;
+ // };
let _indent = frame.begin_indent();
@@ -2001,7 +2003,7 @@ fn create_entity_title(ent_handle: &EntityHandle) -> String
struct IconTextures
{
despawn: dear_imgui_bindings::ManagedTextureId,
- warning: dear_imgui_bindings::ManagedTextureId,
+ // warning: dear_imgui_bindings::ManagedTextureId,
edit: dear_imgui_bindings::ManagedTextureId,
}
@@ -2019,15 +2021,15 @@ impl IconTextures
)
.context("Failed to create 'delete' icon texture")?;
- let warning = create_texture(
- dear_imgui_context,
- Image::from_reader(
- Cursor::new(include_bytes!("../../../res/ui/warning.png")),
- ImageFormat::Png,
- )
- .context("Failed to decode 'warning' icon image")?,
- )
- .context("Failed to create 'warning' icon texture")?;
+ // let warning = create_texture(
+ // dear_imgui_context,
+ // Image::from_reader(
+ // Cursor::new(include_bytes!("../../../res/ui/warning.png")),
+ // ImageFormat::Png,
+ // )
+ // .context("Failed to decode 'warning' icon image")?,
+ // )
+ // .context("Failed to create 'warning' icon texture")?;
let edit = create_texture(
dear_imgui_context,
@@ -2039,7 +2041,7 @@ impl IconTextures
)
.context("Failed to create 'edit' icon texture")?;
- Ok(Self { despawn, warning, edit })
+ Ok(Self { despawn, /* warning, */ edit })
}
}