Drivers: add lerp and clamp functions to namespace.
authorAlexander Gavrilov <angavrilov@gmail.com>
Sat, 4 Jul 2020 10:20:59 +0000 (13:20 +0300)
committerAlexander Gavrilov <angavrilov@gmail.com>
Tue, 21 Jul 2020 16:01:50 +0000 (19:01 +0300)
commitf8cc01595d1181b9a8adcb6aa930d4cbfebdc8bf
tree881dd5079bb2e7d674980a5e80d3ea7d16dd8375
parent8369adabc0ec7a1fce248b688bf20860ae0434bb
Drivers: add lerp and clamp functions to namespace.

Implementation of lerp without a function requires repeating one of
the arguments, which is not ideal. To avoid that, add a new function
to the driver namespace. In addition, provide a function for clamping
between 0 and 1 to support easy clamped lerp, and a smoothstep function
from GLSL that is somewhat related.

The function implementations are added to a new bl_math module.
As an aside, add the round function and two-argument log to the
pylike expression subset.

Differential Revision: https://developer.blender.org/D8205
source/blender/blenlib/intern/expr_pylike_eval.c
source/blender/python/generic/CMakeLists.txt
source/blender/python/generic/bl_math_py_api.c [new file with mode: 0644]
source/blender/python/generic/bl_math_py_api.h [new file with mode: 0644]
source/blender/python/intern/bpy_driver.c
source/blender/python/intern/bpy_interface.c
tests/gtests/blenlib/BLI_expr_pylike_eval_test.cc