Refactor depth node groups and simplify options
- Removed `Smooth Weight` input from `O Image Depth Plane`, `O Image Depth Cutout`, and `O Image Depth Panorama` to streamline the interface and maintain consistent boundary smoothing behavior. - Adjusted the `Reference Depth` input to appear last in the options panel for better organization, reflecting its role as a calibration value. - Consolidated the `expand_smooth()` function to only accept necessary parameters, eliminating unused branches related to `Smooth Weight` and `pin_sharp`. - Updated related tests and node assets to ensure functionality remains intact and consistent with the new structure. - Introduced new specifications to document the changes and ensure compliance with the updated requirements.
This commit is contained in:
@@ -91,6 +91,30 @@ def assert_closed(faces):
|
||||
assert edges and set(edges.values()) == {2}, Counter(edges.values())
|
||||
|
||||
|
||||
def assert_single_vertex_fans(faces):
|
||||
"""Every vertex must close one face fan so touching sheets stay identifiable."""
|
||||
incident = {}
|
||||
for index, face in enumerate(faces):
|
||||
for start, end in zip(face, (*face[1:], face[0])):
|
||||
edge = tuple(sorted((start, end)))
|
||||
incident.setdefault(start, {}).setdefault(edge, []).append(index)
|
||||
incident.setdefault(end, {}).setdefault(edge, []).append(index)
|
||||
for vertex, edges in incident.items():
|
||||
shared = {}
|
||||
for faces_at_edge in edges.values():
|
||||
assert len(faces_at_edge) == 2, (vertex, faces_at_edge)
|
||||
first, second = faces_at_edge
|
||||
shared.setdefault(first, set()).add(second)
|
||||
shared.setdefault(second, set()).add(first)
|
||||
assert all(len(neighbors) == 2 for neighbors in shared.values()), vertex
|
||||
reached, pending = {next(iter(shared))}, [next(iter(shared))]
|
||||
while pending:
|
||||
for neighbor in shared[pending.pop()] - reached:
|
||||
reached.add(neighbor)
|
||||
pending.append(neighbor)
|
||||
assert len(reached) == len(shared), vertex
|
||||
|
||||
|
||||
def component_count(faces):
|
||||
adjacency = {}
|
||||
for face in faces:
|
||||
|
||||
@@ -3,7 +3,6 @@ import numpy as np
|
||||
|
||||
|
||||
from anyimage.common import image as image_data
|
||||
from anyimage.common import object as object_data
|
||||
from anyimage.common.selection import SelectionMask
|
||||
from anyimage.operators.cutout_tool import geometry as cutout_geometry
|
||||
from anyimage.operators.cutout_tool import object as cutout_object
|
||||
@@ -107,18 +106,3 @@ def _evaluated_positions(obj):
|
||||
evaluated.to_mesh_clear()
|
||||
|
||||
|
||||
def _add_cutout_modifier(obj, shape):
|
||||
group = cutout_object.load_cutout_node_group(shape)
|
||||
modifier = obj.modifiers.new(group.name, "NODES")
|
||||
modifier.node_group = group
|
||||
if shape in {"FLAT", "DEPTH_SOLID"}:
|
||||
object_data.set_modifier_input(modifier, object_data.modifier_input_identifier(group, "Mode"), 1)
|
||||
if shape == "DEPTH_SOLID":
|
||||
object_data.set_modifier_input(
|
||||
modifier,
|
||||
object_data.modifier_input_identifier(group, "Smooth Weight"),
|
||||
0.0,
|
||||
)
|
||||
return modifier
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user