feat(cutout_tool): Implement cutout region to shape functionality

- Added interaction helpers for cutout region validation and shape menu interaction.
- Created main operator for converting image regions into cutout shapes, including AI artifact generation.
- Introduced object creation logic for cutout shapes, handling depth and normal textures.
- Defined cutout shape identifiers and node groups for various shape types.
- Implemented depth texture writing and prediction artifact generation for MoGe-2.
- Developed server jobs for generating cutout artifacts, depth planes, and refining image regions.
- Added region refinement logic to enhance gesture masks using BEN2.
This commit is contained in:
2026-08-31 11:36:27 +08:00
parent 08309f719d
commit 87d7721128
80 changed files with 4823 additions and 4297 deletions

View File

@@ -184,11 +184,7 @@ def moge2_model_enum_items(_owner, _context):
def depth_plane_model_enum_items(_owner, _context):
models = [
model
for model in model_catalog()
if model.get("family") in {"moge2", "da3"} and model.get("enabled")
]
models = [model for model in model_catalog() if model.get("family") == "moge2"]
models.sort(key=lambda model: model.get("family") != "moge2")
items = _model_items(models)
items.append(
@@ -197,12 +193,8 @@ def depth_plane_model_enum_items(_owner, _context):
return items
def mesh_depth_model_enum_items(_owner, _context):
models = [
model
for model in model_catalog()
if model.get("family") in {"moge2", "da3"} and model.get("enabled")
]
def geometry_model_enum_items(_owner, _context):
models = [model for model in model_catalog() if model.get("family") == "moge2"]
models.sort(key=lambda model: model.get("family") != "moge2")
return _model_items(models)
@@ -224,38 +216,28 @@ def upscale_model_label(model_key):
return model.label if model is not None else model_key
def refine_selection_property():
def refine_region_property():
return bpy.props.BoolProperty(
name="Refine Selection",
name="Fit to Foreground",
description="Use BEN2 to fit the gesture mask to foreground content",
default=False,
)
def cutout_normal_mode_property():
return bpy.props.EnumProperty(
name="Normal",
description="Normal texture generated with MoGe-2",
items=(
("NONE", "None", "Do not generate a normal texture"),
(
"TANGENT",
"Tangent",
"Generate a normal texture relative to the image plane",
),
(
"OBJECT",
"Object",
"Generate a normal texture in Cutout object-local axes",
),
def cutout_generate_normal_property():
return bpy.props.BoolProperty(
name="Generate Normal Map",
description=(
"Generate a MoGe-2 normal texture; Depth Surface uses Object Space "
"and other shapes use Tangent Space"
),
default="NONE",
default=False,
)
def cutout_point_spacing_property():
return bpy.props.IntProperty(
name="Point Spacing",
name="Mesh Sampling Spacing",
description=(
"Source image pixels between neighboring mesh points; smaller values "
"create denser geometry"
@@ -268,10 +250,10 @@ def cutout_point_spacing_property():
class AnyImageSettings(bpy.types.PropertyGroup):
cutout_point_spacing: cutout_point_spacing_property()
cutout_normal_mode: cutout_normal_mode_property()
cutout_refine_selection: refine_selection_property()
image_box_refine_selection: refine_selection_property()
image_lasso_refine_selection: refine_selection_property()
cutout_generate_normal: cutout_generate_normal_property()
cutout_refine_region: refine_region_property()
image_box_refine_region: refine_region_property()
image_lasso_refine_region: refine_region_property()
input_path: bpy.props.StringProperty(
name="Image or Video",
description="A single image or video file used for reconstruction",