bonsai - fix error removing non-linked styles

including non-ifcsurfacestyle ifcpresentationstyles
This commit is contained in:
Andrej730
2024-09-30 21:02:13 +05:00
parent b7c390585b
commit f4165d4149
2 changed files with 3 additions and 1 deletions
@@ -50,6 +50,7 @@ class StylesData:
materials: dict[bpy.types.PropertyGroup, Union[str, None]] = {}
for style in props.styles:
material = tool.Ifc.get_object(ifc_file.by_id(style.ifc_definition_id))
# Material will be None if it's either unlinked or if it's not IfcSurfaceStyle.
materials[style] = material.name if material is not None else None
return materials
+2 -1
View File
@@ -70,7 +70,8 @@ def remove_style(
style_type = style_tool.get_active_style_type()
ifc.unlink(element=style)
ifc.run("style.remove_style", style=style)
style_tool.delete_object(obj)
if obj:
style_tool.delete_object(obj)
if reload_styles_ui and style_tool.is_editing_styles():
style_tool.import_presentation_styles(style_type)