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
This commit is contained in:
27
source/blender/python/generic/bl_math_py_api.h
Normal file
27
source/blender/python/generic/bl_math_py_api.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \ingroup pygen
|
||||
*/
|
||||
|
||||
#ifndef __BL_MATH_PY_API_H__
|
||||
#define __BL_MATH_PY_API_H__
|
||||
|
||||
PyMODINIT_FUNC BPyInit_bl_math(void);
|
||||
|
||||
#endif /* __BL_MATH_PY_API_H__ */
|
||||
Reference in New Issue
Block a user