Refactor and enhance SnapForm functionality

- Introduced MODEL_NUMBERS for better model indexing.
- Improved enum_items function to cache results and handle download status.
- Updated ActiveJob class to manage temporary input paths and added displacement_via property.
- Changed IMAGE_DEPTH_PROCESS_RES_METHOD from "lower_bound_resize" to "upper_bound_resize".
- Enhanced RunJob operator to include new properties and improved error messages.
- Modified panel layout for better user experience and added runtime installation checks.
- Updated SnapFormSettings to reflect new model properties and defaults.
- Added temporary input path management in runtime.
- Refined worker functions to improve error handling and messaging.
- Expanded tests to cover new functionality and ensure backward compatibility.
- Fixed packaging script to align with versioning conventions.
This commit is contained in:
2026-08-03 13:47:15 +08:00
parent b02372c457
commit a503786c62
14 changed files with 827 additions and 174 deletions

View File

@@ -1,6 +1,6 @@
import bpy
from .models import MODELS, selected_model_key
from .models import MODELS
from .operators import active_job
from .runtime import model_ready, runtime_ready
@@ -18,13 +18,14 @@ class RuntimeModelsPanel(bpy.types.Panel):
if not runtime_ready():
layout.label(text="Runtime is not installed", icon="ERROR")
if not running:
operator = layout.operator(
"snapform.run_job",
text="Install Runtime",
icon="IMPORT",
)
operator.job_type = "INSTALL_RUNTIME"
install_row = layout.row()
install_row.enabled = not running
operator = install_row.operator(
"snapform.run_job",
text="Install Runtime",
icon="IMPORT",
)
operator.job_type = "INSTALL_RUNTIME"
for model in MODELS.values():
self._draw_model(layout, model, running)
@@ -34,16 +35,16 @@ class RuntimeModelsPanel(bpy.types.Panel):
row.label(text=model.label)
if model_ready(model.key):
row.label(text="Ready", icon="CHECKMARK")
elif runtime_ready() and not running:
operator = row.operator(
else:
download_row = row.row(align=True)
download_row.enabled = runtime_ready() and not running
operator = download_row.operator(
"snapform.run_job",
text="Download",
icon="IMPORT",
)
operator.job_type = "DOWNLOAD_MODEL"
operator.model_key = model.key
else:
row.label(text="Not downloaded", icon="ERROR")
class DebugPanel(bpy.types.Panel):
@@ -59,16 +60,10 @@ class DebugPanel(bpy.types.Panel):
settings = context.scene.snapform_settings
layout.prop(settings, "export_format")
model_key = selected_model_key(settings)
model_property = (
"gs_model" if settings.export_format == "gs_ply" else "model"
)
model_row = layout.row(align=True)
model_row.prop(settings, model_property)
if model_ready(model_key):
model_row.label(text="", icon="CHECKMARK")
else:
model_row.label(text="", icon="ERROR")
layout.prop(settings, model_property)
layout.prop(settings, "input_path")
input_path = bpy.path.abspath(settings.input_path)
@@ -103,10 +98,11 @@ class DebugPanel(bpy.types.Panel):
ply_box.label(text="PLY (3DGS) Settings")
ply_box.prop(settings, "gs_views_interval")
if active_job() is None:
operator = layout.operator(
"snapform.run_job",
text="Export",
icon="EXPORT",
)
operator.job_type = "RECONSTRUCT"
export_row = layout.row()
export_row.enabled = active_job() is None
operator = export_row.operator(
"snapform.run_job",
text="Export",
icon="EXPORT",
)
operator.job_type = "RECONSTRUCT"