mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 00:23:14 +00:00
deprecate Material.BIMMaterialProperties #4843
As it now stored just 1 property and it's now moved to the BIMStyleProperties.
This commit is contained in:
@@ -576,14 +576,14 @@ def the_material_name_is_not_an_ifc_material(name):
|
||||
@then(parsers.parse('the material "{name}" is an IFC style'))
|
||||
def the_material_name_is_an_ifc_style(name):
|
||||
obj = the_material_name_exists(name)
|
||||
ifc_definition_id = obj.BIMMaterialProperties.ifc_style_id
|
||||
ifc_definition_id = obj.BIMStyleProperties.ifc_definition_id
|
||||
assert ifc_definition_id != 0, f"The material {obj} has a style ID of {ifc_definition_id}"
|
||||
|
||||
|
||||
@then(parsers.parse('the material "{name}" is not an IFC style'))
|
||||
def the_material_name_is_not_an_ifc_style(name):
|
||||
obj = the_material_name_exists(name)
|
||||
ifc_definition_id = obj.BIMMaterialProperties.ifc_style_id
|
||||
ifc_definition_id = obj.BIMStyleProperties.ifc_definition_id
|
||||
assert ifc_definition_id == 0, f"The material {obj} has a style ID of {ifc_definition_id}"
|
||||
|
||||
|
||||
|
||||
@@ -866,9 +866,9 @@ class TestAddReferenceImage(NewFile):
|
||||
|
||||
material = obj.active_material
|
||||
assert material.name == "image"
|
||||
assert material.BIMMaterialProperties.ifc_style_id != 0
|
||||
assert material.BIMStyleProperties.ifc_definition_id != 0
|
||||
|
||||
style = ifc_file.by_id(material.BIMMaterialProperties.ifc_style_id)
|
||||
style = ifc_file.by_id(material.BIMStyleProperties.ifc_definition_id)
|
||||
styled_items = set(tool.Style.get_styled_items(style))
|
||||
representation_items = set(tool.Geometry.get_active_representation(obj).Items)
|
||||
assert styled_items == representation_items
|
||||
|
||||
@@ -110,7 +110,7 @@ class TestGetObjectMaterialsWithoutStyles(NewFile):
|
||||
material1 = bpy.data.materials.new("Material")
|
||||
material2 = bpy.data.materials.new("Material")
|
||||
material3 = bpy.data.materials.new("Material")
|
||||
material3.BIMMaterialProperties.ifc_style_id = 1
|
||||
material3.BIMStyleProperties.ifc_definition_id = 1
|
||||
obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
|
||||
obj.data.materials.append(material1)
|
||||
obj.data.materials.append(material2)
|
||||
@@ -237,7 +237,7 @@ class TestImportRepresentation(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
|
||||
material = bpy.data.materials.new("Material")
|
||||
material.BIMMaterialProperties.ifc_style_id = 101
|
||||
material.BIMStyleProperties.ifc_definition_id = 101
|
||||
element = ifc.by_type("IfcWall")[0]
|
||||
tool.Ifc.link(element, obj)
|
||||
representation = element.Representation.Representations[0]
|
||||
@@ -343,7 +343,7 @@ class TestRecordObjectMaterials(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
style = ifc.createIfcSurfaceStyle()
|
||||
material = bpy.data.materials.new("Material")
|
||||
material.BIMMaterialProperties.ifc_style_id = style.id()
|
||||
material.BIMStyleProperties.ifc_definition_id = style.id()
|
||||
obj.data.materials.append(material)
|
||||
subject.record_object_materials(obj)
|
||||
assert obj.data.BIMMeshProperties.material_checksum == str([style.id()])
|
||||
|
||||
@@ -448,7 +448,7 @@ class TestUsingArrays(NewFile):
|
||||
class TestApplyIfcMaterialChanges(NewFile):
|
||||
def get_used_styles(self, obj: bpy.types.Object) -> set[ifcopenshell.entity_instance]:
|
||||
ifc_file = tool.Ifc.get()
|
||||
return {ifc_file.by_id(s.material.BIMMaterialProperties.ifc_style_id) for s in obj.material_slots if s.material}
|
||||
return {ifc_file.by_id(s.material.BIMStyleProperties.ifc_definition_id) for s in obj.material_slots if s.material}
|
||||
|
||||
def get_mesh(self, obj: bpy.types.Object) -> bpy.types.Mesh:
|
||||
mesh = obj.data
|
||||
|
||||
@@ -125,12 +125,12 @@ class TestGetStyle(NewFile):
|
||||
tool.Ifc.set(ifcopenshell.file())
|
||||
style = tool.Ifc.get().createIfcSurfaceStyle()
|
||||
obj = bpy.data.materials.new("Material")
|
||||
obj.BIMMaterialProperties.ifc_style_id = style.id()
|
||||
obj.BIMStyleProperties.ifc_definition_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
|
||||
obj.BIMStyleProperties.ifc_definition_id = 1
|
||||
assert subject.get_style(obj) == None
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ class TestGetSurfaceRenderingStyle(NewFile):
|
||||
style_item = tool.Ifc.get().createIfcSurfaceStyleRendering()
|
||||
style = tool.Ifc.get().createIfcSurfaceStyle(Styles=[style_item])
|
||||
obj = bpy.data.materials.new("Material")
|
||||
obj.BIMMaterialProperties.ifc_style_id = style.id()
|
||||
obj.BIMStyleProperties.ifc_definition_id = style.id()
|
||||
assert subject.get_surface_rendering_style(obj) == style_item
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ class TestGetSurfaceShadingStyle(NewFile):
|
||||
style_item = tool.Ifc.get().createIfcSurfaceStyleShading()
|
||||
style = tool.Ifc.get().createIfcSurfaceStyle(Styles=[style_item])
|
||||
obj = bpy.data.materials.new("Material")
|
||||
obj.BIMMaterialProperties.ifc_style_id = style.id()
|
||||
obj.BIMStyleProperties.ifc_definition_id = style.id()
|
||||
assert subject.get_surface_shading_style(obj) == style_item
|
||||
|
||||
def test_do_not_get_rendering_styles(self):
|
||||
@@ -369,7 +369,7 @@ class TestGetSurfaceShadingStyle(NewFile):
|
||||
style_item = tool.Ifc.get().createIfcSurfaceStyleRendering()
|
||||
style = tool.Ifc.get().createIfcSurfaceStyle(Styles=[style_item])
|
||||
obj = bpy.data.materials.new("Material")
|
||||
obj.BIMMaterialProperties.ifc_style_id = style.id()
|
||||
obj.BIMStyleProperties.ifc_definition_id = style.id()
|
||||
assert subject.get_surface_shading_style(obj) is None
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ class TestGetSurfaceTextureStyle(NewFile):
|
||||
style_item = tool.Ifc.get().createIfcSurfaceStyleWithTextures()
|
||||
style = tool.Ifc.get().createIfcSurfaceStyle(Styles=[style_item])
|
||||
obj = bpy.data.materials.new("Material")
|
||||
obj.BIMMaterialProperties.ifc_style_id = style.id()
|
||||
obj.BIMStyleProperties.ifc_definition_id = style.id()
|
||||
assert subject.get_surface_texture_style(obj) == style_item
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user