ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

[Bug] Primitive nodes do not work with forced inputs

Open FizzleDorf opened this issue 1 year ago • 2 comments

I was forcing inputs on my scheduler nodes to make setup a lot less annoying and found that primitive nodes do not work with forced inputs. It doesn't matter if the input is required or optional. An example in code would be:

class PromptScheduleNodeFlowEnd:
    @classmethod
    def INPUT_TYPES(s):
        return {"required": {"text": ("STRING", {"multiline": False, "forceInput": True}), 
                            "clip": ("CLIP", ),
                            "max_frames": ("INT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0, "forceInput": True}),
                            "current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0, "forceInput": True}),},
               "optional": {"pre_text": ("STRING", {"multiline": False,"forceInput": True}),
                            "app_text": ("STRING", {"multiline": False,"forceInput": True}),
                            "pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
                            "pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
                            "pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
                            "pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True})
                            }}
...

The error thrown when trying to queue:

widgetInputs.js:231 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'name')
    at PrimitiveNode.applyToGraph (widgetInputs.js:231:38)
    at ComfyApp.graphToPrompt (app.js:1297:11)
    at async ComfyApp.queuePrompt (app.js:1414:16)

and the error thrown when adjusting the value on the Primitive:

widgetInputs.js:231 Uncaught TypeError: Cannot read properties of undefined (reading 'name')
    at PrimitiveNode.applyToGraph (widgetInputs.js:231:38)
    at widget.callback (widgetInputs.js:336:11)
    at inner_value_change (litegraph.core.js:10110:24)
    at Object.<anonymous> (litegraph.core.js:10060:9)

My workflow looks like this: Capture

Everything works normally when they aren't forced as inputs but I would like to help streamline the user experience on my nodes instead of the user having to remember to convert everything over. I tried this with nodes in nodes.py. Same issue. Another thing to note is if you try to make two connections, the noodle and node lock to your cursor and you have to refresh in order to get things back to normal.

FizzleDorf avatar Jun 23 '23 22:06 FizzleDorf

hopefully #1104 would fix this

neo avatar Aug 04 '23 20:08 neo

@FizzleDorf Is this still an issue after that PR merged?

robinjhuang avatar Jul 03 '24 22:07 robinjhuang

yes, this was resolved earlier, thanks for letting me know

FizzleDorf avatar Jul 05 '24 01:07 FizzleDorf