Bonsai: stop merged cut linework leaking classes onto disjoint pieces

In merge_linework_and_add_metadata every closed subpath of an element
group was queued with a reference to the same class set, so when one
subpath was unioned with a neighbouring element the in-place
polygon_classes.update() also rewrote the classes of that element's
other, geometrically unrelated subpaths. A wall split by an opening
could therefore emit a piece carrying a neighbour's GlobalId, status
and metadata classes, styling it from the wrong CSS rules.

Queue a copy of the class set per polygon so each merged polygon owns
its own classes.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Petru Conduraru
2026-07-20 13:24:38 +03:00
parent 55a2430d71
commit a6e2a97b6d
@@ -1708,7 +1708,7 @@ class CreateDrawing(bpy.types.Operator):
coords.append(coords[0])
if len(coords) > 2 and coords[0] == coords[-1]:
is_closed_polygon = True
queue.append((shapely.Polygon(coords), classes))
queue.append((shapely.Polygon(coords), set(classes)))
if is_closed_polygon:
el.getparent().remove(el)