diff --git a/src/blenderbim/blenderbim/bim/export_ifc.py b/src/blenderbim/blenderbim/bim/export_ifc.py index c3a091857b..ecbd5a107c 100644 --- a/src/blenderbim/blenderbim/bim/export_ifc.py +++ b/src/blenderbim/blenderbim/bim/export_ifc.py @@ -118,8 +118,8 @@ class IfcExporter: continue try: if isinstance(obj, bpy.types.Material): - if tool.Ifc.has_changed_shading(obj): - blenderbim.core.style.update_style_colours(tool.Ifc, tool.Style, obj=obj) + # TODO: do we add materials to edited_objs? + continue else: element = tool.Ifc.get_entity(obj) if element: diff --git a/src/blenderbim/blenderbim/bim/handler.py b/src/blenderbim/blenderbim/bim/handler.py index 7fd6e0c183..f232bd6b74 100644 --- a/src/blenderbim/blenderbim/bim/handler.py +++ b/src/blenderbim/blenderbim/bim/handler.py @@ -84,11 +84,6 @@ def name_callback(obj, data): refresh_ui_data() -def color_callback(obj, data): - if obj.BIMMaterialProperties.ifc_style_id: - tool.Ifc.edit(obj) - - def active_object_callback(): refresh_ui_data() update_bim_tool_props() diff --git a/src/blenderbim/blenderbim/bim/ifc.py b/src/blenderbim/blenderbim/bim/ifc.py index 4fbca1cb3a..16c7899fce 100644 --- a/src/blenderbim/blenderbim/bim/ifc.py +++ b/src/blenderbim/blenderbim/bim/ifc.py @@ -249,9 +249,7 @@ class IfcStore: blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback) - if isinstance(obj, bpy.types.Material): - blenderbim.bim.handler.subscribe_to(obj, "diffuse_color", blenderbim.bim.handler.color_callback) - elif isinstance(obj, bpy.types.Object): + if isinstance(obj, bpy.types.Object): blenderbim.bim.handler.subscribe_to( obj, "active_material_index", blenderbim.bim.handler.active_material_index_callback ) @@ -277,9 +275,7 @@ class IfcStore: if "guid" in data: IfcStore.guid_map[data["guid"]] = obj blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback) - if isinstance(obj, bpy.types.Material): - blenderbim.bim.handler.subscribe_to(obj, "diffuse_color", blenderbim.bim.handler.color_callback) - elif isinstance(obj, bpy.types.Object): + if isinstance(obj, bpy.types.Object): blenderbim.bim.handler.subscribe_to( obj, "active_material_index", blenderbim.bim.handler.active_material_index_callback ) diff --git a/src/blenderbim/blenderbim/bim/module/style/prop.py b/src/blenderbim/blenderbim/bim/module/style/prop.py index fb1bac5c40..9ff98c7327 100644 --- a/src/blenderbim/blenderbim/bim/module/style/prop.py +++ b/src/blenderbim/blenderbim/bim/module/style/prop.py @@ -287,7 +287,6 @@ def update_shading_style(self, context): switch_shading(blender_material, self.active_style_type) elif self.active_style_type == "Shading": switch_shading(blender_material, self.active_style_type) - tool.Style.record_shading(blender_material) class BIMStyleProperties(PropertyGroup): diff --git a/src/blenderbim/blenderbim/core/style.py b/src/blenderbim/blenderbim/core/style.py index 518a71c2a6..ef93cb0020 100644 --- a/src/blenderbim/blenderbim/core/style.py +++ b/src/blenderbim/blenderbim/core/style.py @@ -103,8 +103,6 @@ def update_style_colours(ifc: tool.Ifc, style: tool.Style, obj: bpy.types.Materi else: ifc.run("style.add_surface_style", style=element, ifc_class="IfcSurfaceStyleShading", attributes=attributes) - style.record_shading(obj) - def update_style_textures( ifc: tool.Ifc, style: tool.Style, obj: ifcopenshell.entity_instance, representation: ifcopenshell.entity_instance diff --git a/src/blenderbim/blenderbim/core/tool.py b/src/blenderbim/blenderbim/core/tool.py index cb7251975f..5b4fb0b441 100644 --- a/src/blenderbim/blenderbim/core/tool.py +++ b/src/blenderbim/blenderbim/core/tool.py @@ -951,7 +951,6 @@ class Style: def import_presentation_styles(cls, style_type): pass def import_surface_attributes(cls, style, obj): pass def is_editing_styles(cls): pass - def record_shading(cls, obj): pass @interface diff --git a/src/blenderbim/blenderbim/tool/ifc.py b/src/blenderbim/blenderbim/tool/ifc.py index 51a8be132a..7aef50f864 100644 --- a/src/blenderbim/blenderbim/tool/ifc.py +++ b/src/blenderbim/blenderbim/tool/ifc.py @@ -51,11 +51,6 @@ class Ifc(blenderbim.core.tool.Ifc): if IfcStore.get_file(): return IfcStore.get_file().schema - @classmethod - def has_changed_shading(cls, obj: bpy.types.Material) -> bool: - checksum = obj.BIMMaterialProperties.shading_checksum - return checksum != repr(np.array(obj.diffuse_color).tobytes()) - @classmethod def is_edited(cls, obj: bpy.types.Object) -> bool: return list(obj.scale) != [1.0, 1.0, 1.0] or obj in IfcStore.edited_objs @@ -157,7 +152,6 @@ class Ifc(blenderbim.core.tool.Ifc): IfcStore.id_map[style.id()] = obj blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback) - blenderbim.bim.handler.subscribe_to(obj, "diffuse_color", blenderbim.bim.handler.color_callback) @classmethod def link(cls, element: ifcopenshell.entity_instance, obj: IFC_CONNECTED_TYPE) -> None: diff --git a/src/blenderbim/blenderbim/tool/style.py b/src/blenderbim/blenderbim/tool/style.py index d981e2e381..f32003793d 100644 --- a/src/blenderbim/blenderbim/tool/style.py +++ b/src/blenderbim/blenderbim/tool/style.py @@ -526,10 +526,6 @@ class Style(blenderbim.core.tool.Style): def is_editing_styles(cls) -> bool: return bpy.context.scene.BIMStylesProperties.is_editing - @classmethod - def record_shading(cls, obj: bpy.types.Material) -> None: - obj.BIMMaterialProperties.shading_checksum = repr(np.array(obj.diffuse_color).tobytes()) - @classmethod def select_elements(cls, elements: list[ifcopenshell.entity_instance]) -> None: for element in elements: diff --git a/src/blenderbim/test/bim/test_feature.py b/src/blenderbim/test/bim/test_feature.py index 129a4c599b..366e240ce4 100644 --- a/src/blenderbim/test/bim/test_feature.py +++ b/src/blenderbim/test/bim/test_feature.py @@ -172,7 +172,6 @@ def i_add_a_new_collection_item(collection): def the_material_name_colour_is_set_to_colour(name, colour): obj = the_material_name_exists(name) obj.diffuse_color = [float(c) for c in colour.split(",")] - blenderbim.bim.handler.color_callback(obj, None) @given("I add an array modifier") diff --git a/src/blenderbim/test/core/test_style.py b/src/blenderbim/test/core/test_style.py index 0c8c9126f4..bcf21b8b08 100644 --- a/src/blenderbim/test/core/test_style.py +++ b/src/blenderbim/test/core/test_style.py @@ -85,7 +85,6 @@ class TestUpdateStyleColours: ifc.run("style.add_surface_textures", material="obj").should_be_called().will_return("textures") ifc.run("style.edit_surface_style", style="texture_style", attributes={"Textures": "textures"}).should_be_called().will_return("textures") - style.record_shading("obj").should_be_called() subject.update_style_colours(ifc, style, obj="obj", verbose="verbose") def test_adding_a_rendering_style_if_not_available(self, ifc, style): @@ -107,7 +106,6 @@ class TestUpdateStyleColours: attributes={"Textures": "textures"}, ).should_be_called() - style.record_shading("obj").should_be_called() subject.update_style_colours(ifc, style, obj="obj", verbose="verbose") def test_updating_shading_style_as_a_fallback_if_available(self, ifc, style): @@ -116,7 +114,6 @@ class TestUpdateStyleColours: style.get_surface_shading_style("obj").should_be_called().will_return("style") style.get_surface_shading_attributes("obj").should_be_called().will_return("attributes") ifc.run("style.edit_surface_style", style="style", attributes="attributes").should_be_called() - style.record_shading("obj").should_be_called() subject.update_style_colours(ifc, style, obj="obj") def test_adding_a_shading_style_as_a_fallback_if_not_available(self, ifc, style): @@ -127,7 +124,6 @@ class TestUpdateStyleColours: ifc.run( "style.add_surface_style", style="element", ifc_class="IfcSurfaceStyleShading", attributes="attributes" ).should_be_called() - style.record_shading("obj").should_be_called() subject.update_style_colours(ifc, style, obj="obj")