- 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.
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
import importlib.util
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def load_module(name, relative_path):
|
|
specification = importlib.util.spec_from_file_location(
|
|
name,
|
|
PROJECT_ROOT / relative_path,
|
|
)
|
|
module = importlib.util.module_from_spec(specification)
|
|
specification.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
class ModelTest(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.models = load_module(
|
|
"snapform_models",
|
|
"src/snapform/models.py",
|
|
)
|
|
|
|
def test_base_model_is_default_friendly_apache_model(self):
|
|
model = self.models.get_model("BASE")
|
|
|
|
self.assertEqual(model.repository, "depth-anything/DA3-BASE")
|
|
self.assertEqual(model.license_name, "Apache 2.0")
|
|
|
|
def test_large_model_exposes_noncommercial_license(self):
|
|
model = self.models.get_model("LARGE_1_1")
|
|
|
|
self.assertEqual(model.license_name, "CC BY-NC 4.0")
|
|
|
|
def test_giant_models_expose_gaussian_head(self):
|
|
for model_key in ("GIANT_1_1", "NESTED_GIANT_LARGE_1_1"):
|
|
with self.subTest(model_key=model_key):
|
|
self.assertTrue(self.models.get_model(model_key).supports_gs)
|
|
|
|
def test_unknown_model_is_rejected(self):
|
|
with self.assertRaisesRegex(ValueError, "Unknown DA3 model"):
|
|
self.models.get_model("UNKNOWN")
|