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

50
src/snapform/__init__.py Normal file
View File

@@ -0,0 +1,50 @@
import bpy
from .image_depth import (
BuildDepthPlane,
ConvertImageToDepthPlane,
draw_image_context_menu,
)
from .operators import (
CancelJob,
RunJob,
cancel_active_job,
close_active_job,
)
from .panel import DebugPanel, RuntimeModelsPanel
from .preferences import SnapFormPreferences
from .properties import SnapFormSettings
from .status_bar import draw_status_bar
CLASSES = (
SnapFormPreferences,
SnapFormSettings,
RunJob,
CancelJob,
BuildDepthPlane,
ConvertImageToDepthPlane,
RuntimeModelsPanel,
DebugPanel,
)
def register():
for class_type in CLASSES:
bpy.utils.register_class(class_type)
bpy.types.Scene.snapform_settings = bpy.props.PointerProperty(
type=SnapFormSettings,
)
bpy.types.STATUSBAR_HT_header.append(draw_status_bar)
bpy.types.VIEW3D_MT_object_context_menu.append(draw_image_context_menu)
def unregister():
cancel_active_job()
close_active_job()
bpy.types.VIEW3D_MT_object_context_menu.remove(draw_image_context_menu)
bpy.types.STATUSBAR_HT_header.remove(draw_status_bar)
if hasattr(bpy.types.Scene, "snapform_settings"):
del bpy.types.Scene.snapform_settings
for class_type in reversed(CLASSES):
bpy.utils.unregister_class(class_type)