mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
Bonsai: deterministic annotation order in generated drawing SVGs (#6608)
generate_annotation built the annotation list from a set union and sorted it by ZIndex and TEXT-ness only. Annotations that tied on that key kept set iteration order, which follows entity hash (step id plus the process memory address), so the order of tied annotations (for example a label and its background fill) shuffled between Blender restarts and flipped their draw order. Add the stable IFC step id as a final tiebreaker so the order is total and session independent. Behavior preserving, no z-layer semantics changed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
committed by
Dion Moult
parent
65695fb878
commit
d30286225c
@@ -1706,6 +1706,12 @@ class CreateDrawing(bpy.types.Operator):
|
||||
key=lambda a: (
|
||||
tool.Drawing.get_annotation_z_index(a),
|
||||
1 if ifcopenshell.util.element.get_predefined_type(a) == "TEXT" else 0,
|
||||
# Deterministic tiebreaker so equal-priority annotations keep a
|
||||
# stable order across sessions. Without it the order comes from
|
||||
# the set union above, which depends on entity hashes (and thus
|
||||
# the file pointer), shuffling annotations between Blender
|
||||
# restarts. See #6608.
|
||||
a.id(),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user