mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Fix bug where unlinking a style that was invalidly linked didn't work.
This commit is contained in:
@@ -46,7 +46,10 @@ class Style(blenderbim.core.tool.Style):
|
||||
@classmethod
|
||||
def get_style(cls, obj):
|
||||
if obj.BIMMaterialProperties.ifc_style_id:
|
||||
return tool.Ifc.get().by_id(obj.BIMMaterialProperties.ifc_style_id)
|
||||
try:
|
||||
return tool.Ifc.get().by_id(obj.BIMMaterialProperties.ifc_style_id)
|
||||
except:
|
||||
return
|
||||
|
||||
@classmethod
|
||||
def get_surface_rendering_attributes(cls, obj):
|
||||
|
||||
@@ -74,6 +74,11 @@ class TestGetStyle(NewFile):
|
||||
obj.BIMMaterialProperties.ifc_style_id = style.id()
|
||||
assert subject.get_style(obj) == style
|
||||
|
||||
def test_getting_nothing_for_a_broken_link_style(self):
|
||||
obj = bpy.data.materials.new("Material")
|
||||
obj.BIMMaterialProperties.ifc_style_id = 1
|
||||
assert subject.get_style(obj) == None
|
||||
|
||||
|
||||
class TestGetSurfaceRenderingAttributes(NewFile):
|
||||
def test_get_colours_from_a_basic_material(self):
|
||||
|
||||
Reference in New Issue
Block a user