Trung0246 / ComfyUI-0246

Random nodes for ComfyUI
MIT License
108 stars 11 forks source link

Changing the input slot names, on the switch node, gives error #31

Closed JorgeR81 closed 2 weeks ago

JorgeR81 commented 5 months ago

If I change the input slot names on the switch node I get this error:

trung

Error occurred when executing 0246.Switch:

'MiDaS Depth'

File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-0246\utils.py", line 381, in new_func
res_value = old_func(*final_args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\execution.py", line 65, in map_node_over_list
results.append(getattr(obj, func)(**input_data_all))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-0246\nodes.py", line 2887, in execute
res.append(kwargs[kwargs[key][0]])
~~~~~~^^^^^^^^^^^^^^^^
Trung0246 commented 4 months ago

Hm not intended to allows changing names since the nodes rely on names to locate pins. I could see what I can do for custom names.

JorgeR81 commented 4 months ago

I don't need to change the input slot names on the Switch node. What I like about this, is that the names were converted to a COMBO list !

An alternative solution could be to display the title name of the connected nodes in the COMBO list. This way it's not necessary to change the slot names. If you need the slot names, the title name could be added after the slot name, eg: 0:IMAGE - Marigold Depth.

trung2

trung4

drmbt commented 2 months ago

the ability to relable the names would make Hub my go to in every workflow. might it be possible to relable without actually changing the name itself?

Trung0246 commented 2 months ago

the ability to relable the names would make Hub my go to in every workflow. might it be possible to relable without actually changing the name itself?

I think that could possibly since that just change label not name. Label is different from name as name is the internal name that only shown when label does not exist, and label does not influence name identifier which is the main purpose of name.

Currently I'm a bit busy in life so not many update are happening but hopefully I'll try to fix things up for next month.

Trung0246 commented 2 weeks ago

This should no longer crash with recent fixes. Hopefully everything should works now for changing input slot label directly. Changing switch slot label based on connected node is currently infeasible due to implementation issues but probably could add that in the future.

JorgeR81 commented 2 weeks ago

It's working for me. Thanks.

Changing the switch labels ( switch:0 ; switch:1 ; ... ) would also be great, if possible. It could be useful if we have multiple outputs. The switch labels could change when we change the output labels, on the switch node.