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:
@@ -1,9 +1,5 @@
|
||||
"""Cutout Selection validation and Shape-menu interaction helpers."""
|
||||
|
||||
from ...preferences import (
|
||||
MAX_CUTOUT_MESH_RESOLUTION,
|
||||
MIN_CUTOUT_MESH_RESOLUTION,
|
||||
)
|
||||
from ...properties import ai_ready
|
||||
from .shape import CUTOUT_SHAPE_LABELS
|
||||
|
||||
@@ -22,15 +18,6 @@ CUTOUT_MESH_DETAIL_SPACING = {
|
||||
}
|
||||
|
||||
|
||||
def cutout_mesh_resolution(image_size, point_spacing):
|
||||
longest_edge = max(int(value) for value in image_size)
|
||||
detail = round(longest_edge / max(int(point_spacing), 1))
|
||||
return max(
|
||||
MIN_CUTOUT_MESH_RESOLUTION,
|
||||
min(MAX_CUTOUT_MESH_RESOLUTION, detail),
|
||||
)
|
||||
|
||||
|
||||
def cutout_mesh_detail_spacing(mesh_detail):
|
||||
return CUTOUT_MESH_DETAIL_SPACING[str(mesh_detail)]
|
||||
|
||||
@@ -44,7 +31,7 @@ def _pie_button(
|
||||
selection_path_json,
|
||||
refine_selection,
|
||||
generate_normal,
|
||||
mesh_resolution,
|
||||
point_spacing,
|
||||
inward_axis,
|
||||
):
|
||||
operator = pie.operator(
|
||||
@@ -57,7 +44,7 @@ def _pie_button(
|
||||
operator.shape = shape
|
||||
operator.refine_selection = refine_selection
|
||||
operator.generate_normal = generate_normal
|
||||
operator.mesh_resolution = mesh_resolution
|
||||
operator.point_spacing = point_spacing
|
||||
operator.inward_axis = inward_axis
|
||||
|
||||
|
||||
@@ -77,7 +64,6 @@ def open_shape_pie(
|
||||
generate_normal = ready and bool(
|
||||
getattr(settings, "cutout_generate_normal", False)
|
||||
)
|
||||
mesh_resolution = cutout_mesh_resolution(source_object.data.size, point_spacing)
|
||||
inward_axis = str(getattr(settings, "cutout_inward_axis", "NEGATIVE_Z"))
|
||||
|
||||
def draw(menu, _context):
|
||||
@@ -93,7 +79,7 @@ def open_shape_pie(
|
||||
selection_path_json,
|
||||
refine_selection,
|
||||
generate_normal,
|
||||
mesh_resolution,
|
||||
point_spacing,
|
||||
inward_axis,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user