From bac6244efef8241c409420e3adee0157103e055d Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 30 Nov 2026 19:29:31 +0100 Subject: feat(engine): make world ui view allow adding not fully editable components --- engine/src/ui/view/world.rs | 66 --------------------------------------------- 1 file changed, 66 deletions(-) diff --git a/engine/src/ui/view/world.rs b/engine/src/ui/view/world.rs index ba4f388..92c5de2 100644 --- a/engine/src/ui/view/world.rs +++ b/engine/src/ui/view/world.rs @@ -666,13 +666,6 @@ fn enter_add_component_popup_state( .is_some_and(|ty| !ty.has_default_value()) { ComponentUserCreatable::No { reason: "no default value" } - } else if !get_whole_type_is_user_editable( - component_info.type_reflection, - component_info.ty_id, - ) { - ComponentUserCreatable::No { - reason: "whole component is not user editable", - } } else { ComponentUserCreatable::Yes }; @@ -1847,65 +1840,6 @@ fn create_enum_widgets( } } -fn get_whole_type_is_user_editable( - ty: Option<&'static TypeReflection>, - type_id: TypeId, -) -> bool -{ - let Some(item_type) = get_item_type(ty, type_id) else { - return false; - }; - - match item_type { - ItemType::Reflected(TypeReflection::Struct(struct_ty)) => { - for field in struct_ty.fields { - if matches!( - field.visibility, - Visibility::Private | Visibility::PubScoped(_) - ) { - continue; - } - - if !get_whole_type_is_user_editable( - field.type_reflection(), - field.type_id, - ) { - return false; - } - } - - true - } - ItemType::Reflected(TypeReflection::Enum(enum_ty)) => { - enum_ty.variants.iter().any(|variant| { - for field in variant - .fields - .iter() - .flat_map(engine_reflection::EnumVariantFields::fields) - { - if !get_whole_type_is_user_editable( - field.type_reflection(), - field.type_id, - ) { - return false; - } - } - - true - }) - } - ItemType::Reflected( - TypeReflection::Slice(_) - | TypeReflection::Array(_) - | TypeReflection::Literal(_), - ) - | ItemType::String - | ItemType::CowStr - | ItemType::Color(..) => true, - ItemType::Reflected(_) => unimplemented!(), - } -} - struct ComboBoxItem<'b> { label: Cow<'b, str>, -- cgit v1.2.3-18-g5258