Refactor geometry node groups for image depth processing

- Introduced new utility functions in common nodes for evaluating fields and capturing attributes.
- Simplified volume field calculations in image depth cutout and panorama groups by utilizing new utility functions.
- Enhanced readability and maintainability of the image depth cutout and panorama node groups by removing redundant code and improving function usage.
- Adjusted default values for thickness and depth scale in image relief plane group for better user experience.
- Improved handling of geometry attributes and connections in image depth plane group to streamline processing.
This commit is contained in:
2026-09-10 16:46:19 +08:00
parent 489003c2cc
commit 8ae3c1d5b7
20 changed files with 553 additions and 473 deletions

View File

@@ -104,3 +104,23 @@ def store_float_attribute(group, geometry, name, value, domain="POINT"):
else:
group.links.new(value, node.inputs["Value"])
return node.outputs["Geometry"]
def evaluate_field(group, value, data_type, domain):
"""Evaluate a field on an explicit domain before downstream adaptation."""
node = group.nodes.new("GeometryNodeFieldOnDomain")
node.data_type, node.domain = data_type, domain
group.links.new(value, node.inputs["Value"])
return node.outputs["Value"]
def capture_fields(group, geometry, domain, **fields):
"""Keep source fields attached to geometry through later changes."""
node = group.nodes.new("GeometryNodeCaptureAttribute")
node.domain = domain
node.capture_items.clear()
group.links.new(geometry, node.inputs["Geometry"])
for name, (data_type, value) in fields.items():
node.capture_items.new(data_type, name)
group.links.new(value, node.inputs[name])
return node.outputs["Geometry"], {name: node.outputs[name] for name in fields}