refactor: Update cutout and depth handling by removing unused functions and adjusting parameters

This commit is contained in:
2026-09-13 22:08:32 +08:00
parent a0dd6e4a88
commit 1bf858b17e
13 changed files with 88 additions and 326 deletions

View File

@@ -20,6 +20,36 @@ def store_test_fields(group, geometry, fields):
return geometry
@pytest.mark.parametrize("mode", [0, 1])
def test_normal_smooth_changes_thickness_direction_without_moving_zero_thickness(mode):
from tests.support.depth_surface import surface, evaluated
obj, set_value = surface(step=1, resolution=10)
xy = np.array([v.co[:2] for v in obj.data.vertices])
profile = .3 * np.sin(np.pi * xy[:, 0] / 2) * np.sin(np.pi * xy[:, 1])
profile[abs(profile) < 1e-7] = 0
obj.data.attributes.new("o_balloon", "FLOAT", "POINT").data.foreach_set("value", profile)
set_value("Mode", mode)
set_value("Front Inflation", .2)
modifier = obj.modifiers[0]
thickness = modifier_input_identifier(modifier.node_group, "Thickness", subtype="DISTANCE" if mode else "NONE")
def result(amount, smoothing):
set_modifier_input(modifier, thickness, amount)
set_value("Normal Smooth", smoothing)
return evaluated(obj)
raw, faces = result(0, 16)
smooth, smooth_faces = result(0, 512)
np.testing.assert_array_equal(raw, smooth)
assert faces == smooth_faces
raw, faces = result(1, 16)
smooth, smooth_faces = result(1, 512)
assert faces == smooth_faces
assert np.isfinite(smooth).all()
assert np.max(np.abs(raw - smooth)) > 1e-5
def set_test_structure(monkeypatch, value):
"""Control structural amplitude without depending on storage nodes."""
from tools.nodes.groups import image_depth_cutout