Lazy switches added.
This commit is contained in:
+5
-2
@@ -12,6 +12,7 @@ from .output import *
|
||||
from .prompting import *
|
||||
from .seq_processing import *
|
||||
from .switches import *
|
||||
from .lazyswitches import *
|
||||
from .utility import *
|
||||
from .calculate import *
|
||||
from .laboratory import *
|
||||
@@ -30,12 +31,14 @@ _NODE_CLASSES: List[Type] = [DreamSineWave, DreamLinear, DreamCSVCurve, DreamBea
|
||||
DreamTriangleEvent, DreamSmoothEvent, DreamCalculation, DreamImageColorShift,
|
||||
DreamComparePalette, DreamImageContrast, DreamImageBrightness, DreamLogFile,
|
||||
DreamLaboratory, DreamStringToLog, DreamIntToLog, DreamFloatToLog, DreamJoinLog,
|
||||
DreamStringTokenizer, DreamWavCurve, DreamFrameCounterTimeOffset, DreamRandomPromptWords]
|
||||
DreamStringTokenizer, DreamWavCurve, DreamFrameCounterTimeOffset, DreamRandomPromptWords,
|
||||
DreamLazyImageSwitch, DreamLazyLatentSwitch, DreamLazyTextSwitch, DreamLazyPaletteSwitch,
|
||||
DreamLazyFloatSwitch, DreamLazyIntSwitch]
|
||||
_SIGNATURE_SUFFIX = " [Dream]"
|
||||
|
||||
MANIFEST = {
|
||||
"name": "Dream Project Animation",
|
||||
"version": (5, 2, 3),
|
||||
"version": (5, 3, 3),
|
||||
"author": "Dream Project",
|
||||
"project": "https://github.com/alt-key-project/comfyui-dream-project",
|
||||
"description": "Various utility nodes for creating animations with ComfyUI",
|
||||
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
from .categories import NodeCategories
|
||||
from .dreamtypes import RGBPalette
|
||||
from .err import *
|
||||
from .shared import ALWAYS_CHANGED_FLAG, hashed_as_strings
|
||||
|
||||
_NOT_A_VALUE_I = 9223372036854775807
|
||||
_NOT_A_VALUE_F = float(_NOT_A_VALUE_I)
|
||||
_NOT_A_VALUE_S = "⭆"
|
||||
|
||||
def _generate_switch_input(type_nm: str, default_value=None):
|
||||
d = dict()
|
||||
for i in range(10):
|
||||
if default_value is None:
|
||||
d["input_" + str(i)] = (type_nm, {"lazy": True})
|
||||
else:
|
||||
d["input_" + str(i)] = (type_nm, {"default": default_value, "forceInput": True, "lazy": True})
|
||||
|
||||
return {
|
||||
"required": {
|
||||
"select": ("INT", {"default": 0, "min": 0, "max": 9})
|
||||
},
|
||||
"optional": d
|
||||
}
|
||||
|
||||
|
||||
class DreamLazyImageSwitch:
|
||||
_switch_type = "IMAGE"
|
||||
NODE_NAME = "Lazy Image Switch"
|
||||
ICON = "⭆"
|
||||
CATEGORY = NodeCategories.UTILS_SWITCHES
|
||||
RETURN_TYPES = (_switch_type,)
|
||||
RETURN_NAMES = ("selected",)
|
||||
FUNCTION = "pick"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return _generate_switch_input(cls._switch_type)
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(cls, *values):
|
||||
return ALWAYS_CHANGED_FLAG
|
||||
|
||||
def check_lazy_status(self, select, **kwargs):
|
||||
return ["input_"+str(select)]
|
||||
|
||||
def pick(self, select, **args):
|
||||
return (args.get("input_"+str(select), None),)
|
||||
|
||||
|
||||
class DreamLazyLatentSwitch:
|
||||
_switch_type = "LATENT"
|
||||
NODE_NAME = "Lazy Latent Switch"
|
||||
ICON = "⭆"
|
||||
CATEGORY = NodeCategories.UTILS_SWITCHES
|
||||
RETURN_TYPES = (_switch_type,)
|
||||
RETURN_NAMES = ("selected",)
|
||||
FUNCTION = "pick"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return _generate_switch_input(cls._switch_type)
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(cls, *values):
|
||||
return ALWAYS_CHANGED_FLAG
|
||||
|
||||
def check_lazy_status(self, select, **kwargs):
|
||||
return ["input_" + str(select)]
|
||||
|
||||
def pick(self, select, **args):
|
||||
return (args.get("input_" + str(select), None),)
|
||||
|
||||
|
||||
class DreamLazyTextSwitch:
|
||||
_switch_type = "STRING"
|
||||
NODE_NAME = "Lazy Text Switch"
|
||||
ICON = "⭆"
|
||||
CATEGORY = NodeCategories.UTILS_SWITCHES
|
||||
RETURN_TYPES = (_switch_type,)
|
||||
RETURN_NAMES = ("selected",)
|
||||
FUNCTION = "pick"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return _generate_switch_input(cls._switch_type, _NOT_A_VALUE_S)
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(cls, *values):
|
||||
return hashed_as_strings(values)
|
||||
|
||||
def check_lazy_status(self, select, **kwargs):
|
||||
return ["input_" + str(select)]
|
||||
|
||||
def pick(self, select, **args):
|
||||
return (args.get("input_" + str(select), None),)
|
||||
|
||||
|
||||
class DreamLazyPaletteSwitch:
|
||||
_switch_type = RGBPalette.ID
|
||||
NODE_NAME = "Lazy Palette Switch"
|
||||
ICON = "⭆"
|
||||
CATEGORY = NodeCategories.UTILS_SWITCHES
|
||||
RETURN_TYPES = (_switch_type,)
|
||||
RETURN_NAMES = ("selected",)
|
||||
FUNCTION = "pick"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return _generate_switch_input(cls._switch_type)
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(cls, *values):
|
||||
return ALWAYS_CHANGED_FLAG
|
||||
|
||||
def check_lazy_status(self, select, **kwargs):
|
||||
return ["input_" + str(select)]
|
||||
|
||||
def pick(self, select, **args):
|
||||
return (args.get("input_" + str(select), None),)
|
||||
|
||||
|
||||
class DreamLazyFloatSwitch:
|
||||
_switch_type = "FLOAT"
|
||||
NODE_NAME = "Lazy Float Switch"
|
||||
ICON = "⭆"
|
||||
CATEGORY = NodeCategories.UTILS_SWITCHES
|
||||
RETURN_TYPES = (_switch_type,)
|
||||
RETURN_NAMES = ("selected",)
|
||||
FUNCTION = "pick"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return _generate_switch_input(cls._switch_type, _NOT_A_VALUE_F)
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(cls, *values):
|
||||
return hashed_as_strings(values)
|
||||
|
||||
def check_lazy_status(self, select, **kwargs):
|
||||
return ["input_" + str(select)]
|
||||
|
||||
def pick(self, select, **args):
|
||||
return (args.get("input_" + str(select), None),)
|
||||
|
||||
|
||||
class DreamLazyIntSwitch:
|
||||
_switch_type = "INT"
|
||||
NODE_NAME = "Lazy Int Switch"
|
||||
ICON = "⭆"
|
||||
CATEGORY = NodeCategories.UTILS_SWITCHES
|
||||
RETURN_TYPES = (_switch_type,)
|
||||
RETURN_NAMES = ("selected",)
|
||||
FUNCTION = "pick"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return _generate_switch_input(cls._switch_type, _NOT_A_VALUE_I)
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(cls, *values):
|
||||
return hashed_as_strings(values)
|
||||
|
||||
def check_lazy_status(self, select, **kwargs):
|
||||
return ["input_" + str(select)]
|
||||
|
||||
def pick(self, select, **args):
|
||||
return (args.get("input_" + str(select), None),)
|
||||
@@ -226,6 +226,10 @@ Post processing for animation sequences generating blended in-between frames.
|
||||
### Laboratory [Dream]
|
||||
Super-charged number generator for experimenting with ComfyUI.
|
||||
|
||||
### Lazy *** Switch [Dream]
|
||||
Switch nodes for different type for up to ten inputs. The lazy version only evaluates the
|
||||
selected input, but first/next of the big switch is unsupported.
|
||||
|
||||
### Log Entry Joiner [Dream]
|
||||
Merges multiple log entries (reduces noodling).
|
||||
|
||||
@@ -269,6 +273,9 @@ Single event/peak curve with a slight bell-shape.
|
||||
### String Tokenizer [Dream]
|
||||
Splits a text into tokens by a separator and returns one of the tokens based on a given index.
|
||||
|
||||
### Random Prompt Words [Dream]
|
||||
Randomly picks words/tokens/phrases from an input text.
|
||||
|
||||
### Triangle Curve [Dream]
|
||||
Triangle wave curve.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user