Refactor comparison operations in geometry nodes
- Introduced a new `compare_node` function to streamline comparison operations across various geometry nodes. - Replaced instances of mathematical comparison nodes with the new `compare_node` function in multiple files, enhancing code readability and maintainability. - Updated related logic in cutout, depth surface, and image processing groups to utilize the new comparison method. - Ensured consistent handling of boolean logic through the introduction of a `boolean_node` function for combining boolean inputs.
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
"""Build O Image Depth Cutout."""
|
||||
import bpy
|
||||
from anyimage.operators.cutout_tool.shape import NORMAL_REDUCTION_ATTRIBUTE_NAME
|
||||
from ..common.nodes import interface_socket, group_input, float_input, read_float_attribute, store_float_attribute, prepare_node_group, sample_field, evaluate_field
|
||||
from ..common.nodes import (
|
||||
interface_socket, group_input, float_input, read_float_attribute,
|
||||
store_float_attribute, prepare_node_group, sample_field, evaluate_field,
|
||||
compare_node,
|
||||
)
|
||||
from ..common.boundary_smoothing import smooth_cut_boundary
|
||||
from ..common.cutout import _position_field, _shade_output
|
||||
from ..common.depth_surface import _math, project_depth_surface, build_surface_camera, split_depth_surface, sample_face_camera, thicken_depth_surface
|
||||
@@ -314,7 +318,7 @@ def _build_depth_surface(group, geometry, controls):
|
||||
links.new(is_shell, selected_thickness.inputs["Switch"])
|
||||
links.new(controls.outputs["Thickness"], selected_thickness.inputs["False"])
|
||||
links.new(controls.outputs["Shell Thickness"], selected_thickness.inputs["True"])
|
||||
has_thickness = _math(group, "GREATER_THAN", selected_thickness.outputs[0], 1e-6)
|
||||
has_thickness = compare_node(group, "GREATER_THAN", selected_thickness.outputs[0], 1e-6)
|
||||
zero_shell = group.nodes.new("GeometryNodeSwitch")
|
||||
zero_shell.input_type = "GEOMETRY"
|
||||
links.new(has_thickness, zero_shell.inputs["Switch"])
|
||||
|
||||
Reference in New Issue
Block a user