GithubHelp home page GithubHelp logo

comfyui_nestednodebuilder's Introduction

ComfyUI_NestedNodeBuilder

Adds a feature for the default interface in ComfyUI that allows for nesting of other nodes for better organization and simplification of repetitive patterns in workflows.

Disclaimer

This is a prototype and will likely have many problems. This will probably be obsolete once subgraphs are implemented within ComfyUI. To be safe, save your workflow before nesting any nodes. How nested nodes are saved are subject to change and saved nodes may become unusable in the future.

Installation

Enter the following command from the commandline starting in ComfyUI/custom_nodes/

git clone https://github.com/ssitu/ComfyUI_NestedNodeBuilder

Usage

Demo:

NestedNodeBuilderDemo

Instructions:

1. Selecting the nodes to nest Select multiple nodes by using Ctrl/Shift + left/right click on the desired nodes to nest. You can also use Ctrl + left click + drag to highlight nodes.
2. Nesting the selected nodes After making a selection, right click on any of the selected nodes and select Nest Selected Nodes and choose a name that won't conflict with any other existing node. The selected nodes will be replaced with a new node that contains the selected nodes. You can also unnest the new node by right clicking on the node and clicking Unnest. The selected nodes may also be converted to an already existing nested node using the Convert selected to Nested Node: <name> option that appears if the selected nodes have a similar structure.
3. Creating a nested node from the node menu Nested nodes are saved and can be created again from the node menu that appears when you right click on the canvas under the Nested Nodes category.
4. Where are nested nodes saved? You can find them under ComfyUI/custom_nodes/ComfyUI_NestedNodeBuilder/nested_nodes/. This directory can be changed by editing the nested_nodes_path entry in the config.yaml. The nested nodes are stored as .json files. The names of the nested nodes may be changed by editing their .json files. The changes made to the directory are registered after refreshing the web UI.

How it works

The nodes that are nested are stored in the properties of the nested node. Before the prompt is calculated, the nested node is replaced with the nodes that it stored. After the prompt is calculated, the nodes are nested again. Depending on performance, this may cause a quick flash of what the workflow looks like after the nodes are unnested when queueing a prompt. This seemed to be the approach that was the least intrusive on the ComfyUI codebase.

Known Problems

  • When nesting multiple nodes with widgets like control_after_generate, there can only be one in the resulting nested node.
  • Nested nodes can be nested, but nested nodes containing other nested nodes cannot execute.
  • When converting a seed widget to input and connecting it to a primitive node, the prompt will ignore the control_after_generate widget of the primitive node and yield to the underlying control_after_generate widget of the respective node. Can be solved by changing the values to "fixed" before nesting.
  • Can't really nest output nodes such as preview image and save image nodes. It works, but it won't display the image. You can still see the image if loading the prompt from the history.

Feel free to open an issue if you find any other problems.

Credits

Inspired by this repo by ltdrdata, check it out if you want something more robust and flexible.

comfyui_nestednodebuilder's People

Contributors

ssitu avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.