-
-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More general Math node #315
Comments
Variable number of inputs is something not possible right now. But yeah, something like this would be cool. Though, I'm not really sure what use case it would be for. Really all the math node is needed for right now is taking fractions of an image's size and stuff like that |
It's possible using a little trick. We don't actually need to support variable number of inputs, it just has to look like we do. We could just have a large-enough fixed number of inputs (e.g. 10) and hide all inputs except for the first one by default. If the user that "adds" new inputs, we just show them the next hidden one. Hacky, yes, but functional.
We have a bunch of nodes with number inputs, all of which can benefit from a powerful Math node. Even the simplest Math node (one that just returns a constant number) is useful because it allows you to control multiple connected values at once. |
That's actually a pretty genius hack. We could use that for all the variable input nodes, like image stack. Just do a [ImageInput(label=f"Image {i}") for i in range(100))] and then have configurable option for whether it's variable or not, which we'd set to true (and probably have a starting index option), and then it would handle that on the frontend. |
Right now, the Math node is very limiting. It only supports a small selection of binary operations, and even simple formulas are difficult to implement.
Add a Math node with a variable number of inputs that produces one output.
The formula itself is input using a simple text field. The input numbers are simply labeled lowercase a-z. A formula could look like this:
sqrt(a ** 2 + b ** 2) * c / 100
The text was updated successfully, but these errors were encountered: