Added new node - Count Objects

This commit is contained in:
Level Pixel Dev
2025-05-30 06:03:19 +06:00
parent 502eb51916
commit 83e4e0fcee
4 changed files with 31 additions and 2 deletions
+1
View File
@@ -102,6 +102,7 @@ The core functionality is taken from [comfyui-mixlab-nodes](https://github.com/s
There are a few more nodes in this package that have some unusual uses:
* Google Translate
* Count Objects - counts the number of objects that were fed to the input (this can be a list or one single object). Accepts any type of input.
* Preview Image Bridge - only output an image to the screen if there is a connection to the output node. Useful in loops and conditions where the execution of this node is not required due to current conditions (variables).
* Show Text Bridge - only output text to the screen if there is a connection to the output node. Useful in loops and conditions where the execution of this node is not required due to current conditions (variables).
* Show Text - output text to the screen with mandatory execution. The node is executed in any case, whether the output is connected or not.
+2 -1
View File
@@ -57,5 +57,6 @@
"Text Replace [LP]":"Text Replace",
"Pipe [LP]":"Pipe",
"Pipe In [LP]":"Pipe In",
"Pipe Out [LP]":"Pipe Out"
"Pipe Out [LP]":"Pipe Out",
"Count Objects [LP]":"Count Objects - counts the number of objects that were fed to the input (this can be a list or one single object). Accepts any type of input."
}
+27
View File
@@ -236,11 +236,37 @@ class Pipe:
return (pipe, new_model, new_pos, new_neg, new_latent, new_vae, new_clip, new_controlnet, new_image, new_seed, new_any1, new_any2, new_any3, new_any4, new_any5,)
class CountObjects:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"input": (any,),
"base_value": ("INT", {"default": 0, "min": 0}),
}
}
RETURN_TYPES = ("INT",)
INPUT_IS_LIST = True
FUNCTION = "count_objects"
CATEGORY = "LevelPixel/Image"
def count_objects(self, input, base_value):
if input is None:
count = 0
elif isinstance(input, list):
count = len(input)
else:
count = 1
return (base_value[0] + count,)
NODE_CLASS_MAPPINGS = {
"Delay|LP": Delay,
"PipeOut|LP": PipeOut,
"PipeIn|LP": PipeIn,
"Pipe|LP": Pipe,
"CountObjects|LP": CountObjects
}
NODE_DISPLAY_NAME_MAPPINGS = {
@@ -248,5 +274,6 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"PipeOut|LP": "Pipe Out [LP]",
"PipeIn|LP": "Pipe In [LP]",
"Pipe|LP": "Pipe [LP]",
"CountObjects|LP": "Count Objects [LP]"
}
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-levelpixel"
description = "Main nodes of the Level Pixel company (aka levelpixel, LP). Includes convenient nodes for working with images from folders; counting files in a folder; cleaning memory; tag filters. Model Unloader, Free memory, Tag Filters, Tag Category Filters, Tag Choice Parser, File counter, Image Loader From Path (with counters), Google Translator, Language Translator, Override Device, Delay, Lora Tag Loader. Repository: https://github.com/LevelPixel/ComfyUI-LevelPixel"
version = "1.2.4"
version = "1.2.5"
license = { file = "LICENSE" }
dependencies = [
"torch>=2.0.1",