← All ideas
  • Published 31 May 2022

Dynamic number of node inputs (Math Expression node)

When doing math with nodes, you can do one math action at a time with two numbers. So, if you are doing anything that requires more, you have to keep adding math nodes one after another, and they just keep piling up and it becomes a mess quickly. The solution to that is the ability to add/remove as many node inputs as you want.

My proposal to create either a new math node type, or replace the whole math node with a node called "Math Expression" In which, the user could write a math expression using the variables connected to the node, instead of selecting one from a list.

So, if you want a sum, you write "A+B". Simple, right?

Or, if the user wants something more complex, they can write something like "2*A+B/2". Currently, this would take three math nodes to do. It would be a lot cleaner if only one node was required.

But what if there's more variables that are needed? Instead of using multiple math expression nodes, the user would have the ability to add more variables by pressing the "+". It would add "C", then "D", and so on. Variables would be removed by clicking "X".

By default, if there is no "C" variable, the value of "C" would be 0,

(Note: Removing the "B" variable, would turn the "C" variable to "B", and the written expression would automatically update)

Dynamic inputs.png

There are other uses for this. For example, the ability to dynamically add and remove inputs of a node would also allow a more advanced ColorRamp displayed in the image. Or How about a ShaderRamp to mix three or more Shaders together?

This idea was marked as a duplicate of Geometry nodes expression (Gnex ) :).
96.8%

Development Status: Open

Upvote 30 Downvote 1
FreeMind
31 May 2022

8 Comments

ansonsavage

Houdini has a really nice implementation of this that I'm super impressed with: letshoudini.files.wordpress.com/2016/02/screen-shot-2016-02-22-at-5-31-20-pm.png

TheEasyOne

This is a must have.

Similar proposal : blender.community/c/rightclickselect/Rqhbbc

ManBlender
softyoda

This make me think of this mockup I made where you can like yours make new non-connected input, I don't know what would be better between Alphabet generated only variable name, or custom variable name.

I also think the join string should have an option to add string without connecting the wire. image info Also, the ability to unstruc the vector structure for example, without having to add "split" and "combine" everywhere, it could be nice.

FreeMind Author

Making the Equation string connectable may be a good idea. Though it would not work perfectly with the ABC viarables, as that would not update the expression when inputs are deleted...

chenze13547542093

I've already mentioned it, and I don't know when it will be.