- 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.
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
from pathlib import Path
|
|
|
|
import bpy
|
|
|
|
from .runtime import device_enum_items
|
|
|
|
|
|
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"),
|
|
)
|
|
device: bpy.props.EnumProperty(
|
|
name="Device",
|
|
description=(
|
|
"Inference device used by production tasks; only devices supported "
|
|
"on this machine are listed"
|
|
),
|
|
items=device_enum_items,
|
|
default=0,
|
|
)
|
|
|
|
def draw(self, _context):
|
|
from .operators import active_job
|
|
from .runtime import runtime_directory, runtime_ready
|
|
|
|
layout = self.layout
|
|
layout.prop(self, "storage_root")
|
|
layout.prop(self, "device")
|
|
layout.separator()
|
|
layout.label(text=f"Runtime: {runtime_directory()}")
|
|
if runtime_ready():
|
|
layout.label(text="Runtime is ready", icon="CHECKMARK")
|
|
else:
|
|
install_row = layout.row()
|
|
install_row.enabled = active_job() is None
|
|
operator = install_row.operator(
|
|
"snapform.run_job",
|
|
text="Install Runtime",
|
|
icon="IMPORT",
|
|
)
|
|
operator.job_type = "INSTALL_RUNTIME"
|
|
layout.separator()
|
|
operator = layout.operator(
|
|
"snapform.control_host",
|
|
text="Open Host Log",
|
|
icon="TEXT",
|
|
)
|
|
operator.action = "LOG"
|