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/blender/python | |
parent | a048d5f945be217c0c3e90cb716bf6bb7c267097 (diff) |
Minor changes needed for standalone mathutils
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 41 |
1 files changed, 24 insertions, 17 deletions
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 */ |