I'm trying to define a simple custom node but whatever I try I can't seem to get the inputs to show in ComfyUI. I've tried various approaches but it seems anytime I define a custom node with input float it doesn't seem to appear. What am I doing wrong?
import numpy as np
import cv2
class AReferenceSize:
def __init__(self):
self.reference_size = None
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"current_size": ("FLOAT", {"default": 0.0}),
"update": ("BOOLEAN", {"default": False})
}
}
RETURN_TYPES = ("FLOAT",)
FUNCTION = "get_and_update"
CATEGORY = "example"
def get_and_update(self, current_size, update):
print(f"get_and_update called with current_size: {current_size}, update: {update}")
if self.reference_size is None or update:
self.reference_size = current_size
return (self.reference_size,)
# Register the nodes
NODE_CLASS_MAPPINGS = {
"AReferenceSize": AReferenceSize
}
NODE_DISPLAY_NAME_MAPPINGS = {
"AReferenceSize": "AReference Size"
}
