From 6e738a0e3ab7d057dd56982a36a3b9ae3b419819 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 31 May 2024 14:22:58 +0500 Subject: [PATCH] materials ui - fix bug when it was impossible to contract category E.g. it was impossible to contract category "TEST" if there was also a material with name "TEST" (and it's category was expanded). It occurred due to a mixup of materials and categories in expanded_categories. Also changed is_expanded default value to False as it makes more sense (previous value didn't worked for materials and for categories you probably would want it to be False by default. --- src/blenderbim/blenderbim/bim/module/material/prop.py | 2 +- src/blenderbim/blenderbim/tool/material.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/material/prop.py b/src/blenderbim/blenderbim/bim/module/material/prop.py index 9374ac67cf..d8737ad21e 100644 --- a/src/blenderbim/blenderbim/bim/module/material/prop.py +++ b/src/blenderbim/blenderbim/bim/module/material/prop.py @@ -123,7 +123,7 @@ class Material(PropertyGroup): name: StringProperty(name="Name") ifc_definition_id: IntProperty(name="IFC Definition ID") is_category: BoolProperty(name="Is Category", default=False) - is_expanded: BoolProperty(name="Is Expanded", default=True) + is_expanded: BoolProperty(name="Is Expanded", default=False) has_style: BoolProperty(name="Has Style", default=True) total_elements: IntProperty(name="Total Elements") diff --git a/src/blenderbim/blenderbim/tool/material.py b/src/blenderbim/blenderbim/tool/material.py index 6dbb345311..e52b7abbf0 100644 --- a/src/blenderbim/blenderbim/tool/material.py +++ b/src/blenderbim/blenderbim/tool/material.py @@ -60,7 +60,7 @@ class Material(blenderbim.core.tool.Material): @classmethod def import_material_definitions(cls, material_type: str) -> None: props = bpy.context.scene.BIMMaterialProperties - expanded_categories = {m.name for m in props.materials if m.is_expanded} + expanded_categories = {m.name for m in props.materials if m.is_category and m.is_expanded} props.materials.clear() get_name = lambda x: x.Name or "Unnamed" if material_type == "IfcMaterialLayerSet":