Add comprehensive tests for image processing and mask functionalities

- Introduced tests for color image handling, ensuring source preservation and premultiplied alpha usage.
- Implemented tests for brush stroke operations, validating segment boundaries and brush anti-aliasing.
- Added tests for frame anti-aliasing, confirming correct rendering behavior with various alpha values and depth settings.
- Created tests for frame projection, ensuring accurate overlap calculations and half-plane clipping.
- Developed tests for image premultiplied retention, verifying behavior during loading and packing processes.
- Added undo functionality tests for mask operations, ensuring single transaction behavior during edits.
This commit is contained in:
2026-09-05 21:33:11 +08:00
parent bbaa4bff46
commit 1994d38ccd
111 changed files with 7691 additions and 2341 deletions

View File

@@ -192,27 +192,46 @@ def upscale_model_label(model_key):
return model.label if model is not None else model_key
def refine_selection_property():
return bpy.props.BoolProperty(
name="Refine Selection",
description="Use BEN2 to refine the selection to foreground content",
default=False,
def mask_gesture_property():
return bpy.props.EnumProperty(
name="Gesture",
description="Shape used to edit image Alpha",
items=(
("LASSO", "Lasso", "Draw a closed freehand area"),
("BRUSH", "Brush", "Paint with a circular brush"),
("POLYLINE", "Polyline", "Click points to define a closed area"),
),
default="LASSO",
)
def crop_invert_property():
return bpy.props.BoolProperty(
name="Invert",
description="Keep the area outside the crop selection",
default=False,
def mask_mode_property():
return bpy.props.EnumProperty(
name="Mode",
description="How the gesture changes image Alpha",
items=(
("SET", "Set", "Keep current Alpha inside the gesture", "SELECT_SET", 0),
("ADD", "Add", "Extend Alpha with the gesture", "SELECT_EXTEND", 1),
(
"SUBTRACT",
"Subtract",
"Remove Alpha inside the gesture",
"SELECT_SUBTRACT",
2,
),
),
default="SUBTRACT",
)
def keep_original_property():
return bpy.props.BoolProperty(
name="Keep Original",
description="Create a crop result while preserving the source Image Empty",
default=False,
def mask_radius_property():
return bpy.props.IntProperty(
name="Radius",
description="Brush radius in Viewport pixels",
default=25,
min=1,
soft_max=500,
subtype="PIXEL",
)
@@ -256,17 +275,10 @@ def cutout_mesh_detail_property():
class AnyImageSettings(bpy.types.PropertyGroup):
cutout_mesh_detail: cutout_mesh_detail_property()
cutout_generate_normal: cutout_generate_normal_property()
cutout_refine_selection: refine_selection_property()
cutout_inward_axis: cutout_inward_axis_property()
crop_box_refine_selection: refine_selection_property()
crop_box_invert: crop_invert_property()
crop_box_keep_original: keep_original_property()
crop_lasso_refine_selection: refine_selection_property()
crop_lasso_invert: crop_invert_property()
crop_lasso_keep_original: keep_original_property()
crop_polyline_invert: crop_invert_property()
crop_polyline_keep_original: keep_original_property()
crop_perspective_keep_original: keep_original_property()
mask_gesture: mask_gesture_property()
mask_mode: mask_mode_property()
mask_radius: mask_radius_property()
input_path: bpy.props.StringProperty(
name="Image or Video",
description="A single image or video file used for reconstruction",