ifdef out dynstr so mathutils can be compiled as an external module again.
This commit is contained in:
@@ -35,7 +35,10 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_dynstr.h"
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
# include "BLI_dynstr.h"
|
||||
#endif
|
||||
|
||||
PyDoc_STRVAR(M_Mathutils_doc,
|
||||
"This module provides access to matrices, eulers, quaternions and vectors."
|
||||
@@ -312,6 +315,7 @@ int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int flo
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
/* dynstr as python string utility funcions, frees 'ds'! */
|
||||
PyObject *mathutils_dynstr_to_py(struct DynStr *ds)
|
||||
{
|
||||
@@ -324,6 +328,7 @@ PyObject *mathutils_dynstr_to_py(struct DynStr *ds)
|
||||
PyMem_Free(ds_buf);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* silly function, we dont use arg. just check its compatible with __deepcopy__ */
|
||||
int mathutils_deepcopy_args_check(PyObject *args)
|
||||
|
||||
@@ -120,8 +120,11 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error
|
||||
|
||||
int column_vector_multiplication(float rvec[4], VectorObject *vec, MatrixObject *mat);
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
/* dynstr as python string utility funcions */
|
||||
PyObject *mathutils_dynstr_to_py(struct DynStr *ds);
|
||||
#endif
|
||||
|
||||
int mathutils_deepcopy_args_check(PyObject *args);
|
||||
|
||||
#endif /* __MATHUTILS_H__ */
|
||||
|
||||
@@ -31,7 +31,10 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_dynstr.h"
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
# include "BLI_dynstr.h"
|
||||
#endif
|
||||
|
||||
#define COLOR_SIZE 3
|
||||
|
||||
@@ -131,6 +134,7 @@ static PyObject *Color_repr(ColorObject *self)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
static PyObject *Color_str(ColorObject *self)
|
||||
{
|
||||
DynStr *ds;
|
||||
@@ -145,6 +149,7 @@ static PyObject *Color_str(ColorObject *self)
|
||||
|
||||
return mathutils_dynstr_to_py(ds); /* frees ds */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ------------------------tp_richcmpr */
|
||||
/* returns -1 exception, 0 false, 1 true */
|
||||
@@ -820,7 +825,11 @@ PyTypeObject color_Type = {
|
||||
&Color_AsMapping, /* tp_as_mapping */
|
||||
NULL, /* tp_hash */
|
||||
NULL, /* tp_call */
|
||||
#ifndef MATH_STANDALONE
|
||||
(reprfunc) Color_str, /* tp_str */
|
||||
#else
|
||||
NULL, /* tp_str */
|
||||
#endif
|
||||
NULL, /* tp_getattro */
|
||||
NULL, /* tp_setattro */
|
||||
NULL, /* tp_as_buffer */
|
||||
|
||||
@@ -35,7 +35,10 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_dynstr.h"
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
# include "BLI_dynstr.h"
|
||||
#endif
|
||||
|
||||
#define EULER_SIZE 3
|
||||
|
||||
@@ -323,6 +326,7 @@ static PyObject *Euler_repr(EulerObject *self)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
static PyObject *Euler_str(EulerObject *self)
|
||||
{
|
||||
DynStr *ds;
|
||||
@@ -337,6 +341,7 @@ static PyObject *Euler_str(EulerObject *self)
|
||||
|
||||
return mathutils_dynstr_to_py(ds); /* frees ds */
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
{
|
||||
@@ -663,7 +668,11 @@ PyTypeObject euler_Type = {
|
||||
&Euler_AsMapping, /* tp_as_mapping */
|
||||
NULL, /* tp_hash */
|
||||
NULL, /* tp_call */
|
||||
#ifndef MATH_STANDALONE
|
||||
(reprfunc) Euler_str, /* tp_str */
|
||||
#else
|
||||
NULL, /* tp_str */
|
||||
#endif
|
||||
NULL, /* tp_getattro */
|
||||
NULL, /* tp_setattro */
|
||||
NULL, /* tp_as_buffer */
|
||||
|
||||
@@ -35,7 +35,10 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_dynstr.h"
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
# include "BLI_dynstr.h"
|
||||
#endif
|
||||
|
||||
typedef enum eMatrixAccess_t {
|
||||
MAT_ACCESS_ROW,
|
||||
@@ -1647,6 +1650,7 @@ static PyObject *Matrix_repr(MatrixObject *self)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
static PyObject *Matrix_str(MatrixObject *self)
|
||||
{
|
||||
DynStr *ds;
|
||||
@@ -1682,6 +1686,7 @@ static PyObject *Matrix_str(MatrixObject *self)
|
||||
|
||||
return mathutils_dynstr_to_py(ds); /* frees ds */
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
{
|
||||
@@ -2418,7 +2423,11 @@ PyTypeObject matrix_Type = {
|
||||
&Matrix_AsMapping, /*tp_as_mapping*/
|
||||
NULL, /*tp_hash*/
|
||||
NULL, /*tp_call*/
|
||||
#ifndef MATH_STANDALONE
|
||||
(reprfunc) Matrix_str, /*tp_str*/
|
||||
#else
|
||||
NULL, /*tp_str*/
|
||||
#endif
|
||||
NULL, /*tp_getattro*/
|
||||
NULL, /*tp_setattro*/
|
||||
NULL, /*tp_as_buffer*/
|
||||
|
||||
@@ -35,7 +35,10 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_dynstr.h"
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
# include "BLI_dynstr.h"
|
||||
#endif
|
||||
|
||||
#define QUAT_SIZE 4
|
||||
|
||||
@@ -496,6 +499,7 @@ static PyObject *Quaternion_repr(QuaternionObject *self)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
static PyObject *Quaternion_str(QuaternionObject *self)
|
||||
{
|
||||
DynStr *ds;
|
||||
@@ -510,6 +514,7 @@ static PyObject *Quaternion_str(QuaternionObject *self)
|
||||
|
||||
return mathutils_dynstr_to_py(ds); /* frees ds */
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
{
|
||||
@@ -1202,7 +1207,11 @@ PyTypeObject quaternion_Type = {
|
||||
&Quaternion_AsMapping, /* tp_as_mapping */
|
||||
NULL, /* tp_hash */
|
||||
NULL, /* tp_call */
|
||||
#ifndef MATH_STANDALONE
|
||||
(reprfunc) Quaternion_str, /* tp_str */
|
||||
#else
|
||||
NULL, /* tp_str */
|
||||
#endif
|
||||
NULL, /* tp_getattro */
|
||||
NULL, /* tp_setattro */
|
||||
NULL, /* tp_as_buffer */
|
||||
|
||||
@@ -35,7 +35,10 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_dynstr.h"
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
# include "BLI_dynstr.h"
|
||||
#endif
|
||||
|
||||
#define MAX_DIMENSIONS 4
|
||||
|
||||
@@ -1231,6 +1234,7 @@ static PyObject *Vector_repr(VectorObject *self)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
static PyObject *Vector_str(VectorObject *self)
|
||||
{
|
||||
int i;
|
||||
@@ -1252,7 +1256,7 @@ static PyObject *Vector_str(VectorObject *self)
|
||||
|
||||
return mathutils_dynstr_to_py(ds); /* frees ds */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Sequence Protocol */
|
||||
/* sequence length len(vector) */
|
||||
@@ -2816,7 +2820,11 @@ PyTypeObject vector_Type = {
|
||||
|
||||
NULL, /* hashfunc tp_hash; */
|
||||
NULL, /* ternaryfunc tp_call; */
|
||||
#ifndef MATH_STANDALONE
|
||||
(reprfunc)Vector_str, /* reprfunc tp_str; */
|
||||
#else
|
||||
NULL, /* reprfunc tp_str; */
|
||||
#endif
|
||||
NULL, /* getattrofunc tp_getattro; */
|
||||
NULL, /* setattrofunc tp_setattro; */
|
||||
|
||||
|
||||
@@ -973,12 +973,14 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a
|
||||
|
||||
float n1n2[3], n2n3[3], n3n1[3];
|
||||
float potentialVertex[3];
|
||||
char *planes_used = MEM_callocN(sizeof(char) * len, __func__);
|
||||
char *planes_used = PyMem_Malloc(sizeof(char) * len);
|
||||
|
||||
/* python */
|
||||
PyObject *py_verts = PyList_New(0);
|
||||
PyObject *py_plene_index = PyList_New(0);
|
||||
|
||||
memset(planes_used, 0, sizeof(char) * len);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
const float *N1 = planes[i];
|
||||
for (j = i + 1; j < len; j++) {
|
||||
@@ -1031,7 +1033,7 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a
|
||||
Py_DECREF(item);
|
||||
}
|
||||
}
|
||||
MEM_freeN(planes_used);
|
||||
PyMem_Free(planes_used);
|
||||
|
||||
{
|
||||
PyObject *ret = PyTuple_New(2);
|
||||
|
||||
Reference in New Issue
Block a user