mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Lock scale for objects with openings
Currently there is an UX problem that it's not clear for users when it's possible to use scale or not. We definitely won't be able to safely apply scales for objects with openings, so will try to lock them from the start.
This commit is contained in:
@@ -811,6 +811,8 @@ class IfcImporter:
|
||||
|
||||
obj = bpy.data.objects.new(tool.Loader.get_name(element), mesh)
|
||||
self.link_element(element, obj)
|
||||
if getattr(element, "HasOpenings", None):
|
||||
tool.Geometry.lock_scale(obj)
|
||||
|
||||
if shape:
|
||||
# We use numpy here because Blender mathutils.Matrix is not accurate enough
|
||||
|
||||
@@ -130,6 +130,7 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
|
||||
# therefore bim.update_representaiton wouldn't work either way.
|
||||
should_sync_changes_first=False,
|
||||
)
|
||||
tool.Geometry.lock_scale(voided_obj)
|
||||
|
||||
if not has_visible_openings:
|
||||
tool.Ifc.unlink(element=element2)
|
||||
@@ -173,6 +174,8 @@ class RemoveOpening(bpy.types.Operator, tool.Ifc.Operator):
|
||||
is_global=True,
|
||||
should_sync_changes_first=False,
|
||||
)
|
||||
if building_obj and not getattr(element, "HasOpenings", None):
|
||||
tool.Geometry.unlock_scale(building_obj)
|
||||
|
||||
tool.Geometry.clear_cache(element)
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -136,6 +136,14 @@ class Geometry(bonsai.core.tool.Geometry):
|
||||
obj.lock_rotations_4d = False
|
||||
obj.lock_scale = (False, False, False)
|
||||
|
||||
@classmethod
|
||||
def lock_scale(cls, obj: bpy.types.Object) -> None:
|
||||
obj.lock_scale = (True, True, True)
|
||||
|
||||
@classmethod
|
||||
def unlock_scale(cls, obj: bpy.types.Object) -> None:
|
||||
obj.lock_scale = (False, False, False)
|
||||
|
||||
@classmethod
|
||||
def delete_ifc_item(cls, obj: bpy.types.Object) -> None:
|
||||
props = bpy.context.scene.BIMGeometryProperties
|
||||
|
||||
Reference in New Issue
Block a user