Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d5b6d8f4a | ||
|
|
af492b7669 | ||
|
|
15084a9264 |
+3
-2
@@ -29,12 +29,13 @@ _NODE_CLASSES: List[Type] = [DreamSineWave, DreamLinear, DreamCSVCurve, DreamBea
|
||||
DreamFrameCounterInfo, DreamBoolToFloat, DreamBoolToInt, DreamSawWave, DreamTriangleWave,
|
||||
DreamTriangleEvent, DreamSmoothEvent, DreamCalculation, DreamImageColorShift,
|
||||
DreamComparePalette, DreamImageContrast, DreamImageBrightness, DreamLogFile,
|
||||
DreamLaboratory, DreamStringToLog, DreamIntToLog, DreamFloatToLog, DreamJoinLog]
|
||||
DreamLaboratory, DreamStringToLog, DreamIntToLog, DreamFloatToLog, DreamJoinLog,
|
||||
DreamStringTokenizer]
|
||||
_SIGNATURE_SUFFIX = " [Dream]"
|
||||
|
||||
MANIFEST = {
|
||||
"name": "Dream Project Animation",
|
||||
"version": (4, 0, 0),
|
||||
"version": (4, 2, 0),
|
||||
"author": "Dream Project",
|
||||
"project": "https://github.com/alt-key-project/comfyui-dream-project",
|
||||
"description": "Various utility nodes for creating animations with ComfyUI",
|
||||
|
||||
+1097
-869
File diff suppressed because it is too large
Load Diff
@@ -49,6 +49,7 @@
|
||||
"Sine Curve [Dream]": "Simple sine wave curve",
|
||||
"Smooth Event Curve [Dream]": "Single event/peak curve with a slight bell-shape",
|
||||
"String Input [Dream]": "String input (until primitive routing issues are solved)",
|
||||
"String Tokenizer [Dream]": "Extract individual words or phrases from a text as tokens",
|
||||
"String to Log Entry [Dream]": "Use any string as a log entry",
|
||||
"Text Input [Dream]": "Multiline string input (until primitive routing issues are solved)",
|
||||
"Triangle Curve [Dream]": "Triangle wave curve",
|
||||
|
||||
@@ -255,6 +255,9 @@ Simple sine wave curve.
|
||||
### Smooth Event Curve [Dream]
|
||||
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.
|
||||
|
||||
### Triangle Curve [Dream]
|
||||
Triangle wave curve.
|
||||
|
||||
|
||||
+39
-6
@@ -97,10 +97,43 @@ class DreamStringToLog:
|
||||
"required": {
|
||||
"text": ("STRING", {"default": ""}),
|
||||
},
|
||||
"optional": {
|
||||
"label": ("STRING", {"default": ""}),
|
||||
}
|
||||
}
|
||||
|
||||
def convert(self, text):
|
||||
return (LogEntry.new(text),)
|
||||
def convert(self, text, **values):
|
||||
label = values.get("label", "")
|
||||
if label:
|
||||
return (LogEntry.new(label + ": " + text),)
|
||||
else:
|
||||
return (LogEntry.new(text),)
|
||||
|
||||
|
||||
class DreamStringTokenizer:
|
||||
NODE_NAME = "String Tokenizer"
|
||||
ICON = "🪙"
|
||||
OUTPUT_NODE = True
|
||||
CATEGORY = NodeCategories.UTILS
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("token",)
|
||||
FUNCTION = "exec"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"text": ("STRING", {"default": "", "multiline": True}),
|
||||
"separator": ("STRING", {"default": ","}),
|
||||
"selected": ("INT", {"default": 0, "min": 0})
|
||||
},
|
||||
}
|
||||
|
||||
def exec(self, text: str, separator: str, selected: int):
|
||||
if separator is None or separator == "":
|
||||
separator = " "
|
||||
parts = text.split(sep=separator)
|
||||
return (parts[max(0, selected) % len(parts)].strip(),)
|
||||
|
||||
|
||||
class DreamLogFile:
|
||||
@@ -169,10 +202,10 @@ class DreamLogFile:
|
||||
for (t, text) in log_entry.get_filtered_entries(ts):
|
||||
dt = datetime.datetime.fromtimestamp(t)
|
||||
output_text.append("[frame {}/{} (~{}%), timestamp {}]\n{}".format(frame_counter.current_frame + 1,
|
||||
frame_counter.total_frames,
|
||||
round(frame_counter.progress * 100),
|
||||
dt.strftime(self._get_tm_format(
|
||||
clock_has_24_hours)), text.rstrip()))
|
||||
frame_counter.total_frames,
|
||||
round(frame_counter.progress * 100),
|
||||
dt.strftime(self._get_tm_format(
|
||||
clock_has_24_hours)), text.rstrip()))
|
||||
output_text.append("---")
|
||||
last_t = max(t, last_t)
|
||||
output_text = "\n".join(output_text) + "\n"
|
||||
|
||||
Reference in New Issue
Block a user