ADD Make list from string
This commit is contained in:
+5
-3
@@ -1,4 +1,4 @@
|
||||
from .unmasked import GetMaskDimensions, isMaskEmpty, GetRandomDimensions, AnyCast, isImageEmpty
|
||||
from .unmasked import GetMaskDimensions, isMaskEmpty, GetRandomDimensions, AnyCast, isImageEmpty, AccMakeListNode
|
||||
|
||||
# Node class mappings
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
@@ -6,7 +6,8 @@ NODE_CLASS_MAPPINGS = {
|
||||
"isMaskEmpty": isMaskEmpty,
|
||||
"GetRandomDimensions": GetRandomDimensions,
|
||||
"ACC_AnyCast": AnyCast,
|
||||
"isImageEmpty": isImageEmpty
|
||||
"isImageEmpty": isImageEmpty,
|
||||
"AccMakeListNode": AccMakeListNode
|
||||
}
|
||||
|
||||
# Node display name mappings
|
||||
@@ -15,7 +16,8 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"isMaskEmpty": "Is Mask Empty",
|
||||
"GetRandomDimensions": "Get Random Dimensions",
|
||||
"ACC_AnyCast": "Any Cast",
|
||||
"isImageEmpty": "Is Image Empty"
|
||||
"isImageEmpty": "Is Image Empty",
|
||||
"AccMakeListNode": "Make List From Text",
|
||||
}
|
||||
|
||||
WEB_DIRECTORY = "./web"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+27
-1
@@ -208,4 +208,30 @@ class AnyCast:
|
||||
|
||||
def run(self, ANY, TYPE):
|
||||
result = try_cast(ANY, TYPE)
|
||||
return (result, )
|
||||
return (result, )
|
||||
|
||||
class AccMakeListNode:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {
|
||||
"text": ("STRING", {"multiline": True})
|
||||
}}
|
||||
|
||||
NAME = "Make List from String"
|
||||
RETURN_NAMES = ("list", "lines count")
|
||||
RETURN_TYPES = ("STRING", "INT")
|
||||
FUNCTION = "make_list"
|
||||
OUTPUT_IS_LIST = (True, False)
|
||||
CATEGORY = "Accessories"
|
||||
|
||||
def make_list(self, **kwargs):
|
||||
text = kwargs.get('text', None)
|
||||
list = []
|
||||
if text is not None:
|
||||
lines = text.splitlines()
|
||||
list = [line.strip() for line in lines if line.strip()]
|
||||
count = len(list)
|
||||
return (lines, count, )
|
||||
Reference in New Issue
Block a user