Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python/mathutils')
-rw-r--r--source/blender/python/mathutils/mathutils.h5
-rw-r--r--source/blender/python/mathutils/mathutils_Color.h5
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.h5
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c11
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.h5
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c13
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.h5
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c17
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.h5
-rw-r--r--source/blender/python/mathutils/mathutils_bvhtree.h5
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c6
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.h5
-rw-r--r--source/blender/python/mathutils/mathutils_interpolate.h5
-rw-r--r--source/blender/python/mathutils/mathutils_kdtree.h5
-rw-r--r--source/blender/python/mathutils/mathutils_noise.h5
15 files changed, 18 insertions, 84 deletions
diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h
index c59fa75b651..d8d390cfad0 100644
--- a/source/blender/python/mathutils/mathutils.h
+++ b/source/blender/python/mathutils/mathutils.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __MATHUTILS_H__
-#define __MATHUTILS_H__
+#pragma once
/** \file
* \ingroup pymathutils
@@ -195,5 +194,3 @@ int column_vector_multiplication(float rvec[4], VectorObject *vec, MatrixObject
/* dynstr as python string utility functions */
PyObject *mathutils_dynstr_to_py(struct DynStr *ds);
#endif
-
-#endif /* __MATHUTILS_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h
index 51e1746ae74..c966bf1e3b2 100644
--- a/source/blender/python/mathutils/mathutils_Color.h
+++ b/source/blender/python/mathutils/mathutils_Color.h
@@ -18,8 +18,7 @@
* \ingroup pymathutils
*/
-#ifndef __MATHUTILS_COLOR_H__
-#define __MATHUTILS_COLOR_H__
+#pragma once
extern PyTypeObject color_Type;
#define ColorObject_Check(v) PyObject_TypeCheck((v), &color_Type)
@@ -42,5 +41,3 @@ PyObject *Color_CreatePyObject_wrap(float col[3], PyTypeObject *base_type) ATTR_
PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
unsigned char cb_type,
unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;
-
-#endif /* __MATHUTILS_COLOR_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h
index c56962395e5..0deef3cfdf3 100644
--- a/source/blender/python/mathutils/mathutils_Euler.h
+++ b/source/blender/python/mathutils/mathutils_Euler.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __MATHUTILS_EULER_H__
-#define __MATHUTILS_EULER_H__
+#pragma once
/** \file
* \ingroup pymathutils
@@ -50,5 +49,3 @@ PyObject *Euler_CreatePyObject_cb(PyObject *cb_user,
unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;
short euler_order_from_string(const char *str, const char *error_prefix);
-
-#endif /* __MATHUTILS_EULER_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 63137e094b7..3e30c81c8c6 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -2526,7 +2526,6 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
}
if (mat1 && mat2) {
-#ifdef USE_MATHUTILS_ELEM_MUL
/* MATRIX * MATRIX */
float mat[MATRIX_MAX_DIM * MATRIX_MAX_DIM];
@@ -2540,7 +2539,6 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
mul_vn_vnvn(mat, mat1->matrix, mat2->matrix, mat1->num_col * mat1->num_row);
return Matrix_CreatePyObject(mat, mat2->num_col, mat1->num_row, Py_TYPE(mat1));
-#endif
}
else if (mat2) {
/*FLOAT/INT * MATRIX */
@@ -2584,7 +2582,6 @@ static PyObject *Matrix_imul(PyObject *m1, PyObject *m2)
}
if (mat1 && mat2) {
-#ifdef USE_MATHUTILS_ELEM_MUL
/* MATRIX *= MATRIX */
if ((mat1->num_row != mat2->num_row) || (mat1->num_col != mat2->num_col)) {
PyErr_SetString(PyExc_ValueError,
@@ -2594,14 +2591,6 @@ static PyObject *Matrix_imul(PyObject *m1, PyObject *m2)
}
mul_vn_vn(mat1->matrix, mat2->matrix, mat1->num_col * mat1->num_row);
-#else
- PyErr_Format(PyExc_TypeError,
- "In place element-wise multiplication: "
- "not supported between '%.200s' and '%.200s' types",
- Py_TYPE(m1)->tp_name,
- Py_TYPE(m2)->tp_name);
- return NULL;
-#endif
}
else if (mat1 && (((scalar = PyFloat_AsDouble(m2)) == -1.0f && PyErr_Occurred()) == 0)) {
/* MATRIX *= FLOAT/INT */
diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h
index a0e2256b1ce..588c0b94891 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.h
+++ b/source/blender/python/mathutils/mathutils_Matrix.h
@@ -18,8 +18,7 @@
* \ingroup pymathutils
*/
-#ifndef __MATHUTILS_MATRIX_H__
-#define __MATHUTILS_MATRIX_H__
+#pragma once
extern PyTypeObject matrix_Type;
extern PyTypeObject matrix_access_Type;
@@ -96,5 +95,3 @@ extern struct Mathutils_Callback mathutils_matrix_col_cb;
extern struct Mathutils_Callback mathutils_matrix_translation_cb;
void matrix_as_3x3(float mat[3][3], MatrixObject *self);
-
-#endif /* __MATHUTILS_MATRIX_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 7ce0ea5f249..2b7761b7678 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -962,11 +962,9 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
}
if (quat1 && quat2) { /* QUAT * QUAT (element-wise product) */
-#ifdef USE_MATHUTILS_ELEM_MUL
float quat[QUAT_SIZE];
mul_vn_vnvn(quat, quat1->quat, quat2->quat, QUAT_SIZE);
return Quaternion_CreatePyObject(quat, Py_TYPE(q1));
-#endif
}
/* the only case this can happen (for a supported type is "FLOAT * QUAT") */
else if (quat2) { /* FLOAT * QUAT */
@@ -1007,17 +1005,8 @@ static PyObject *Quaternion_imul(PyObject *q1, PyObject *q2)
}
}
- if (quat1 && quat2) { /* QUAT *= QUAT (inplace element-wise product) */
-#ifdef USE_MATHUTILS_ELEM_MUL
+ if (quat1 && quat2) { /* QUAT *= QUAT (in-place element-wise product). */
mul_vn_vn(quat1->quat, quat2->quat, QUAT_SIZE);
-#else
- PyErr_Format(PyExc_TypeError,
- "In place element-wise multiplication: "
- "not supported between '%.200s' and '%.200s' types",
- Py_TYPE(q1)->tp_name,
- Py_TYPE(q2)->tp_name);
- return NULL;
-#endif
}
else if (quat1 && (((scalar = PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred()) == 0)) {
/* QUAT *= FLOAT */
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h
index bc6bd307ece..7d20558939e 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.h
+++ b/source/blender/python/mathutils/mathutils_Quaternion.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __MATHUTILS_QUATERNION_H__
-#define __MATHUTILS_QUATERNION_H__
+#pragma once
/** \file
* \ingroup pymathutils
@@ -44,5 +43,3 @@ PyObject *Quaternion_CreatePyObject_wrap(float quat[4],
PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user,
unsigned char cb_type,
unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;
-
-#endif /* __MATHUTILS_QUATERNION_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 15ae811fd91..4b47440a530 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -1738,7 +1738,7 @@ static PyObject *vector_mul_float(VectorObject *vec, const float scalar)
mul_vn_vn_fl(tvec, vec->vec, vec->size, scalar);
return Vector_CreatePyObject_alloc(tvec, vec->size, Py_TYPE(vec));
}
-#ifdef USE_MATHUTILS_ELEM_MUL
+
static PyObject *vector_mul_vec(VectorObject *vec1, VectorObject *vec2)
{
float *tvec = PyMem_Malloc(vec1->size * sizeof(float));
@@ -1752,7 +1752,7 @@ static PyObject *vector_mul_vec(VectorObject *vec1, VectorObject *vec2)
mul_vn_vnvn(tvec, vec1->vec, vec2->vec, vec1->size);
return Vector_CreatePyObject_alloc(tvec, vec1->size, Py_TYPE(vec1));
}
-#endif
+
static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
{
VectorObject *vec1 = NULL, *vec2 = NULL;
@@ -1775,7 +1775,6 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
/* make sure v1 is always the vector */
if (vec1 && vec2) {
-#ifdef USE_MATHUTILS_ELEM_MUL
if (vec1->size != vec2->size) {
PyErr_SetString(PyExc_ValueError,
"Vector multiplication: "
@@ -1785,7 +1784,6 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
/* element-wise product */
return vector_mul_vec(vec1, vec2);
-#endif
}
else if (vec1) {
if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* VEC * FLOAT */
@@ -1832,7 +1830,6 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
/* Intentionally don't support (Quaternion, Matrix) here, uses reverse order instead. */
if (vec1 && vec2) {
-#ifdef USE_MATHUTILS_ELEM_MUL
if (vec1->size != vec2->size) {
PyErr_SetString(PyExc_ValueError,
"Vector multiplication: "
@@ -1840,16 +1837,8 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
return NULL;
}
- /* element-wise product inplace */
+ /* Element-wise product in-place. */
mul_vn_vn(vec1->vec, vec2->vec, vec1->size);
-#else
- PyErr_Format(PyExc_TypeError,
- "In place element-wise multiplication: "
- "not supported between '%.200s' and '%.200s' types",
- Py_TYPE(v1)->tp_name,
- Py_TYPE(v2)->tp_name);
- return NULL;
-#endif
}
else if (vec1 && (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) ==
0)) { /* VEC *= FLOAT */
diff --git a/source/blender/python/mathutils/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h
index f75702bc54c..09fc429f9cc 100644
--- a/source/blender/python/mathutils/mathutils_Vector.h
+++ b/source/blender/python/mathutils/mathutils_Vector.h
@@ -18,8 +18,7 @@
* \ingroup pymathutils
*/
-#ifndef __MATHUTILS_VECTOR_H__
-#define __MATHUTILS_VECTOR_H__
+#pragma once
extern PyTypeObject vector_Type;
@@ -48,5 +47,3 @@ PyObject *Vector_CreatePyObject_alloc(float *vec,
const int size,
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL(1);
-
-#endif /* __MATHUTILS_VECTOR_H__ */
diff --git a/source/blender/python/mathutils/mathutils_bvhtree.h b/source/blender/python/mathutils/mathutils_bvhtree.h
index 2991982f3a2..82b09f11e5e 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.h
+++ b/source/blender/python/mathutils/mathutils_bvhtree.h
@@ -18,8 +18,7 @@
* \ingroup mathutils
*/
-#ifndef __MATHUTILS_BVHTREE_H__
-#define __MATHUTILS_BVHTREE_H__
+#pragma once
PyMODINIT_FUNC PyInit_mathutils_bvhtree(void);
@@ -27,5 +26,3 @@ extern PyTypeObject PyBVHTree_Type;
#define PyBVHTree_Check(v) PyObject_TypeCheck((v), &PyBVHTree_Type)
#define PyBVHTree_CheckExact(v) (Py_TYPE(v) == &PyBVHTree_Type)
-
-#endif /* __MATHUTILS_BVHTREE_H__ */
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index 59c0021e0f3..93dbac32c19 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -1537,9 +1537,9 @@ static PyObject *M_Geometry_convex_hull_2d(PyObject *UNUSED(self), PyObject *poi
* to fill values, with start_table and len_table giving the start index
* and length of the toplevel_len sub-lists.
*/
-static PyObject *list_of_lists_from_arrays(int *array,
- int *start_table,
- int *len_table,
+static PyObject *list_of_lists_from_arrays(const int *array,
+ const int *start_table,
+ const int *len_table,
int toplevel_len)
{
PyObject *ret, *sublist;
diff --git a/source/blender/python/mathutils/mathutils_geometry.h b/source/blender/python/mathutils/mathutils_geometry.h
index 5a1198b4a26..4a200ec98ca 100644
--- a/source/blender/python/mathutils/mathutils_geometry.h
+++ b/source/blender/python/mathutils/mathutils_geometry.h
@@ -14,13 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __MATHUTILS_GEOMETRY_H__
-#define __MATHUTILS_GEOMETRY_H__
+#pragma once
/** \file
* \ingroup pymathutils
*/
PyMODINIT_FUNC PyInit_mathutils_geometry(void);
-
-#endif /* __MATHUTILS_GEOMETRY_H__ */
diff --git a/source/blender/python/mathutils/mathutils_interpolate.h b/source/blender/python/mathutils/mathutils_interpolate.h
index 50dee1ee8de..c51d2b6905b 100644
--- a/source/blender/python/mathutils/mathutils_interpolate.h
+++ b/source/blender/python/mathutils/mathutils_interpolate.h
@@ -14,13 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __MATHUTILS_INTERPOLATE_H__
-#define __MATHUTILS_INTERPOLATE_H__
+#pragma once
/** \file
* \ingroup pymathutils
*/
PyMODINIT_FUNC PyInit_mathutils_interpolate(void);
-
-#endif /* __MATHUTILS_INTERPOLATE_H__ */
diff --git a/source/blender/python/mathutils/mathutils_kdtree.h b/source/blender/python/mathutils/mathutils_kdtree.h
index 99411997282..3df3fc8d382 100644
--- a/source/blender/python/mathutils/mathutils_kdtree.h
+++ b/source/blender/python/mathutils/mathutils_kdtree.h
@@ -18,11 +18,8 @@
* \ingroup mathutils
*/
-#ifndef __MATHUTILS_KDTREE_H__
-#define __MATHUTILS_KDTREE_H__
+#pragma once
PyMODINIT_FUNC PyInit_mathutils_kdtree(void);
extern PyTypeObject PyKDTree_Type;
-
-#endif /* __MATHUTILS_KDTREE_H__ */
diff --git a/source/blender/python/mathutils/mathutils_noise.h b/source/blender/python/mathutils/mathutils_noise.h
index 8204c084947..da5e1a99a03 100644
--- a/source/blender/python/mathutils/mathutils_noise.h
+++ b/source/blender/python/mathutils/mathutils_noise.h
@@ -18,9 +18,6 @@
* \ingroup mathutils
*/
-#ifndef __MATHUTILS_NOISE_H__
-#define __MATHUTILS_NOISE_H__
+#pragma once
PyMODINIT_FUNC PyInit_mathutils_noise(void);
-
-#endif /* __MATHUTILS_NOISE_H__ */