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:
@@ -139,6 +139,8 @@ MODEL_NUMBERS = {
|
||||
|
||||
|
||||
_ENUM_ITEMS_CACHE = {}
|
||||
_DEPTH_PLANE_ENUM_ITEMS_CACHE = {}
|
||||
_SURFACE_ENUM_ITEMS_CACHE = {}
|
||||
|
||||
|
||||
def enum_items(supports_gs=None, show_download_status=False):
|
||||
@@ -213,9 +215,13 @@ def depth_plane_model_enum_items(_owner, _context):
|
||||
*MOGE2_MODELS.values(),
|
||||
*(model for model in MODELS.values() if model.enabled),
|
||||
]
|
||||
ready = tuple(model_ready(model.key) for model in models)
|
||||
cached = _DEPTH_PLANE_ENUM_ITEMS_CACHE.get(ready)
|
||||
if cached is not None:
|
||||
return cached
|
||||
items = []
|
||||
for index, model in enumerate(models):
|
||||
label = model.label if model_ready(model.key) else f"{model.label} (Missing)"
|
||||
label = model.label if ready[index] else f"{model.label} (Missing)"
|
||||
items.append(
|
||||
(
|
||||
model.key,
|
||||
@@ -225,6 +231,22 @@ def depth_plane_model_enum_items(_owner, _context):
|
||||
)
|
||||
)
|
||||
items.append(("ORIGINAL", "Original", "Use the original image as depth", len(items)))
|
||||
_DEPTH_PLANE_ENUM_ITEMS_CACHE[ready] = items
|
||||
return items
|
||||
|
||||
|
||||
def surface_model_enum_items(owner, context):
|
||||
depth_items = depth_plane_model_enum_items(owner, context)
|
||||
cache_key = id(depth_items)
|
||||
cached = _SURFACE_ENUM_ITEMS_CACHE.get(cache_key)
|
||||
if cached is not None:
|
||||
return cached
|
||||
items = [
|
||||
item
|
||||
for item in depth_items
|
||||
if item[0] != "ORIGINAL"
|
||||
]
|
||||
_SURFACE_ENUM_ITEMS_CACHE[cache_key] = items
|
||||
return items
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user