Commit Graph

18 Commits

Author SHA1 Message Date
Jacob Segal
a86d383ff3 Code cleanup
While implementing caching for components, I did some cleanup. Despite
the fact that subgraph caching is put on hold for now (in favor of a
larger cache refactor later), these are the changes that I think are
worth keeping anyway.

* Makes subgraph node IDs deterministic
* Allows usage of the topological sort without execution
* Tracks parent nodes (i.e. those that caused a node to be created) and
  display nodes (i.e. the one we want to highlight while an ephemeral
  node is executing) separately.
2023-08-09 00:54:42 -07:00
Jacob Segal
dbb5a3122a Add additional accumulation nodes
Most of the work is thanks to @PGadoury in this PR:
https://github.com/guill/ComfyUI/pull/1

I've just made some minor modifications.
2023-07-30 19:34:28 -07:00
Jacob Segal
a274cd5c13 Reorganize all demo components
Rather than creating a bunch of top-level categories, I'm using
sub-categories.
2023-07-28 22:41:43 -07:00
Jacob Segal
5d72965863 Implement conditional Execution Blocking
Execution blocking can be done by returning an `ExecutionBlocker`
(imported from graph_utils) either in place of results or as a specific
output. Any node that uses an `ExecutionBlocker` as input will be
skipped. This operates on a per-entry basis when inputs are lists.

If the `ExecutionBlocker` is initialized with an error message, that
message will be displayed on the first node it's used on (and further
downstream nodes will be silently skipped).
2023-07-28 22:28:18 -07:00
Jacob Segal
b09620f89c In For loops, display feedback on original node
Rather than displaying live feedback on the "End For" node, the feedback
will be displayed in the UI on the original node.
2023-07-22 23:02:10 -07:00
Jacob Segal
b66253b930 Improve recognition of node linkage
Honestly, I'm still a little concerned here. There's nothing stopping a
custom node from having a data type of ["str",int]. I've improved
recognition to at least prevent the detection of other types, but we
may still want a more systemic fix (e.g. wrapping literals within a
class when using them as inputs to nodes in subgraphs).
2023-07-22 22:38:17 -07:00
Jacob Segal
2520ade224 Fix lazy index node. No idea how this ever worked. 2023-07-21 20:25:20 -07:00
Jacob Segal
9d9e1e65ab Add nodes for dealing with BOOLs 2023-07-20 21:04:08 -07:00
Jacob Segal
41142794ca Add syntactic sugar (for loops and more)
Note that For loops still require WAS-ns. They just expand to using the
integer operation node internally.

Also adds some nodes for accumulation operations.
2023-07-20 00:18:18 -07:00
Jacob Segal
d8fdbb5168 Don't display an error if there's no components directory 2023-07-18 20:51:17 -07:00
Jacob Segal
b234baee2c Add lazy evaluation and dynamic node expansion
This PR inverts the execution model -- from recursively calling nodes to
using a topological sort of the nodes. This change allows for
modification of the node graph during execution. This allows for two
major advantages:
1. The implementation of lazy evaluation in nodes. For example, if a
   "Mix Images" node has a mix factor of exactly 0.0, the second image
   input doesn't even need to be evaluated (and visa-versa if the mix
   factor is 1.0).
2. Dynamic expansion of nodes. This allows for the creation of dynamic
   "node groups". Specifically, custom nodes can return subgraphs that
   replace the original node in the graph. This is an *incredibly*
   powerful concept. Using this functionality, it was easy to
   implement:
   a. Components (a.k.a. node groups)
   b. Flow control (i.e. while loops) via tail recursion
   c. All-in-one nodes that replicate the WebUI functionality
   d. and more
All of those were able to be implemented entirely via custom nodes
without hooking or replacing any core functionality. Within this PR,
I've included all of these proof-of-concepts within a custom node pack.
In reality, I would expect some number of them to be merged into the
core node set (with the rest left to be implemented by custom nodes).

I made very few changes to the front-end, so there are probably some
easy UX wins for someone who is more willing to wade into .js land. The
user experience is a lot better than I expected though -- progress shows
correctly in the UI over the nodes that are being expanded.
2023-07-18 20:08:12 -07:00
comfyanonymous
60ac983238 Merge branch 'master' of https://github.com/city96/ComfyUI 2023-04-08 15:50:26 -04:00
comfyanonymous
940893f92c Update the example_node.py.example with RETURN_NAMES. 2023-04-02 10:27:01 -04:00
City
9ac95e6ac7 Add human-readable name support for custom nodes 2023-03-31 07:05:17 +02:00
comfyanonymous
1688f5024d Fix a few issues with the custom_nodes PR.
There only needs to be one example in the folder.
2023-02-17 11:19:49 -05:00
Hacker 17082006
7da0147d8a Done custom_node import error fixing 2023-02-15 21:48:10 +07:00
Hacker 17082006
493671574e Adding some suggests from the author 2023-02-14 22:20:30 +07:00
Hacker 17082006
5ce4b9eca3 Add custom node feature 2023-02-13 18:17:40 +07:00