mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
calculate materials checksum in a common method
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user