diff options
Diffstat (limited to 'source/blender/python/mathutils/mathutils.h')
-rw-r--r-- | source/blender/python/mathutils/mathutils.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h index 4aa26dcc5be..d73d2afe69b 100644 --- a/source/blender/python/mathutils/mathutils.h +++ b/source/blender/python/mathutils/mathutils.h @@ -162,28 +162,56 @@ void _BaseMathObject_RaiseNotFrozenExc(const BaseMathObject *self); 0) /* utility func */ +/** + * Helper function. + * \return length of `value`, -1 on error. + */ int mathutils_array_parse( float *array, int array_min, int array_max, PyObject *value, const char *error_prefix); +/** + * \return -1 is returned on error and no allocation is made. + */ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, const char *error_prefix); +/** + * Parse an array of vectors. + */ int mathutils_array_parse_alloc_v(float **array, int array_dim, PyObject *value, const char *error_prefix); +/** + * Parse an sequence array_dim integers into array. + */ int mathutils_int_array_parse(int *array, int array_dim, PyObject *value, const char *error_prefix); +/** + * Parse sequence of array_dim sequences of integers and return allocated result. + */ int mathutils_array_parse_alloc_vi(int **array, int array_dim, PyObject *value, const char *error_prefix); +/** + * Parse sequence of variable-length sequences of int and return allocated + * triple of arrays to represent the result: + * The flattened sequences are put into *array. + * The start index of each sequence goes into start_table. + * The length of each index goes into len_table. + */ int mathutils_array_parse_alloc_viseq( int **array, int **start_table, int **len_table, PyObject *value, const char *error_prefix); int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error_prefix); +/** + * helper function that returns a Python `__hash__`. + * + * \note consistent with the equivalent tuple of floats (CPython's 'tuplehash') + */ Py_hash_t mathutils_array_hash(const float *float_array, size_t array_len); /* zero remaining unused elements of the array */ @@ -194,9 +222,21 @@ Py_hash_t mathutils_array_hash(const float *float_array, size_t array_len); #define MU_ARRAY_FLAGS (MU_ARRAY_ZERO | MU_ARRAY_SPILL) +/** + * Column vector multiplication (Matrix * Vector). + * <pre> + * [1][4][7] [a] + * [2][5][8] * [b] + * [3][6][9] [c] + * </pre> + * + * \note Vector/Matrix multiplication is not commutative. + * \note Assume read callbacks have been done first. + */ int column_vector_multiplication(float r_vec[4], VectorObject *vec, MatrixObject *mat); #ifndef MATH_STANDALONE /* dynstr as python string utility functions */ +/* dynstr as python string utility functions, frees 'ds'! */ PyObject *mathutils_dynstr_to_py(struct DynStr *ds); #endif |