summaryrefslogtreecommitdiff
path: root/engine/src/ui/view
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/ui/view')
-rw-r--r--engine/src/ui/view/world.rs22
1 files changed, 18 insertions, 4 deletions
diff --git a/engine/src/ui/view/world.rs b/engine/src/ui/view/world.rs
index 4685747..bf92859 100644
--- a/engine/src/ui/view/world.rs
+++ b/engine/src/ui/view/world.rs
@@ -488,10 +488,24 @@ fn create_add_component_button_widget(
[90.0, 162.0, 51.0, 255.0].map(|num| num / 255.0),
);
- let is_button_clicked = frame.button(format!(
- "+##add_component_to_entity_button_{}",
- ent_handle.uid()
- ));
+ let ent_is_sole = ent_handle.has_component::<IsSole>();
+
+ let is_button_clicked = {
+ let _disabled_token = frame.begin_disabled_with_cond(ent_is_sole);
+
+ frame.button(format!(
+ "+##add_component_to_entity_button_{}",
+ ent_handle.uid()
+ ))
+ };
+
+ if ent_is_sole {
+ if frame.is_item_hovered_with_flags(
+ dear_imgui_bindings::ItemHoveredFlags::ALLOW_WHEN_DISABLED,
+ ) {
+ frame.tooltip_text("Cannot add a component to the entity of a sole");
+ }
+ }
if is_button_clicked {
enter_add_component_popup_state(popup_state, ent_handle, ent_title, world);