Add depth surface processing and layout tools

- Implemented `cutout_depth_surface.py` for face separation and connected thickness calculations for depth surface assets.
- Created `cutout_depth_surface_layout.py` to arrange nodes for staggered calculation branches in depth surface processing.
- Authored `geometry_layouts.py` to define layouts for various geometry assets, including image cutouts and depth planes.
- Introduced `node_layout.py` for shared presentation rules, facilitating node arrangement and validation in geometry-node layouts.
This commit is contained in:
2026-09-07 19:21:03 +08:00
parent a0adf79db0
commit 7dec3b7ca4
21 changed files with 2075 additions and 373 deletions

View File

@@ -2,6 +2,8 @@
import bpy
from geometry_layouts import layout_geometry
MESH_PLANE_GROUP_NAME = "O Mesh Plane"
@@ -27,6 +29,31 @@ def new_group_input(nodes, location, visible_names):
return node
def localize_dimensions(group):
"""Repeat the small source-bounds calculation near UV and mesh consumers."""
sources = [
group.nodes[name] for name in ("Bounding Box", "Vector Math", "Separate XYZ")
]
for targets in (
{"Math.011", "Math.013"},
{"Grid", "Combine XYZ.001", "Vector Math.001"},
):
copies = {source: group.nodes.new(source.bl_idname) for source in sources}
copies[sources[1]].operation = "SUBTRACT"
for link in list(group.links):
if link.to_node in copies:
source = copies.get(link.from_node, link.from_node)
group.links.new(
source.outputs[link.from_socket.identifier],
copies[link.to_node].inputs[link.to_socket.identifier],
)
elif link.from_node in copies and link.to_node.name in targets:
group.links.new(
copies[link.from_node].outputs[link.from_socket.identifier],
link.to_socket,
)
def build_mesh_plane_group():
group = bpy.data.node_groups.new(MESH_PLANE_GROUP_NAME, "GeometryNodeTree")
group.is_modifier = True
@@ -256,4 +283,6 @@ def build_mesh_plane_group():
"Build an aspect-adaptive image plane and add optional centered thickness."
)
group.use_fake_user = True
localize_dimensions(group)
layout_geometry(group)
return group