Refactor geometry node arrangement system

- Removed obsolete files: sections.py, semantics.json, and sources.py.
- Introduced new modules: branches.py and layout.py for improved calculation block identification and layout planning.
- Implemented a unified layout strategy for geometry nodes, ensuring consistent spacing and organization.
- Added comprehensive documentation for the new layout design and its goals.
- Established a migration plan for transitioning existing assets to the new layout system.
- Updated tests to validate the new arrangement logic and ensure compatibility with existing geometry node structures.
This commit is contained in:
2026-09-13 23:42:12 +08:00
parent 1bf858b17e
commit 09778c4b48
19 changed files with 727 additions and 1637 deletions

View File

@@ -1,4 +1,4 @@
"""Socket endpoints and conservative curve footprints for placement and preview."""
"""Socket endpoints for the node preview."""
from .flow import socket_links
@@ -18,22 +18,3 @@ def link_endpoints(link, positions, sizes):
siblings = socket_links(link.to_socket)
y -= (siblings.index(link) - (len(siblings) - 1) / 2) * 8
return start, (x, y)
def curve_footprint(start, end):
"""Reserve eight convex hulls covering a horizontal-tangent Bezier curve."""
x1, y1 = start
x2, y2 = end
bend = max(40, abs(x2 - x1) * 0.42)
curves = [(start, (x1 + bend, y1), (x2 - bend, y2), end)]
for _ in range(3):
divided = []
for points in curves:
rows = [points]
for _ in range(3):
rows.append([((a[0] + b[0]) / 2, (a[1] + b[1]) / 2)
for a, b in zip(rows[-1], rows[-1][1:])])
divided.extend((tuple(row[0] for row in rows), tuple(row[-1] for row in reversed(rows))))
curves = divided
return [(min(x for x, _ in curve), max(x for x, _ in curve),
max(y for _, y in curve), min(y for _, y in curve)) for curve in curves]