Add comprehensive tests for image processing nodes and refactor node imports
- Introduced new test files for image layer, image plane, normal scale, object normal rotation, shadeless, and temporary attributes. - Implemented tests to validate the behavior of alpha curves, depth layers, and normal scales in various rendering engines. - Refactored import paths for node groups to align with the new directory structure. - Added checks for temporary attribute lifetimes and ensured proper cleanup without warnings. - Enhanced CLI commands to require the Blender group and validate the presence of generated node assets before packaging. - Updated packaging scripts to enforce the existence of necessary assets, preventing build failures.
This commit is contained in:
25
nodes/common/material_slots.py
Normal file
25
nodes/common/material_slots.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""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"]
|
||||
Reference in New Issue
Block a user