diff --git a/.ignore b/.ignore new file mode 100644 index 0000000..720a92c --- /dev/null +++ b/.ignore @@ -0,0 +1,3 @@ +__pycache__/* +*.pyc +*.pyo \ No newline at end of file diff --git a/__init__.py b/__init__.py index 6a6b90f..3dd30ab 100644 --- a/__init__.py +++ b/__init__.py @@ -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" diff --git a/__pycache__/__init__.cpython-312.pyc b/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..bc9ac67 Binary files /dev/null and b/__pycache__/__init__.cpython-312.pyc differ diff --git a/__pycache__/unmasked.cpython-312.pyc b/__pycache__/unmasked.cpython-312.pyc new file mode 100644 index 0000000..2edd200 Binary files /dev/null and b/__pycache__/unmasked.cpython-312.pyc differ diff --git a/unmasked.py b/unmasked.py index 96c5874..62c1518 100644 --- a/unmasked.py +++ b/unmasked.py @@ -208,4 +208,30 @@ class AnyCast: def run(self, ANY, TYPE): result = try_cast(ANY, TYPE) - return (result, ) \ No newline at end of file + 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, ) \ No newline at end of file