This commit is contained in:
justumen
2024-08-12 12:11:41 +02:00
parent 81166137fb
commit ee35bd5575
4 changed files with 36 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
# 🔗 Comfyui : Bjornulf_custom_nodes v0.9 🔗
# 🔗 Comfyui : Bjornulf_custom_nodes v0.10 🔗
# Dependencies
@@ -17,7 +17,7 @@
- **v0.8**: Combine images : add an option to put image top, bottom or center.
- **v0.8**: Combine texts : add option for slashes /
- **v0.8**: Add basic node to transform greenscreen in to transparency.
- **v0.9**: Add a new node : Return one random line from input.
- **v0.10**: Add a new node : Loop (All Lines from input) - Iterate over all lines from an input text.
# 📝 Nodes descriptions
@@ -187,3 +187,8 @@ Need clean greenscreen ofc. (Can adjust threshold but very basic node.)
**Description:**
Take a random line from an input text. (When using multiple "Write Text" nodes is annoying for example, you can use that and just copy/paste a list from outside.)
## 27 - ♻ Loop (All Lines from input)
![Combine Images](screenshots/loop_all_lines.png)
**Description:**
Iterate over all lines from an input text. (Good for testing multiple lines of text.)

View File

@@ -31,6 +31,7 @@ from .combine_background_overlay import CombineBackgroundOverlay
from .save_bjornulf_lobechat import SaveBjornulfLobeChat
from .green_to_transparency import GreenScreenToTransparency
from .random_line_from_input import RandomLineFromInput
from .loop_lines import LoopAllLines
# from .check_black_image import CheckBlackImage
# from .clear_vram import ClearVRAM
@@ -39,6 +40,7 @@ from .random_line_from_input import RandomLineFromInput
NODE_CLASS_MAPPINGS = {
# "Bjornulf_CustomStringType": CustomStringType,
"Bjornulf_ollamaLoader": ollamaLoader,
"Bjornulf_LoopAllLines": LoopAllLines,
"Bjornulf_GreenScreenToTransparency": GreenScreenToTransparency,
"Bjornulf_RandomLineFromInput": RandomLineFromInput,
# "Bjornulf_CheckBlackImage": CheckBlackImage,
@@ -111,6 +113,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"Bjornulf_LoopFloat": "♻ Loop (Float)",
"Bjornulf_LoopInteger": "♻ Loop (Integer)",
"Bjornulf_LoopBasicBatch": "♻ Loop",
"Bjornulf_LoopAllLines": "♻ Loop (All Lines from input)",
"Bjornulf_LoopSamplers": "♻ Loop (All Samplers)",
"Bjornulf_LoopSchedulers": "♻ Loop (All Schedulers)",
"Bjornulf_LoopCombosSamplersSchedulers": "♻ Loop (My combos Sampler⚔Scheduler)",

26
loop_lines.py Normal file
View File

@@ -0,0 +1,26 @@
class LoopAllLines:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"text": ("STRING", {"forceInput": True}),
}
}
RETURN_TYPES = ("STRING",)
FUNCTION = "all_lines"
OUTPUT_IS_LIST = (True,)
CATEGORY = "Bjornulf"
def all_lines(self, text):
# Split the input text into lines
lines = text.split('\n')
# Remove empty lines and strip whitespace
lines = [line.strip() for line in lines if line.strip()]
if not lines:
return ([],)
# Return all non-empty lines
return (lines,)

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB