mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix error with Shift-E #5975
E.g. two objects are selected - tesselation and profile and tesellation being active object. Using s-e with deselect tesselation object as it doens't have a usage but Bonsai would still try to run bim.enable_editing_extrusion_profile on it leading to the error. Also fix possible issues for hotkey executed without active object (it seems all operators in hotkey do require active object)
This commit is contained in:
@@ -999,7 +999,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bpy.ops.bim.align_product(align_type="CENTERLINE")
|
||||
|
||||
def hotkey_S_E(self):
|
||||
if not bpy.context.selected_objects:
|
||||
if not bpy.context.selected_objects or not (active_object := bpy.context.active_object):
|
||||
return
|
||||
|
||||
# NOTE: placing it before the other operations because railing can also be SweptSolid
|
||||
@@ -1019,7 +1019,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
||||
elif tool.Model.is_parametric_window_active() or tool.Model.is_parametric_door_active():
|
||||
return
|
||||
|
||||
selected_usages = {}
|
||||
selected_usages: dict[str, list[bpy.types.Object]] = {}
|
||||
for obj in bpy.context.selected_objects:
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
if not element:
|
||||
@@ -1037,6 +1037,10 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
||||
selected_usages.setdefault(usage, []).append(obj)
|
||||
|
||||
if len(bpy.context.selected_objects) == 1:
|
||||
# Active object was probably unselected because it doesn't have a usage.
|
||||
if bpy.context.selected_objects[0] != active_object:
|
||||
return
|
||||
|
||||
if self.active_material_usage == "LAYER3":
|
||||
# Edit LAYER3 profile
|
||||
if bpy.context.active_object and bpy.context.active_object.mode == "OBJECT":
|
||||
|
||||
Reference in New Issue
Block a user