feat: Add MoGe-2 surface generation and export functionality

- Introduced new enum items for depth plane and surface models with caching.
- Added MOGE2_MESH_JOB to operators for converting images to surfaces.
- Implemented surface mesh building and exporting in RunJob operator.
- Enhanced UI to include export format options for MoGe-2.
- Created validation tools for MoGe-2 surface assets and depth planes.
- Updated geometry nodes to support new surface generation features.
- Refactored existing tests to accommodate new functionality and ensure stability.
This commit is contained in:
2026-08-13 22:07:36 +08:00
parent a6370d678d
commit caeb6d706c
17 changed files with 902 additions and 251 deletions

View File

@@ -87,8 +87,6 @@ class AddonTest(unittest.TestCase):
self.context_menu_draws.clear()
self.outliner_menu_draws.clear()
self.addon.operators._active_job = None
self.addon.image_depth._last_depth_plane_model = "BASE"
self.addon.image_mesh._last_mesh_model = "BASE"
self.fake_bpy.data = SimpleNamespace(
objects=SimpleNamespace(get=lambda _name: None),
)
@@ -732,11 +730,8 @@ class AddonTest(unittest.TestCase):
],
)
def test_conversion_dialog_remembers_last_depth_model(self):
def test_conversion_dialog_leaves_last_properties_to_blender(self):
operator = self.addon.ConvertImageToDepthPlane()
operator.properties = SimpleNamespace(
is_property_set=lambda _name: False,
)
context = SimpleNamespace(
object=SimpleNamespace(
data=SimpleNamespace(source="FILE", frame_duration=1)
@@ -749,16 +744,9 @@ class AddonTest(unittest.TestCase):
),
)
self.addon.image_depth._last_depth_plane_model = "GIANT_1_1"
with patch.object(
self.addon.client,
"model_ready",
side_effect=lambda key: key == "GIANT_1_1",
):
result = operator.invoke(context, None)
result = operator.invoke(context, None)
self.assertIs(result, operator)
self.assertNotEqual(getattr(operator, "snapform_model", ""), "GIANT_1_1")
def test_remove_background_defaults_to_empty_image_frames(self):
source_object = SimpleNamespace(
@@ -995,10 +983,6 @@ class AddonTest(unittest.TestCase):
self.assertTrue(calls[0]["snapform_unshaded"])
self.assertEqual(calls[0]["snapform_depth_data_name"], "img.depth")
self.assertTrue(calls[0]["snapform_delete_input"])
self.assertEqual(
self.addon.image_depth._last_depth_plane_model,
"GIANT_1_1",
)
def test_packed_image_export_writes_a_png_copy(self):
class PackedImage: