Enhance device management and model handling in SnapForm

- Updated frame extraction logic to allow for single frame extraction.
- Integrated model readiness checks for BEN2 and DA3 models in relevant operators.
- Added directory name attribute to model specifications for better organization.
- Improved device selection logic for production and debug tasks.
- Refactored preferences to expose device settings and ensure they reflect available hardware.
- Enhanced runtime device detection and management, including support for CUDA and MPS.
- Updated tests to cover new device management features and model directory handling.
- Removed deprecated download model tests to streamline codebase.
This commit is contained in:
2026-08-08 20:16:11 +08:00
parent aee460fe7f
commit 9c896213a5
18 changed files with 699 additions and 196 deletions

View File

@@ -1,6 +1,7 @@
import bpy
from .models import gs_model_enum_items, model_enum_items
from .runtime import device_enum_items
class SnapFormSettings(bpy.types.PropertyGroup):
@@ -18,7 +19,7 @@ class SnapFormSettings(bpy.types.PropertyGroup):
name="Extract Frames",
description="Maximum number of consecutive frames extracted from the start of a video or frame sequence",
default=16,
min=2,
min=1,
soft_max=64,
)
model: bpy.props.EnumProperty(
@@ -32,15 +33,13 @@ class SnapFormSettings(bpy.types.PropertyGroup):
items=gs_model_enum_items,
)
device: bpy.props.EnumProperty(
name="Device",
description="Inference device used by the external Runtime",
items=(
("AUTO", "Auto", "Use CUDA, then MPS, otherwise CPU"),
("CUDA", "CUDA", "Require an NVIDIA CUDA device"),
("MPS", "MPS", "Use Apple Metal (MPS)"),
("CPU", "CPU", "Run on CPU"),
name="Debug Device",
description=(
"Inference device used by Debug tasks only; production tasks use "
"the Device setting in the Add-on Preferences"
),
default="AUTO",
items=device_enum_items,
default=0,
)
process_res: bpy.props.IntProperty(
name="Process Res",