Use common method for checking if object is scaled

This commit is contained in:
Andrej730
2024-10-24 17:23:21 +05:00
parent 4040c31583
commit 9998442eb4
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -144,7 +144,7 @@ class IfcExporter:
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
if not tool.Ifc.is_moved(obj):
return
if (obj.scale - Vector((1.0, 1.0, 1.0))).length > 1e-4:
if tool.Geometry.is_scaled(obj):
bpy.ops.bim.update_representation(obj=obj.name)
return element
if element.is_a("IfcGridAxis"):
+1 -1
View File
@@ -1548,7 +1548,7 @@ class Drawing(bonsai.core.tool.Drawing):
def sync_object_placement(cls, obj: bpy.types.Object) -> Union[ifcopenshell.entity_instance, None]:
blender_matrix = np.array(obj.matrix_world)
element = tool.Ifc.get_entity(obj)
if (obj.scale - mathutils.Vector((1.0, 1.0, 1.0))).length > 1e-4:
if tool.Geometry.is_scaled(obj):
bpy.ops.bim.update_representation(obj=obj.name)
return element
if element.is_a("IfcGridAxis"):
+1 -1
View File
@@ -83,7 +83,7 @@ class Geometry(bonsai.core.tool.Geometry):
@classmethod
def clear_scale(cls, obj: bpy.types.Object) -> None:
# Note that clearing scale has no impact on cameras.
if (obj.scale - Vector((1.0, 1.0, 1.0))).length > 1e-4:
if cls.is_scaled(obj):
if not obj.data:
location, rotation, _ = obj.matrix_world.decompose()
obj.matrix_world = Matrix.Translation(location) @ rotation.to_matrix().to_4x4()