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

@@ -1,4 +1,5 @@
import unittest
import sys
from pathlib import Path
@@ -7,6 +8,26 @@ SOURCE_ROOT = PROJECT_ROOT / "src" / "anyimage"
class NodeAssetsTest(unittest.TestCase):
def test_geometry_assets_have_readable_local_layouts(self):
import bpy
sys.path.insert(0, str(PROJECT_ROOT / "tools" / "node_assets"))
from node_layout import validate_node_layout
bpy.ops.wm.read_factory_settings(use_empty=True)
with bpy.data.libraries.load(
str(SOURCE_ROOT / "assets" / "O_AnyImage.blend")
) as (source, target):
target.node_groups = list(source.node_groups)
groups = [
group
for group in target.node_groups
if group.bl_idname == "GeometryNodeTree"
]
self.assertEqual(len(groups), 7)
for group in groups:
validate_node_layout(group)
def test_production_code_does_not_create_node_groups(self):
offenders = []
for path in SOURCE_ROOT.rglob("*.py"):
@@ -15,9 +36,9 @@ class NodeAssetsTest(unittest.TestCase):
self.assertEqual(offenders, [])
def test_runtime_node_group_entries_load_assets(self):
material_source = (
SOURCE_ROOT / "common" / "material.py"
).read_text(encoding="utf-8")
material_source = (SOURCE_ROOT / "common" / "material.py").read_text(
encoding="utf-8"
)
mesh_plane_source = (
SOURCE_ROOT / "operators" / "convert_to_plane" / "mesh_plane.py"
).read_text(encoding="utf-8")