Files
AnyImage/src/snapform/properties.py
nan 7cd5681a8b Add tests for foreground preservation and refactor geometry node asset
- Implement test to ensure foreground preserves source RGB and Ben2 alpha in WorkerTest.
- Remove outdated tests related to background distance and original background depth.
- Update geometry node asset to reflect new naming conventions and structure.
- Introduce validation for depth plane asset, ensuring correct input/output configurations and attribute handling.
- Adjust confidence and edge parameters in geometry node asset to support a wider range of values.
2026-08-11 23:25:51 +08:00

178 lines
5.4 KiB
Python

import bpy
from .models import gs_model_enum_items, model_enum_items
from .runtime import device_enum_items
class SnapFormSettings(bpy.types.PropertyGroup):
input_path: bpy.props.StringProperty(
name="Image or Video",
description="A single image or video file used for reconstruction",
subtype="FILE_PATH",
)
background_input_path: bpy.props.StringProperty(
name="Image",
description="A single image used to test BEN2 background removal",
subtype="FILE_PATH",
)
video_frames: bpy.props.IntProperty(
name="Extract Frames",
description="Maximum number of consecutive frames extracted from the start of a video or frame sequence",
default=16,
min=1,
soft_max=64,
)
model: bpy.props.EnumProperty(
name="Model",
description="Depth Anything 3 model",
items=model_enum_items,
)
gs_model: bpy.props.EnumProperty(
name="Model",
description="Depth Anything 3 model with a Gaussian head",
items=gs_model_enum_items,
)
device: bpy.props.EnumProperty(
name="Debug Device",
description=(
"Inference device used by Debug tasks only; production tasks use "
"the Device setting in the Add-on Preferences"
),
items=device_enum_items,
default=0,
)
process_res: bpy.props.IntProperty(
name="Process Res",
description="DA3 base processing resolution",
default=504,
min=1,
soft_max=2048,
)
process_res_method: bpy.props.EnumProperty(
name="Process Res Method",
description="DA3 image resize method",
items=(
(
"upper_bound_resize",
"Upper Bound Resize",
"Make Process Res the longer side",
),
(
"lower_bound_resize",
"Lower Bound Resize",
"Make Process Res the shorter side",
),
),
default="upper_bound_resize",
)
conf_thresh_percentile: bpy.props.FloatProperty(
name="Confidence Threshold",
description="Remove the lowest-confidence percentile of points or surface faces",
default=40.0,
min=0.0,
max=100.0,
subtype="PERCENTAGE",
)
num_max_points: bpy.props.IntProperty(
name="Num Max Points",
description="DA3 GLB maximum point count",
default=1_000_000,
min=1,
soft_max=5_000_000,
)
show_cameras: bpy.props.BoolProperty(
name="Show Cameras",
description="Include DA3 camera wireframes in the GLB export",
default=True,
)
use_ray_pose: bpy.props.BoolProperty(
name="Use Ray Pose",
description="Use the slower and more accurate ray-based pose estimation",
default=False,
)
ref_view_strategy: bpy.props.EnumProperty(
name="Ref View Strategy",
description="DA3 reference view selection strategy",
items=(
("first", "First", "Always use the first view"),
("middle", "Middle", "Use the middle view"),
(
"saddle_balanced",
"Saddle Balanced",
"Select a view with balanced feature metrics",
),
(
"saddle_sim_range",
"Saddle Sim Range",
"Select the view with the largest similarity range",
),
),
default="saddle_balanced",
)
export_format: bpy.props.EnumProperty(
name="Output Type",
description="Result generated by the DA3 debug task",
items=(
(
"glb",
"Point Cloud (GLB)",
"Generate a colored point cloud and optional cameras",
),
(
"gs_ply",
"Gaussian Splats (PLY)",
"Generate a 3D Gaussian Splatting PLY",
),
(
"depth_vis",
"Depth Preview (Images)",
"Generate image and colored-depth preview pairs",
),
(
"mini_npz",
"Depth Data (NPZ)",
"Generate compact depth, confidence, and camera data",
),
(
"mesh",
"Textured Surface (GLB)",
"Generate one filtered textured depth surface per input image",
),
),
default="glb",
)
mesh_filter_edges: bpy.props.BoolProperty(
name="Filter Depth Edges",
description="Remove faces around sharp depth transitions",
default=True,
)
mesh_max_edge_length: bpy.props.FloatProperty(
name="Max Edge Length",
description=(
"Remove faces with an edge longer than this scene distance; "
"zero disables the test"
),
default=0.1,
min=0.0,
soft_max=2.0,
)
gs_views_interval: bpy.props.IntProperty(
name="GS Views Interval",
description="Export 3D Gaussians every N input views",
default=1,
min=1,
)
status: bpy.props.StringProperty(
name="Status",
default="Ready",
options={"SKIP_SAVE"},
)
progress: bpy.props.FloatProperty(
name="Progress",
default=0.0,
min=0.0,
max=1.0,
subtype="FACTOR",
options={"SKIP_SAVE"},
)