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:
@@ -22,9 +22,8 @@ def set_input(modifier, group, name, value):
|
||||
|
||||
|
||||
def add_face_attributes(mesh, count, background_values=None):
|
||||
for name in ("o_face_confidence", "o_edge_stretch"):
|
||||
attribute = mesh.attributes.new(name, "FLOAT", "FACE")
|
||||
attribute.data.foreach_set("value", [1.0] * count)
|
||||
confidence = mesh.attributes.new("o_face_confidence", "FLOAT", "FACE")
|
||||
confidence.data.foreach_set("value", [1.0] * count)
|
||||
background = mesh.attributes.new("o_background_face", "BOOLEAN", "FACE")
|
||||
background.data.foreach_set(
|
||||
"value",
|
||||
@@ -56,7 +55,7 @@ def main():
|
||||
visible_outputs = [
|
||||
output for output in node.outputs if output.name and not output.hide
|
||||
]
|
||||
assert 1 <= len(visible_outputs) <= 3
|
||||
assert 1 <= len(visible_outputs) <= 4
|
||||
uv_stores = [
|
||||
node
|
||||
for node in group.nodes
|
||||
@@ -79,6 +78,14 @@ def main():
|
||||
assert [item.name for item in panels["Options"].interface_items] == [
|
||||
"Fix Topology",
|
||||
]
|
||||
smooth = next(
|
||||
item
|
||||
for item in group.interface.items_tree
|
||||
if item.item_type == "SOCKET"
|
||||
and item.in_out == "INPUT"
|
||||
and item.name == "Smooth"
|
||||
)
|
||||
assert smooth.default_value == 0.5
|
||||
for name, default_value in (("Confidence", 0.0), ("Stretch", 10.0)):
|
||||
item = next(
|
||||
item
|
||||
@@ -98,6 +105,8 @@ def main():
|
||||
[],
|
||||
[(0, 2, 1), (1, 2, 3)],
|
||||
)
|
||||
edge_stretch = mesh.attributes.new("o_edge_stretch", "FLOAT", "EDGE")
|
||||
edge_stretch.data.foreach_set("value", [0.05] * len(mesh.edges))
|
||||
uv = mesh.uv_layers.new(name="UVMap")
|
||||
uv.data.foreach_set("uv", [0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1])
|
||||
add_face_attributes(mesh, 2, [False, True])
|
||||
@@ -121,13 +130,13 @@ def main():
|
||||
finally:
|
||||
evaluated.to_mesh_clear()
|
||||
|
||||
set_input(modifier, group, "Stretch", 100.0)
|
||||
set_input(modifier, group, "Stretch", 0.0)
|
||||
stretch_item = next(
|
||||
item
|
||||
for item in group.interface.items_tree
|
||||
if item.item_type == "SOCKET" and item.name == "Stretch"
|
||||
)
|
||||
assert modifier[stretch_item.identifier] == 100.0
|
||||
assert modifier[stretch_item.identifier] == 0.0
|
||||
obj.update_tag(refresh={"DATA"})
|
||||
bpy.context.view_layer.update()
|
||||
culled = obj.evaluated_get(bpy.context.evaluated_depsgraph_get())
|
||||
|
||||
Reference in New Issue
Block a user