Fix #6575. Regression in moving aggregates.

This commit is contained in:
Dion Moult
2025-04-19 15:30:46 +10:00
parent bb598d848a
commit fb34af9162
@@ -3071,20 +3071,21 @@ class OverrideMove(bpy.types.Operator):
element = tool.Ifc.get_entity(obj) element = tool.Ifc.get_entity(obj)
if not element or not element.is_a("IfcElement"): if not element or not element.is_a("IfcElement"):
continue continue
parts = ifcopenshell.util.element.get_parts(element)
if parts: if parts := ifcopenshell.util.element.get_parts(element):
aggregates_to_move.append(tool.Ifc.get_object(element)) aggregates_to_move.append(tool.Ifc.get_object(element))
aggregates_to_move.extend(list(tool.Aggregate.get_parts_recursively(element))) aggregates_to_move.extend(list(tool.Aggregate.get_parts_recursively(element)))
continue continue
# Controls the aggregate level it should consider to move # Controls the aggregate level it should consider to move
aggregates = tool.Aggregate.get_aggregates_recursively(element) aggregate = None
aggregate = aggregates[-1] if aggregates := tool.Aggregate.get_aggregates_recursively(element):
if props.in_aggregate_mode: aggregate = aggregates[-1]
current_aggregate_index = aggregates.index(tool.Ifc.get_entity(props.editing_aggregate)) if props.in_aggregate_mode:
aggregate = aggregates[current_aggregate_index - 1] current_aggregate_index = aggregates.index(tool.Ifc.get_entity(props.editing_aggregate))
if tool.Ifc.get_entity(props.editing_aggregate) == aggregates[0]: aggregate = aggregates[current_aggregate_index - 1]
aggregate = aggregates[0] if tool.Ifc.get_entity(props.editing_aggregate) == aggregates[0]:
aggregate = aggregates[0]
if not parts and props.in_aggregate_mode and aggregate == tool.Ifc.get_entity(props.editing_aggregate): if not parts and props.in_aggregate_mode and aggregate == tool.Ifc.get_entity(props.editing_aggregate):
continue continue