mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Revert "Minor fix - remove redundant code"
This reverts commit 7828508179.
Turned out when I was assuming `bim.add_style` is assigning the style but it wasn't, it was `bim.update_representation` on the file save. So basically during the session style wasn't assigned, therefore I added back explicit style assignment. 😬
This commit is contained in:
@@ -2624,6 +2624,9 @@ class AddReferenceImage(bpy.types.Operator, Operator):
|
||||
obj.material_slots[0].material = material
|
||||
bpy.ops.bim.add_style()
|
||||
|
||||
style = ifc_file.by_id(material.BIMMaterialProperties.ifc_style_id)
|
||||
tool.Style.assign_style_to_object(style, obj)
|
||||
|
||||
material.diffuse_color = (0.031379, 0, 0.801157, 1)
|
||||
material.BIMStyleProperties.diffuse_path = self.filepath
|
||||
material.BIMStyleProperties.uv_mode = "Generated"
|
||||
|
||||
@@ -506,3 +506,9 @@ class Style(blenderbim.core.tool.Style):
|
||||
else:
|
||||
items.append(item)
|
||||
return items
|
||||
|
||||
@classmethod
|
||||
def assign_style_to_object(cls, style, obj):
|
||||
"""assigns `style` to `object` current representation"""
|
||||
representation = tool.Geometry.get_active_representation(obj)
|
||||
tool.Ifc.run("style.assign_representation_styles", shape_representation=representation, styles=[style])
|
||||
|
||||
Reference in New Issue
Block a user