diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-07 03:07:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-07 03:09:00 +0300 |
commit | 41a2b97c30ecf3c0d67303b7a27419bf31bf5e4f (patch) | |
tree | b1ce2b48d330d2343a9c46500e4d003445a5ba1b /source | |
parent | a048d5f945be217c0c3e90cb716bf6bb7c267097 (diff) |
Minor changes needed for standalone mathutils
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 6 | ||||
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 41 |
2 files changed, 29 insertions, 18 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 19d116928fd..52ff6fd3e8a 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -1569,6 +1569,7 @@ void mat4_decompose(float loc[3], float quat[4], float size[3], float wmat[4][4] * * See https://en.wikipedia.org/wiki/Polar_decomposition for more. */ +#ifndef MATH_STANDALONE void mat3_polar_decompose(float mat3[3][3], float r_U[3][3], float r_P[3][3]) { /* From svd decomposition (M = WSV*), we have: @@ -1586,7 +1587,7 @@ void mat3_polar_decompose(float mat3[3][3], float r_U[3][3], float r_P[3][3]) mul_m3_m3m3(r_U, W, Vt); mul_m3_series(r_P, V, S, Vt); } - +#endif void scale_m3_fl(float m[3][3], float scale) { @@ -1727,6 +1728,8 @@ void blend_m4_m4m4(float out[4][4], float dst[4][4], float src[4][4], const floa loc_quat_size_to_mat4(out, floc, fquat, fsize); } +/* for builds without Eigen */ +#ifndef MATH_STANDALONE /** * A polar-decomposition-based interpolation between matrix A and matrix B. * @@ -1795,6 +1798,7 @@ void interp_m4_m4m4(float R[4][4], float A[4][4], float B[4][4], const float t) copy_m4_m3(R, R3); copy_v3_v3(R[3], loc); } +#endif /* MATH_STANDALONE */ bool is_negative_m3(float mat[3][3]) { diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index f2e48cbd6ea..89c3ed2460e 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -38,8 +38,10 @@ #include "python_utildefines.h" +#ifndef MATH_STANDALONE /* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */ #include "BLI_string_utf8.h" +#endif #ifdef _WIN32 #include "BLI_path_util.h" /* BLI_setenv() */ @@ -199,6 +201,27 @@ void PyC_List_Fill(PyObject *list, PyObject *value) } } +/** + * Use with PyArg_ParseTuple's "O&" formatting. + */ +int PyC_ParseBool(PyObject *o, void *p) +{ + bool *bool_p = p; + long value; + if (((value = PyLong_AsLong(o)) == -1) || !ELEM(value, 0, 1)) { + PyErr_Format(PyExc_ValueError, + "expected a bool or int (0/1), got %s", + Py_TYPE(o)->tp_name); + return 0; + } + + *bool_p = value ? true : false; + return 1; +} + + +#ifndef MATH_STANDALONE + /* for debugging */ void PyC_ObSpit(const char *name, PyObject *var) { @@ -1016,20 +1039,4 @@ int PyC_RunString_AsNumber(const char *expr, double *value, const char *filename return error_ret; } -/** - * Use with PyArg_ParseTuple's "O&" formatting. - */ -int PyC_ParseBool(PyObject *o, void *p) -{ - bool *bool_p = p; - long value; - if (((value = PyLong_AsLong(o)) == -1) || !ELEM(value, 0, 1)) { - PyErr_Format(PyExc_ValueError, - "expected a bool or int (0/1), got %s", - Py_TYPE(o)->tp_name); - return 0; - } - - *bool_p = value ? true : false; - return 1; -} +#endif /* #ifndef MATH_STANDALONE */ |