Add SnapForm panels, preferences, properties, and runtime management

- Implemented RuntimeModelsPanel and DebugPanel for UI integration in Blender.
- Created SnapFormPreferences to manage user settings for storage and runtime configuration.
- Defined SnapFormSettings to hold various properties related to input, model selection, and export options.
- Developed runtime management functions for installation, model downloading, and reconstruction commands.
- Added status bar functionality to display job progress and status in the Blender UI.
- Implemented worker script for handling model downloads and depth reconstruction tasks.
- Introduced unit tests for download progress reporting and image depth extraction functionalities.
This commit is contained in:
2026-08-03 10:13:33 +08:00
parent 9586b35440
commit b02372c457
26 changed files with 1849 additions and 181 deletions

146
src/snapform/properties.py Normal file
View File

@@ -0,0 +1,146 @@
import bpy
from .models import 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",
)
video_frames: bpy.props.IntProperty(
name="Video Frames",
description="Maximum number of frames sampled evenly from a video",
default=16,
min=2,
soft_max=64,
)
model: bpy.props.EnumProperty(
name="Model",
description="Depth Anything 3 model",
items=enum_items(),
default="BASE",
)
gs_model: bpy.props.EnumProperty(
name="Model",
description="Depth Anything 3 model with a Gaussian head",
items=enum_items(supports_gs=True),
default="GIANT_1_1",
)
device: bpy.props.EnumProperty(
name="Device",
description="Inference device used by the external Runtime",
items=(
("AUTO", "Auto", "Use CUDA when available, otherwise CPU"),
("CUDA", "CUDA", "Require an NVIDIA CUDA device"),
("CPU", "CPU", "Run on CPU"),
),
default="AUTO",
)
process_res: bpy.props.IntProperty(
name="Process Res",
description="DA3 base processing resolution",
default=1024,
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="lower_bound_resize",
)
conf_thresh_percentile: bpy.props.FloatProperty(
name="Conf Thresh Percentile",
description="DA3 GLB confidence threshold percentile",
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="Export Format",
description="Official DA3 export format",
items=(
("glb", "GLB", "Export a colored point cloud as GLB"),
("gs_ply", "PLY (3DGS)", "Export Gaussian splats as PLY"),
(
"depth_vis",
"Depth Images",
"Export image and depth visualization pairs",
),
(
"mini_npz",
"Mini NPZ",
"Export compact depth and camera data",
),
),
default="glb",
)
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"},
)