pythongosssss / ComfyUI-Custom-Scripts

Enhancements & experiments for ComfyUI, mostly focusing on UI features
MIT License
1.73k stars 134 forks source link

Collaborate with me to make things work better with Use Everywhere? #210

Open chrisgoringe opened 6 months ago

chrisgoringe commented 6 months ago

Hi - author of the https://github.com/chrisgoringe/cg-use-everywhere Use Everywhere nodes here.

Wondering if you'd be open to working with me to make our two systems work more smoothly together?

An example: at the moment the Preset Text node and the UE nodes are incompatible because the way Preset Text pushes values into widgets and the way UE creates links don't know about each other.

I was wondering if you'd consider checking for the existence of a method on outNode (which doesn't exist yet - but I could add to the UE nodes) which returned a list of (outNode, outIn) pairs enumerating the inputs that UE is sending data to?

This would be a small change to presetText.js, around line 150 - something like:

    const outNode = app.graph.getNodeById(link_info.target_id);
        var outInPairs;
        if (outNode.broadcastsDataTo) outInPairs = outNode.broadcastsDataTo(link_info.target_slot);
        else outInPairs = [ [outNode, outNode && outNode.inputs && outNode.inputs[link_info.target_slot] ]];
    outInPairs.forEach((oi) => {
        if (oi[1].widget) {
            const w = oi[0].widgets.find((w) => w.name === oi[1].widget.name);
               ...
                           ...
                        w.value = preset.value;
                }
    }

I could do a PR on your code, but you might well prefer to have some input into how this is best done.

pythongosssss commented 6 months ago

Sure, happy to accept a PR