[Bug] Returning a list from Power Puter lacks ability to accept or return a data list.
ComfyUI handles lists a couple different ways: https://docs.comfy.org/custom-nodes/backend/lists
Power Puter would be much more powerful if it could distinguish between those types.
There are times when anyone would definitely want just a list returned, vs a list that will be processed singularly.
I was looking at the code and I'm not too familiar with FlexibleOptionalInputType. So I'm not sure how INPUT_IS_LIST works in the Puter. Is it going to run once for each item an incoming wrapped list? Perhaps for inputs there might need to be a second type of Power Puter node that runs once for each item in that special comfy wrapped list.
For output hopefully OUTPUT_IS_LIST might be able to be set dynamically? Then a special helper method could be used inside Puter like return (a, IS_LIST(b), c) to be able to specify specific outputs as those special wrapped lists or not.
Here's a picture of a test I did comparing the Puter with a few other nodes I'd hope Puter could replace soon. You can see that the Make Image List node when looking at the output data, doesn't return both images, just the single one which I presume is done by ComfyUI processing it individually, which allows sending multiple images to a single image resize node. But because Puter I think also ends up getting each individually it doesn't allow it to be able to process and split it up. Those black and white images that come out, those are actually hundreds of images that are single lines of I'm guessing one channel of the original image. It seems to split it a bit differently if it's a batch vs an image. But I think batches could also be properly handled by wrapping a few torch methods.
As you can see the code for the Make Image List is as simple as can be:
class MakeImageList:
@classmethod
def INPUT_TYPES(s):
return {"required": {"image1": ("IMAGE",), }}
RETURN_TYPES = ("IMAGE",)
OUTPUT_IS_LIST = (True,)
FUNCTION = "doit"
CATEGORY = "ImpactPack/Util"
def doit(self, **kwargs):
images = []
for k, v in kwargs.items():
images.append(v)
return (images, )
The only special thing being OUTPUT_IS_LIST = (True,). Being able to wrap anything in a list in that manner allows for multi-processing lots of items at once through a single node.
Then I could use Puter like so:
list 1-7 items:
[item for item in [a, b, c, d, e, f, g] if item != None]
split 3 up:
size = a.shape[0] if type(a).__name__ == 'Tensor' else len(a)
items = [a[i] if i < size else None for i in range(3)]
tuple(items)
It seems that OUTPUT_IS_LIST is class-level static metadata and can’t be toggled at runtime.
For now, converting via something like BatchToList (e.g. from ComfyUI-List-Utils ) appears to work to treat a Python list as a LIST and expand it.
That said, if rgthree provided a “list expansion”–type node, it would be convenient because users wouldn’t need to install another custom node.