Mathematical expressions

First version:
math_exp_v1_3

Dynamically checking the correctness of an expression in the IDE (Blender):

  1. Not a complete expression.
  2. Variable c is specified, but it is not added by the Add Value button.
  3. The value of the Float type is not completed.
  4. There is no closing parenthesis.
  • Limit in 10 input variables (I don’t think I will need more): a, b, c, d, e, x, y, h, i, k.
  • Operators: +, -, *, /, ^, (,),%.
  • Validation occurs when entering values ​​in the expression field. Therefore, in order to fix the 2nd situation, you need to click on Add Value, and then click on the expression input field again. Otherwise, the verification algorithms will be executed every time the node interface is drawn, or it is necessary to replace the button handlers.

The task is divided into 2 parts: checking the correctness through python in the Blender interface and when performing calculations when the application is running in haxe.
The following decisions are taken as a basis:

  1. python - http://repl.it/3xv/1
  2. haxe - https://github.com/maitag/formula (added all the necessary classes to the node code)

If you have any ideas for optimization and algorithms, I’d love to hear (I’m not that good with Python and Haxe).

  • There is a lot of code than usual. Nobody minds that?
  • I will optimize this node, but it’s not fast, is there a need to lay it out like this?
  • I’m waiting for suggestions and can anyone test and look for errors in the processing.

Scripts: MathExpressionNode.zip

6 Likes

Whoa, This looks super cool.

2 Likes