mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 14:07:43 +00:00
Swapping a Blender material for another is now auto synchronised.
This commit is contained in:
@@ -401,3 +401,18 @@ Scenario: Export IFC - with changed style colour synchronised
|
||||
And an empty Blender session is started
|
||||
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
|
||||
Then the material "Material" colour is "1,0,0,1"
|
||||
|
||||
Scenario: Export IFC - with changed style element synchronised
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And I add a material
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And the object "IfcWall/Cube" is selected
|
||||
When I add a material
|
||||
And the material "Material.001" colour is set to "1,0,0,1"
|
||||
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
|
||||
And an empty Blender session is started
|
||||
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
|
||||
Then the material "Material.001" colour is "1,0,0,1"
|
||||
|
||||
@@ -91,6 +91,7 @@ def i_add_a_sun():
|
||||
|
||||
|
||||
@given("I add a material")
|
||||
@when("I add a material")
|
||||
def i_add_a_material():
|
||||
bpy.context.active_object.active_material = bpy.data.materials.new("Material")
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ class TestAddRepresentation:
|
||||
styles=["style"],
|
||||
should_use_presentation_style_assignment=False,
|
||||
).should_be_called()
|
||||
geometry.record_object_materials("obj").should_be_called()
|
||||
|
||||
# Assign representation to product
|
||||
ifc.run("geometry.assign_representation", product="element", representation="representation").should_be_called()
|
||||
|
||||
@@ -352,6 +352,19 @@ class TestLink(NewFile):
|
||||
assert obj.BIMMeshProperties.ifc_definition_id == element.id()
|
||||
|
||||
|
||||
class TestRecordObjectMaterials(NewFile):
|
||||
def test_run(self):
|
||||
obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
|
||||
ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(ifc)
|
||||
style = ifc.createIfcSurfaceStyle()
|
||||
material = bpy.data.materials.new("Material")
|
||||
material.BIMMaterialProperties.ifc_style_id = style.id()
|
||||
obj.data.materials.append(material)
|
||||
subject.record_object_materials(obj)
|
||||
assert obj.data.BIMMeshProperties.material_checksum == str([style.id()])
|
||||
|
||||
|
||||
class TestRecordObjectPosition(NewFile):
|
||||
def test_run(self):
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
|
||||
Reference in New Issue
Block a user