Files
AnyImage/tools/nodes/common/material.py
nan 31074bd511 Add tests and implement boundary smoothing and cutout functionality
- Introduced tests for boundary smoothing in `test_boundary_smoothing.py`, verifying that smoothing reduces stair-step artifacts while preserving boundary integrity.
- Added tests for cutout boundary behavior in `test_cutout_boundary.py`, ensuring proper handling of boundary triangles and normal blending.
- Created `test_temporary_attributes.py` to check the cleanup of temporary attributes across depth modifier branches, ensuring no warnings are raised.
- Implemented point culling functionality in `test_validity.py`, confirming that invalid points are removed without affecting adjacent geometry.
- Developed boundary smoothing logic in `boundary_smoothing.py`, allowing for depth smoothing while maintaining edge integrity.
- Added cutout boundary management in `cutout_boundary.py`, including functions for removing boundary triangles and tapering thickness profiles.
- Implemented validity checks in `validity.py` to ensure proper deletion of invalid vertices and associated wire edges.
2026-09-11 20:37:20 +08:00

26 lines
1.3 KiB
Python

"""Carry the input mesh's material slots onto generated geometry."""
def inherit_material_slots(group, geometry, source):
nodes, links = group.nodes, group.links
size = nodes.new("GeometryNodeAttributeDomainSize")
size.component = "MESH"
links.new(source, size.inputs["Geometry"])
index = nodes.new("GeometryNodeInputIndex")
source_vertices = nodes.new("FunctionNodeCompare")
source_vertices.data_type, source_vertices.operation = "INT", "LESS_THAN"
links.new(index.outputs["Index"], source_vertices.inputs[2])
links.new(size.outputs["Point Count"], source_vertices.inputs[3])
join = nodes.new("GeometryNodeJoinGeometry")
# Multi-input links are prepended: source occupies the first point range.
links.new(geometry, join.inputs["Geometry"])
links.new(source, join.inputs["Geometry"])
material = nodes.new("GeometryNodeSetMaterialIndex")
material.inputs["Material Index"].default_value = 0
links.new(join.outputs["Geometry"], material.inputs["Geometry"])
delete = nodes.new("GeometryNodeDeleteGeometry")
delete.domain = "POINT"
links.new(material.outputs["Geometry"], delete.inputs["Geometry"])
links.new(source_vertices.outputs["Result"], delete.inputs["Selection"])
return delete.outputs["Geometry"]