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

View File

@@ -0,0 +1,52 @@
import shutil
from pathlib import Path
import bpy
class SnapFormPreferences(bpy.types.AddonPreferences):
bl_idname = __package__
storage_root: bpy.props.StringProperty(
name="Storage Root",
description=(
"Shared user-writable storage for Runtime, models and jobs; "
"all Blender versions can use the same directory"
),
subtype="DIR_PATH",
default=str(Path.home() / ".snapform"),
)
uv_executable: bpy.props.StringProperty(
name="uv Executable",
description="Path to uv; a command name is accepted when uv is on PATH",
subtype="FILE_PATH",
default=shutil.which("uv") or "uv",
)
torch_backend: bpy.props.EnumProperty(
name="Torch Backend",
description="PyTorch build installed into the isolated Runtime",
items=(
("CU128", "CUDA 12.8", "NVIDIA CUDA 12.8 PyTorch wheels"),
("CPU", "CPU", "CPU-only PyTorch wheels"),
),
default="CU128",
)
def draw(self, _context):
from .runtime import runtime_directory, runtime_ready
layout = self.layout
layout.prop(self, "storage_root")
layout.prop(self, "uv_executable")
layout.prop(self, "torch_backend")
layout.separator()
layout.label(text=f"Runtime: {runtime_directory()}")
if runtime_ready():
layout.label(text="Runtime is ready", icon="CHECKMARK")
else:
operator = layout.operator(
"snapform.run_job",
text="Install Runtime",
icon="IMPORT",
)
operator.job_type = "INSTALL_RUNTIME"