mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 11:23:43 +00:00
Fix bug where empty material slots caused errors
This commit is contained in:
@@ -122,7 +122,7 @@ class AddRepresentation(bpy.types.Operator):
|
|||||||
[
|
[
|
||||||
bpy.ops.bim.add_style(material=s.material.name)
|
bpy.ops.bim.add_style(material=s.material.name)
|
||||||
for s in obj.material_slots
|
for s in obj.material_slots
|
||||||
if not s.material.BIMMaterialProperties.ifc_style_id
|
if s.material and not s.material.BIMMaterialProperties.ifc_style_id
|
||||||
]
|
]
|
||||||
|
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class ReassignClass(bpy.types.Operator):
|
|||||||
class AssignClass(bpy.types.Operator):
|
class AssignClass(bpy.types.Operator):
|
||||||
bl_idname = "bim.assign_class"
|
bl_idname = "bim.assign_class"
|
||||||
bl_label = "Assign IFC Class"
|
bl_label = "Assign IFC Class"
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
obj: bpy.props.StringProperty()
|
obj: bpy.props.StringProperty()
|
||||||
ifc_class: bpy.props.StringProperty()
|
ifc_class: bpy.props.StringProperty()
|
||||||
predefined_type: bpy.props.StringProperty()
|
predefined_type: bpy.props.StringProperty()
|
||||||
@@ -92,10 +92,6 @@ class AssignClass(bpy.types.Operator):
|
|||||||
elif self.predefined_type == "":
|
elif self.predefined_type == "":
|
||||||
predefined_type = None
|
predefined_type = None
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
if obj.data and hasattr(obj.data, "materials"):
|
|
||||||
for material in obj.data.materials:
|
|
||||||
if not material.BIMMaterialProperties.ifc_style_id:
|
|
||||||
bpy.ops.bim.add_style(material=material.name)
|
|
||||||
self.assign_class(context, obj)
|
self.assign_class(context, obj)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user