calculate materials checksum in a common method

This commit is contained in:
Andrej730
2024-06-25 15:14:15 +05:00
parent 39cd4187ea
commit 46d3d3afe1
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ class IfcExporter:
def has_changed_materials(self, obj: bpy.types.Object) -> bool:
checksum = obj.data.BIMMeshProperties.material_checksum
return checksum != str([s.id() for s in tool.Geometry.get_styles(obj) if s])
return checksum != tool.Geometry.get_material_checksum(obj)
def sync_object_placement(self, obj: bpy.types.Object) -> Union[ifcopenshell.entity_instance, None]:
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
+5 -1
View File
@@ -405,6 +405,10 @@ class Geometry(blenderbim.core.tool.Geometry):
return "IfcExtrudedAreaSolid/IfcCircleProfileDef"
return "IfcExtrudedAreaSolid/IfcArbitraryProfileDefWithVoids"
@classmethod
def get_material_checksum(cls, obj: bpy.types.Object) -> str:
return str([s.id() for s in cls.get_styles(obj) if s])
@classmethod
def get_mesh_checksum(cls, mesh: Union[bpy.types.Mesh, bpy.types.Curve]) -> str:
data_bytes = b""
@@ -659,7 +663,7 @@ class Geometry(blenderbim.core.tool.Geometry):
@classmethod
def record_object_materials(cls, obj: bpy.types.Object) -> None:
obj.data.BIMMeshProperties.material_checksum = str([s.id() for s in cls.get_styles(obj) if s])
obj.data.BIMMeshProperties.material_checksum = cls.get_material_checksum(obj)
@classmethod
def record_object_position(cls, obj: bpy.types.Object) -> None: