nodeslicer/core/nodeslicer/nodes/path/overhang_mask.py
2026-10-15 14:13:39 +03:00

30 lines
951 B
Python

from typing import Any
from .....registry import register_class
from ..base import SliceNode, SlicePaths
@register_class
class SLICENODE_OverhangMask(SliceNode):
bl_label = "Overhang Mask"
list_socket_mapping = [("Paths", "Paths")]
def init(self, context):
self.add_input("SLICESOCK_Paths")
self.add_input("NodeSocketFloat", "Tolerance").value = 0.05
self.add_output("SLICESOCK_Paths")
def draw_buttons(self, context, layout):
pass
def evaluate_output(self, socket_name: str, **_kwargs) -> Any:
def _mask(p: Any, tol: Any) -> SlicePaths:
if not p: return SlicePaths()
return p.get_overhang_mask(tolerance=float(tol if tol is not None else 0.05))
return self.eval_multivalue(
_mask,
main_socket="Paths",
secondary_sockets=["Tolerance"],
socket_name=socket_name,
default=SlicePaths(),
)