Files
AnyImage/tests/tools/nodes/test_temporary_attributes.py
nan 31074bd511 Add tests and implement boundary smoothing and cutout functionality
- Introduced tests for boundary smoothing in `test_boundary_smoothing.py`, verifying that smoothing reduces stair-step artifacts while preserving boundary integrity.
- Added tests for cutout boundary behavior in `test_cutout_boundary.py`, ensuring proper handling of boundary triangles and normal blending.
- Created `test_temporary_attributes.py` to check the cleanup of temporary attributes across depth modifier branches, ensuring no warnings are raised.
- Implemented point culling functionality in `test_validity.py`, confirming that invalid points are removed without affecting adjacent geometry.
- Developed boundary smoothing logic in `boundary_smoothing.py`, allowing for depth smoothing while maintaining edge integrity.
- Added cutout boundary management in `cutout_boundary.py`, including functions for removing boundary triangles and tapering thickness profiles.
- Implemented validity checks in `validity.py` to ensure proper deletion of invalid vertices and associated wire edges.
2026-09-11 20:37:20 +08:00

44 lines
1.7 KiB
Python

"""Check temporary attribute lifetimes across depth modifier branches."""
import bpy
import pytest
from anyimage.common.node import node_asset_path
from tests.support.depth_surface import surface
from tests.support.planes import create_surface
from tests.tools.nodes.test_image_depth_panorama import panorama
@pytest.mark.parametrize("source", ["definition", "asset"])
@pytest.mark.parametrize("kind", ["cutout", "plane", "panorama"])
def test_depth_attribute_cleanup_has_no_warnings(source, kind):
if kind == "cutout":
obj, set_value = surface()
elif kind == "plane":
obj, set_value, *_ = create_surface("definition", "DEPTH")
else:
obj, set_value = panorama(subdivide=2)
modifier = obj.modifiers[0]
if source == "asset":
name = modifier.node_group.name
modifier.node_group.name += " Definition"
with bpy.data.libraries.load(str(node_asset_path())) as (_, target):
target.node_groups = [name]
modifier.node_group = target.node_groups[0]
for split in (0.0, 0.5, 0.0):
set_value("Split Threshold", split)
for smooth in (0, 5):
set_value("Boundary Smooth", smooth)
evaluated = obj.evaluated_get(bpy.context.evaluated_depsgraph_get())
mesh = evaluated.to_mesh()
try:
assert mesh.vertices
assert not {a.name for a in mesh.attributes} & {
".o_anyimage_depth_cut", ".o_anyimage_original_boundary",
}
assert not list(modifier.node_warnings), [
warning.message for warning in modifier.node_warnings
]
finally:
evaluated.to_mesh_clear()