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.
This commit is contained in:
Andrej730
2024-05-31 14:22:58 +05:00
parent ba6cdc967c
commit 6e738a0e3a
2 changed files with 2 additions and 2 deletions
@@ -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")
+1 -1
View File
@@ -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":