add rotate, crop and slider widget
This commit is contained in:
@@ -395,6 +395,46 @@ class Coordinate:
|
||||
return ((float(x), float(y)),)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# RangeSlider
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@register_node(display_name="Float Slider")
|
||||
class RangeSlider:
|
||||
"""Interactive float control node with min/max bounds and a slider value."""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"min_value": ("FLOAT", {"default": 0.0, "step": 0.01}),
|
||||
"max_value": ("FLOAT", {"default": 1.0, "step": 0.01}),
|
||||
"value": ("FLOAT", {
|
||||
"default": 0.5,
|
||||
"step": 0.01,
|
||||
"slider": True,
|
||||
"min_widget": "min_value",
|
||||
"max_widget": "max_value",
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("FLOAT",)
|
||||
RETURN_NAMES = ("value",)
|
||||
FUNCTION = "process"
|
||||
CATEGORY = "io"
|
||||
DESCRIPTION = (
|
||||
"Interactive float slider. Set min and max bounds, then drag the slider to output a FLOAT value."
|
||||
)
|
||||
|
||||
def process(self, min_value: float, max_value: float, value: float) -> tuple:
|
||||
lo = min(float(min_value), float(max_value))
|
||||
hi = max(float(min_value), float(max_value))
|
||||
if hi == lo:
|
||||
return (lo,)
|
||||
return (float(np.clip(float(value), lo, hi)),)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# SaveImage
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user