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

@@ -712,7 +712,7 @@ def build_node_group(shape):
options = group.interface.new_panel(name="Options", default_closed=True)
reference_depth = _float_input(
group,
"Base Plane Depth",
"Reference Depth",
1.0,
0.0,
None,
@@ -736,7 +736,7 @@ def build_node_group(shape):
options = group.interface.new_panel(name="Options", default_closed=True)
reference_depth = _float_input(
group,
"Base Plane Depth",
"Reference Depth",
1.0,
0.0,
None,
@@ -771,7 +771,7 @@ def build_node_group(shape):
"Depth Image",
"Depth Scale",
"Uniform Scale",
"Base Plane Depth",
"Reference Depth",
"Depth Direction",
},
)
@@ -796,7 +796,7 @@ def build_node_group(shape):
controls.outputs["Uniform Scale"],
controls.outputs["Depth Direction"],
controls.outputs["Depth Image"],
controls.outputs["Base Plane Depth"],
controls.outputs["Reference Depth"],
)
output_location = (5100.0, 600.0)
else:
@@ -806,7 +806,7 @@ def build_node_group(shape):
controls.outputs["Thickness"],
controls.outputs["Depth Scale"],
controls.outputs["Uniform Scale"],
controls.outputs["Base Plane Depth"],
controls.outputs["Reference Depth"],
controls.outputs["Depth Image"],
)
output_location = (8200.0, 400.0)
@@ -877,7 +877,7 @@ def build_cutout_modifier_group(shape_groups):
reference_depth = _float_input(
group,
"Base Plane Depth",
"Reference Depth",
1.0,
0.0,
None,

View File

@@ -59,7 +59,7 @@ def build_depth_plane_group(mesh_plane_group):
options = group.interface.new_panel(name="Options", default_closed=True)
base_plane_depth = _interface_socket(
group,
"Base Plane Depth",
"Reference Depth",
"INPUT",
"NodeSocketFloat",
parent=options,
@@ -98,7 +98,7 @@ def build_depth_plane_group(mesh_plane_group):
shape_input = _group_input(
nodes,
(-1550.0, 950.0),
{"Thickness", "Depth Scale", "Base Plane Depth"},
{"Thickness", "Depth Scale", "Reference Depth"},
)
image_input = _group_input(
nodes,
@@ -142,7 +142,7 @@ def build_depth_plane_group(mesh_plane_group):
links.new(depth_components.outputs["X"], metric_depth.inputs[0])
links.new(image_input.outputs["Uniform Scale"], metric_depth.inputs[1])
relative_depth = _math(nodes, "SUBTRACT", (50.0, -350.0))
links.new(shape_input.outputs["Base Plane Depth"], relative_depth.inputs[0])
links.new(shape_input.outputs["Reference Depth"], relative_depth.inputs[0])
links.new(metric_depth.outputs[0], relative_depth.inputs[1])
full_offset = _math(nodes, "MULTIPLY", (300.0, -350.0))
links.new(relative_depth.outputs[0], full_offset.inputs[0])

View File

@@ -70,7 +70,7 @@ def main():
"Subdivide",
"Thickness",
"Depth Scale",
"Base Plane Depth",
"Reference Depth",
"Uniform Scale",
"Depth Image",
]
@@ -79,7 +79,7 @@ def main():
]
assert [panel.name for panel in depth_panels] == ["Options", "Data"]
assert [item.name for item in depth_panels[0].interface_items] == [
"Base Plane Depth"
"Reference Depth"
]
assert [item.name for item in depth_panels[1].interface_items] == [
"Uniform Scale",

View File

@@ -140,7 +140,7 @@ def main():
"Smooth Iterations",
"Cleanup",
"Smooth",
"Base Plane Depth",
"Reference Depth",
"Depth Direction",
"Uniform Scale",
"Depth Image",
@@ -153,7 +153,7 @@ def main():
"Thickness",
"Depth Scale",
"Double Sided",
"Base Plane Depth",
"Reference Depth",
"Depth Direction",
"Uniform Scale",
"Depth Image",
@@ -162,7 +162,7 @@ def main():
"Geometry",
"Thickness",
"Depth Scale",
"Base Plane Depth",
"Reference Depth",
"Uniform Scale",
"Depth Image",
],
@@ -184,7 +184,7 @@ def main():
"Thickness": set(shapes.CUTOUT_SHAPES),
"Depth Scale": {"DEPTH_BALLOON", "DEPTH_SURFACE"},
"Double Sided": {"DEPTH_BALLOON"},
"Base Plane Depth": {"DEPTH_BALLOON", "DEPTH_SURFACE"},
"Reference Depth": {"DEPTH_BALLOON", "DEPTH_SURFACE"},
"Depth Direction": {"DEPTH_BALLOON"},
"Uniform Scale": {"DEPTH_BALLOON", "DEPTH_SURFACE"},
"Depth Image": {"DEPTH_BALLOON", "DEPTH_SURFACE"},
@@ -347,7 +347,7 @@ def main():
("Depth Image", point_image),
("Depth Scale", 1.0),
("Uniform Scale", 1.0),
("Base Plane Depth", 2.0),
("Reference Depth", 2.0),
("Depth Direction", (0.0, 0.0, 1.0)),
):
set_modifier_input(
@@ -398,7 +398,7 @@ def main():
("Depth Image", point_image),
("Depth Scale", 1.0),
("Uniform Scale", 1.0),
("Base Plane Depth", 2.0),
("Reference Depth", 2.0),
("Smooth Iterations", 0),
):
set_modifier_input(