Tangle of Nodes
Node trees can be a complicated business - especially when trying to construct complex mathematical functions. One wrong link between nodes can really ruin your day. This is where Node Expressions helps cut through the tangle of noodles - what could be finer than simply typing your mathematical expression and have the hard work of building the node tree done for you.
Fast and easy
With Node Expressions you'll no longer spend time trying to track down that incorrectly linked maths node - you won't even need to fiddle with those nodes at all. Simply add a new Maths Expression (available via the Add menu in Node Editor), type your equation into the text box and the addon creates a new node group containing all the required maths to produce that function - whether it's something simple such as a node to sum 5 inputs ("a+b+c+d+e"), a node to simultaneously return the Maximum, Minimum, Sum and Product of some inputs ("Maximum=max(Value1,Value2), Minimum=min(Value1,Value2), Sum=Value1+Value2, Product=Value1*Value2") or something a whole lot more complicated such as spirals and stars - all from simply typing a mathematical expression.
Expressions can be 'simple' ("a+b+c") or more complex, automatically take care of mathematical precedence ("a+b*c" is equivalent to "a+(b*c)", for example), includes a wide range of mathematical functions (maximum, minimum, sine, cosine, tangent, modulo, absolute, etc.) as well as comparators (eg, "x=y", "x>y", "x<=y", etc.) - all of which can be combined into an arbitrarily long expression. Within the add-on, expressions can be edited and re-edited at the click of a button with automatic syntax and error checking. Furthermore, redundant inputs/outputs can be optionally automatically pruned and re-sequenced each time the expression is updated.
Expressions can be either entered directly (eg, "a+b > x*y") or can be placed in a Text block for easy editing. Expressions can include sub-expressions and when placed within a text block, expressions can include comments and additional spacing :
#Calculate distance from origin
#Use the angle and distance to produce output
Output=sin(_angle*5)/2+0.5 > _dist*Scale-Offset
Entering the above text will auto-generate the following node group :
The sub-groups contain the nodes required to produce the specified functions (in this case '_dist') :
Here's the resultant node group and result :
Node groups created with this add-on are fully compatible with future versions of Blender - with or without the add-on - since once created, they are effectively a standard Blender node group. Generated node groups can be edited using the normal Node Editor within Blender and since only standard Blender nodes are used, all node groups are fully GPU compatible (unlike if the same functions had been created with OSL). Compatible with Cycles, Eevee, and can even be used for Blender Internal renderer.
A cut-down version is available - excluding the presets, textblock editing and optimisations, while still allowing convenient creation and editing of expressions to generate a node tree. Ideal to let you create and edit mathematical expressions where you don't need the added features of the full-blown Node Expressions.
This add-on is currently provided as two separate intallation files - one for Blender versions up to 2.79 and another for Blender version 2.8 and later. Future enhancements are planned - such as extending the library of sample expressions and extending the functionality to support other functions - such as vector maths, texture nodes, etc. and more.
Note : Additional information can now be found on my blog at https://baldingwizard.wixsite.com/blog/node-expressions. The site also includes a number of tutorials which demonstrate the use of this add-on.