Refactor Cutout and Image Editing Logic

- Renamed "Base Plane Depth" to "Reference Depth" across validate_cutout.py for consistency.
- Introduced a new specification for Cutout mesh sampling to ensure source pixel spacing is preserved and limits are applied correctly.
- Unified naming conventions for image editing results to maintain consistency across Remove Background, Upscale, and Crop operations.
- Updated the handling of Refine Selection to ensure it retains the original bounds and does not apply unnecessary cropping.
- Enhanced material generation logic to connect image color directly to IOR Level, improving the rendering of dark areas.
- Established clear requirements for geometry depth controls and image result materials to ensure consistent behavior across different components.
- Removed outdated logic and ensured all changes are documented and tested for regression.
This commit is contained in:
2026-09-03 01:02:10 +08:00
parent a6041cbe03
commit bdbde1a10d
47 changed files with 1120 additions and 257 deletions

View File

@@ -78,7 +78,6 @@ def test_selection_path_json_contains_only_points_and_invert():
points=((1, 2), (8, 2), (4, 9)),
invert=True,
)
value = selection_path.to_json()
assert set(json.loads(value)) == {"points", "invert"}
@@ -95,6 +94,24 @@ def test_selection_path_json_contains_only_points_and_invert():
)
def test_selection_mask_sidecar_round_trip_and_cleanup(tmp_path):
original = selection.SelectionMask(
np.asarray(((0.0, 0.25), (0.5, 1.0)), dtype=np.float32),
(3, 4, 5, 6),
)
input_path = tmp_path / "input.png"
input_path.write_bytes(b"input")
path = selection.save_selection_mask(input_path, original)
loaded = selection.load_selection_mask(path, original.bounds)
assert path.parent == input_path.parent
np.testing.assert_array_equal(loaded.values, original.values)
assert loaded.bounds == original.bounds
selection.cleanup_selection_mask(path)
assert not path.exists()
def test_nonzero_winding_keeps_same_direction_overlap():
points = (
(1, 1),