summaryrefslogtreecommitdiff
path: root/engine/src/ui/view/world.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-11-30 19:29:31 +0100
committerHampusM <hampus@hampusmat.com>2026-11-30 19:29:31 +0100
commitbac6244efef8241c409420e3adee0157103e055d (patch)
treeef35f54c29ec6a8e3791e1b02b4190b59ba3b866 /engine/src/ui/view/world.rs
parentfdae90635c663bd97694cf170da5fe152a9033b7 (diff)
feat(engine): make world ui view allow adding not fully editable components
Diffstat (limited to 'engine/src/ui/view/world.rs')
-rw-r--r--engine/src/ui/view/world.rs66
1 files changed, 0 insertions, 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>,