Add an Incrementer node

This commit is contained in:
Jacob Segal
2023-07-08 19:33:10 -07:00
parent 758b0069e9
commit 5c7bfe05a1
3 changed files with 53 additions and 2 deletions
+45
View File
@@ -1268,6 +1268,27 @@ class ConvertColorSpace:
assert out_space == "HSL"
return (hsv2hsl(hsv),)
class MaqueradeIncrementerNode:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"seed": ("INT", {"default": 0, "min": -1, "max": 0xffffffffffffffff, "step": 1}),
"max_value": ("INT", {"default": 1, "min": 1, "max": 0xffffffffffffffff, "step": 1}),
}
}
RETURN_TYPES = ("INT",)
FUNCTION = "increment"
CATEGORY = "Masquerade Nodes"
def increment(self, seed, max_value):
return (seed % max_value,)
NODE_CLASS_MAPPINGS = {
"Mask By Text": ClipSegNode,
@@ -1291,4 +1312,28 @@ NODE_CLASS_MAPPINGS = {
"Make Image Batch": MakeImageBatch,
"Create QR Code": CreateQRCodeNode,
"Convert Color Space": ConvertColorSpace,
"MasqueradeIncrementer": MaqueradeIncrementerNode,
NODE_DISPLAY_NAME_MAPPINGS = {
"Mask By Text": "Mask By Text",
"Mask Morphology": "Mask Morphology",
"Combine Masks": "Combine Masks",
"Unary Mask Op": "Unary Mask Op",
"Unary Image Op": "Unary Image Op",
"Blur": "Blur",
"Image To Mask": "Image To Mask",
"Mix Images By Mask": "Mix Images By Mask",
"Mix Color By Mask": "Mix Color By Mask",
"Mask To Region": "Mask To Region",
"Cut By Mask": "Cut By Mask",
"Paste By Mask": "Paste By Mask",
"Get Image Size": "Get Image Size",
"Change Channel Count": "Change Channel Count",
"Constant Mask": "Constant Mask",
"Prune By Mask": "Prune By Mask",
"Separate Mask Components": "Separate Mask Components",
"Create Rect Mask": "Create Rect Mask",
"Make Image Batch": "Make Image Batch",
"Create QR Code": "Create QR Code",
"Convert Color Space": "Convert Color Space",
"MasqueradeIncrementer": "Incrementer",
}
+6
View File
@@ -288,3 +288,9 @@ This node is the same as Unary Mask Op, but will operate across all channels of
* `image` - The image to convert.
* `in_space` - The color space of the input image -- valid values are `RGB`, `HSV`, and `HSL`.
* `out_space` - The color space of the output image -- valid values are `RGB`, `HSV`, and `HSL`.
## Incrementer
#### Inputs
* `seed` - The current value.
* `control_after_generate` - Set to "Increment" to actually increment.
* `max_value` - The value to perform modulo against
+2 -2
View File
@@ -1,3 +1,3 @@
from .MaskNodes import NODE_CLASS_MAPPINGS
from .MaskNodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
__all__ = ['NODE_CLASS_MAPPINGS']
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']