Cleanup: format (with BraceWrapping::AfterControlStatement "MultiLine")

This commit is contained in:
Campbell Barton
2023-05-02 08:42:26 +10:00
parent 391f86bc38
commit 6859bb6e67
1314 changed files with 9714 additions and 5571 deletions

View File

@@ -102,7 +102,8 @@ int mathutils_array_parse(
if ((num = VectorObject_Check(value) ? ((VectorObject *)value)->vec_num : 0) ||
(num = EulerObject_Check(value) ? 3 : 0) || (num = QuaternionObject_Check(value) ? 4 : 0) ||
(num = ColorObject_Check(value) ? 3 : 0)) {
(num = ColorObject_Check(value) ? 3 : 0))
{
if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
}
@@ -196,7 +197,8 @@ int mathutils_array_parse_alloc(float **array,
if ((num = VectorObject_Check(value) ? ((VectorObject *)value)->vec_num : 0) ||
(num = EulerObject_Check(value) ? 3 : 0) || (num = QuaternionObject_Check(value) ? 4 : 0) ||
(num = ColorObject_Check(value) ? 3 : 0)) {
(num = ColorObject_Check(value) ? 3 : 0))
{
if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
}

View File

@@ -74,7 +74,8 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
break;
case 1:
if (mathutils_array_parse(
col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()") == -1) {
col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()") == -1)
{
return NULL;
}
break;
@@ -457,7 +458,8 @@ static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq)
begin = MIN2(begin, end);
if ((size = mathutils_array_parse(col, 0, COLOR_SIZE, seq, "mathutils.Color[begin:end] = []")) ==
-1) {
-1)
{
return -1;
}

View File

@@ -280,7 +280,8 @@ static PyObject *Euler_make_compatible(EulerObject *self, PyObject *value)
EULER_SIZE,
EULER_SIZE,
value,
"euler.make_compatible(other), invalid 'other' arg") == -1) {
"euler.make_compatible(other), invalid 'other' arg") == -1)
{
return NULL;
}
@@ -540,7 +541,8 @@ static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq)
begin = MIN2(begin, end);
if ((size = mathutils_array_parse(eul, 0, EULER_SIZE, seq, "mathutils.Euler[begin:end] = []")) ==
-1) {
-1)
{
return -1;
}
@@ -698,7 +700,8 @@ static int Euler_order_set(EulerObject *self, PyObject *value, void *UNUSED(clos
}
if (((order_str = PyUnicode_AsUTF8(value)) == NULL) ||
((order = euler_order_from_string(order_str, "euler.order")) == -1)) {
((order = euler_order_from_string(order_str, "euler.order")) == -1))
{
return -1;
}

View File

@@ -737,7 +737,8 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
float tvec[3];
if (mathutils_array_parse(
tvec, 3, 3, vec, "Matrix.Rotation(angle, size, axis), invalid 'axis' arg") == -1) {
tvec, 3, 3, vec, "Matrix.Rotation(angle, size, axis), invalid 'axis' arg") == -1)
{
return NULL;
}
@@ -775,7 +776,8 @@ static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value)
unit_m4(mat);
if (mathutils_array_parse(
mat[3], 3, 4, value, "mathutils.Matrix.Translation(vector), invalid vector arg") == -1) {
mat[3], 3, 4, value, "mathutils.Matrix.Translation(vector), invalid vector arg") == -1)
{
return NULL;
}
@@ -847,7 +849,8 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
vec_num = (matSize == 2 ? 2 : 3);
if (mathutils_array_parse(
tvec, vec_num, vec_num, vec, "Matrix.Scale(factor, size, axis), invalid 'axis' arg") ==
-1) {
-1)
{
return NULL;
}
}
@@ -980,7 +983,8 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
vec_num,
vec_num,
axis,
"Matrix.OrthoProjection(axis, size), invalid 'axis' arg") == -1) {
"Matrix.OrthoProjection(axis, size), invalid 'axis' arg") == -1)
{
return NULL;
}
@@ -1148,7 +1152,8 @@ static PyObject *C_Matrix_LocRotScale(PyObject *cls, PyObject *args)
zero_v3(loc);
}
else if (mathutils_array_parse(
loc, 3, 3, loc_obj, "Matrix.LocRotScale(), invalid location argument") == -1) {
loc, 3, 3, loc_obj, "Matrix.LocRotScale(), invalid location argument") == -1)
{
return NULL;
}
@@ -1203,7 +1208,8 @@ static PyObject *C_Matrix_LocRotScale(PyObject *cls, PyObject *args)
float scale[3];
if (mathutils_array_parse(
scale, 3, 3, scale_obj, "Matrix.LocRotScale(), invalid scale argument") == -1) {
scale, 3, 3, scale_obj, "Matrix.LocRotScale(), invalid scale argument") == -1)
{
return NULL;
}
@@ -2438,7 +2444,8 @@ static int Matrix_ass_item_row(MatrixObject *self, int row, PyObject *value)
}
if (mathutils_array_parse(
vec, self->col_num, self->col_num, value, "matrix[i] = value assignment") == -1) {
vec, self->col_num, self->col_num, value, "matrix[i] = value assignment") == -1)
{
return -1;
}
@@ -2466,7 +2473,8 @@ static int Matrix_ass_item_col(MatrixObject *self, int col, PyObject *value)
}
if (mathutils_array_parse(
vec, self->row_num, self->row_num, value, "matrix[i] = value assignment") == -1) {
vec, self->row_num, self->row_num, value, "matrix[i] = value assignment") == -1)
{
return -1;
}
@@ -2546,8 +2554,8 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
PyObject *item = value_fast_items[row - begin];
if (mathutils_array_parse(
vec, self->col_num, self->col_num, item, "matrix[begin:end] = value assignment") ==
-1) {
vec, self->col_num, self->col_num, item, "matrix[begin:end] = value assignment") == -1)
{
Py_DECREF(value_fast);
return -1;
}
@@ -3692,8 +3700,8 @@ static PyObject *MatrixAccess_subscript(MatrixAccessObject *self, PyObject *item
if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx(item, MatrixAccess_len(self), &start, &stop, &step, &slicelength) <
0) {
if (PySlice_GetIndicesEx(item, MatrixAccess_len(self), &start, &stop, &step, &slicelength) < 0)
{
return NULL;
}

View File

@@ -54,7 +54,8 @@ static void quat__axis_angle_sanitize(float axis[3], float *angle)
axis[2] = 0.0f;
}
else if (EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
EXPP_FloatsAreEqual(axis[2], 0.0f, 10)) {
EXPP_FloatsAreEqual(axis[2], 0.0f, 10))
{
axis[0] = 1.0f;
}
}
@@ -120,8 +121,8 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
case 1: {
int size;
if ((size = mathutils_array_parse(quat, 3, QUAT_SIZE, seq, "mathutils.Quaternion()")) ==
-1) {
if ((size = mathutils_array_parse(quat, 3, QUAT_SIZE, seq, "mathutils.Quaternion()")) == -1)
{
return NULL;
}
@@ -387,7 +388,8 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
if (mathutils_array_parse(
tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.cross(other), invalid 'other' arg") ==
-1) {
-1)
{
return NULL;
}
@@ -419,8 +421,8 @@ static PyObject *Quaternion_dot(QuaternionObject *self, PyObject *value)
}
if (mathutils_array_parse(
tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.dot(other), invalid 'other' arg") ==
-1) {
tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.dot(other), invalid 'other' arg") == -1)
{
return NULL;
}
@@ -454,7 +456,8 @@ static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject
QUAT_SIZE,
QUAT_SIZE,
value,
"Quaternion.rotation_difference(other), invalid 'other' arg") == -1) {
"Quaternion.rotation_difference(other), invalid 'other' arg") == -1)
{
return NULL;
}
@@ -498,7 +501,8 @@ static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args)
if (mathutils_array_parse(
tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.slerp(other), invalid 'other' arg") ==
-1) {
-1)
{
return NULL;
}
@@ -568,7 +572,8 @@ static PyObject *Quaternion_make_compatible(QuaternionObject *self, PyObject *va
QUAT_SIZE,
QUAT_SIZE,
value,
"Quaternion.make_compatible(other), invalid 'other' arg") == -1) {
"Quaternion.make_compatible(other), invalid 'other' arg") == -1)
{
return NULL;
}
@@ -987,7 +992,8 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb
begin = MIN2(begin, end);
if ((size = mathutils_array_parse(
quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1) {
quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1)
{
return -1;
}

View File

@@ -158,7 +158,8 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
break;
case 1:
if ((vec_num = mathutils_array_parse_alloc(
&vec, 2, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1) {
&vec, 2, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1)
{
return NULL;
}
break;
@@ -360,7 +361,8 @@ static PyObject *C_Vector_Repeat(PyObject *cls, PyObject *args)
}
if ((value_num = mathutils_array_parse_alloc(
&iter_vec, 2, value, "Vector.Repeat(vector, vec_num), invalid 'vector' arg")) == -1) {
&iter_vec, 2, value, "Vector.Repeat(vector, vec_num), invalid 'vector' arg")) == -1)
{
return NULL;
}
@@ -947,7 +949,8 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value)
}
if ((value_num = mathutils_array_parse(
tvec, 2, 4, value, "Vector.reflect(other), invalid 'other' arg")) == -1) {
tvec, 2, 4, value, "Vector.reflect(other), invalid 'other' arg")) == -1)
{
return NULL;
}
@@ -1003,7 +1006,8 @@ static PyObject *Vector_cross(VectorObject *self, PyObject *value)
if (mathutils_array_parse(
tvec, self->vec_num, self->vec_num, value, "Vector.cross(other), invalid 'other' arg") ==
-1) {
-1)
{
return NULL;
}
@@ -1043,7 +1047,8 @@ static PyObject *Vector_dot(VectorObject *self, PyObject *value)
}
if (mathutils_array_parse_alloc(
&tvec, self->vec_num, value, "Vector.dot(other), invalid 'other' arg") == -1) {
&tvec, self->vec_num, value, "Vector.dot(other), invalid 'other' arg") == -1)
{
return NULL;
}
@@ -1092,7 +1097,8 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
* even though n this case 'w' is ignored */
if (mathutils_array_parse(
tvec, self->vec_num, self->vec_num, value, "Vector.angle(other), invalid 'other' arg") ==
-1) {
-1)
{
return NULL;
}
@@ -1158,7 +1164,8 @@ static PyObject *Vector_angle_signed(VectorObject *self, PyObject *args)
}
if (mathutils_array_parse(
tvec, 2, 2, value, "Vector.angle_signed(other), invalid 'other' arg") == -1) {
tvec, 2, 2, value, "Vector.angle_signed(other), invalid 'other' arg") == -1)
{
return NULL;
}
@@ -1217,8 +1224,8 @@ static PyObject *Vector_rotation_difference(VectorObject *self, PyObject *value)
}
if (mathutils_array_parse(
vec_b, 3, MAX_DIMENSIONS, value, "Vector.difference(other), invalid 'other' arg") ==
-1) {
vec_b, 3, MAX_DIMENSIONS, value, "Vector.difference(other), invalid 'other' arg") == -1)
{
return NULL;
}
@@ -1257,7 +1264,8 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value)
}
if (mathutils_array_parse_alloc(
&tvec, vec_num, value, "Vector.project(other), invalid 'other' arg") == -1) {
&tvec, vec_num, value, "Vector.project(other), invalid 'other' arg") == -1)
{
return NULL;
}
@@ -1307,7 +1315,8 @@ static PyObject *Vector_lerp(VectorObject *self, PyObject *args)
}
if (mathutils_array_parse_alloc(
&tvec, vec_num, value, "Vector.lerp(other), invalid 'other' arg") == -1) {
&tvec, vec_num, value, "Vector.lerp(other), invalid 'other' arg") == -1)
{
return NULL;
}
@@ -1361,7 +1370,8 @@ static PyObject *Vector_slerp(VectorObject *self, PyObject *args)
}
if (mathutils_array_parse(
other_vec, vec_num, vec_num, value, "Vector.slerp(other), invalid 'other' arg") == -1) {
other_vec, vec_num, vec_num, value, "Vector.slerp(other), invalid 'other' arg") == -1)
{
return NULL;
}
@@ -2193,8 +2203,8 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
/* Element-wise product in-place. */
mul_vn_vn(vec1->vec, vec2->vec, vec1->vec_num);
}
else if (vec1 && (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) ==
0)) { /* VEC *= FLOAT */
else if (vec1 && (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0))
{ /* VEC *= FLOAT */
mul_vn_fl(vec1->vec, vec1->vec_num, scalar);
}
else {
@@ -2682,7 +2692,8 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
}
else if ((void)PyErr_Clear(), /* run but ignore the result */
(size_from = (size_t)mathutils_array_parse(
vec_assign, 2, 4, value, "Vector.**** = swizzle assignment")) == (size_t)-1) {
vec_assign, 2, 4, value, "Vector.**** = swizzle assignment")) == (size_t)-1)
{
return -1;
}

View File

@@ -341,8 +341,8 @@ static PyObject *py_bvhtree_ray_cast(PyBVHTree *self, PyObject *args)
}
if ((mathutils_array_parse(co, 2, 3 | MU_ARRAY_ZERO, py_co, error_prefix) == -1) ||
(mathutils_array_parse(direction, 2, 3 | MU_ARRAY_ZERO, py_direction, error_prefix) ==
-1)) {
(mathutils_array_parse(direction, 2, 3 | MU_ARRAY_ZERO, py_direction, error_prefix) == -1))
{
return nullptr;
}
@@ -668,12 +668,14 @@ static PyObject *C_BVHTree_FromPolygons(PyObject * /*cls*/, PyObject *args, PyOb
&py_tris,
PyC_ParseBool,
&all_triangles,
&epsilon)) {
&epsilon))
{
return nullptr;
}
if (!(py_coords_fast = PySequence_Fast(py_coords, error_prefix)) ||
!(py_tris_fast = PySequence_Fast(py_tris, error_prefix))) {
!(py_tris_fast = PySequence_Fast(py_tris, error_prefix)))
{
Py_XDECREF(py_coords_fast);
return nullptr;
}
@@ -940,7 +942,8 @@ static PyObject *C_BVHTree_FromBMesh(PyObject * /*cls*/, PyObject *args, PyObjec
(char **)keywords,
&BPy_BMesh_Type,
&py_bm,
&epsilon)) {
&epsilon))
{
return nullptr;
}
@@ -1125,7 +1128,8 @@ static PyObject *C_BVHTree_FromObject(PyObject * /*cls*/, PyObject *args, PyObje
&epsilon) ||
((ob = static_cast<Object *>(PyC_RNA_AsPointer(py_ob, "Object"))) == nullptr) ||
((depsgraph = static_cast<Depsgraph *>(PyC_RNA_AsPointer(py_depsgraph, "Depsgraph"))) ==
nullptr)) {
nullptr))
{
return nullptr;
}

View File

@@ -67,20 +67,23 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject *
&py_ray,
&py_ray_off,
PyC_ParseBool,
&clip)) {
&clip))
{
return NULL;
}
if (((mathutils_array_parse(dir, 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_ray, error_prefix) !=
-1) &&
(mathutils_array_parse(
orig, 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_ray_off, error_prefix) != -1)) == 0) {
orig, 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_ray_off, error_prefix) != -1)) == 0)
{
return NULL;
}
for (i = 0; i < ARRAY_SIZE(tri); i++) {
if (mathutils_array_parse(
tri[i], 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_tri[i], error_prefix) == -1) {
tri[i], 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_tri[i], error_prefix) == -1)
{
return NULL;
}
}
@@ -181,7 +184,8 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
ix_vec_num,
ix_vec_num | MU_ARRAY_SPILL | MU_ARRAY_ZERO,
py_lines[3],
error_prefix) != -1)) == 0) {
error_prefix) != -1)) == 0)
{
return NULL;
}
@@ -238,13 +242,14 @@ static PyObject *M_Geometry_intersect_sphere_sphere_2d(PyObject *UNUSED(self), P
float v_ab[2];
float dist;
if (!PyArg_ParseTuple(
args, "OfOf:intersect_sphere_sphere_2d", &py_v_a, &rad_a, &py_v_b, &rad_b)) {
if (!PyArg_ParseTuple(args, "OfOf:intersect_sphere_sphere_2d", &py_v_a, &rad_a, &py_v_b, &rad_b))
{
return NULL;
}
if (((mathutils_array_parse(v_a, 2, 2, py_v_a, error_prefix) != -1) &&
(mathutils_array_parse(v_b, 2, 2, py_v_b, error_prefix) != -1)) == 0) {
(mathutils_array_parse(v_b, 2, 2, py_v_b, error_prefix) != -1)) == 0)
{
return NULL;
}
@@ -258,7 +263,8 @@ static PyObject *M_Geometry_intersect_sphere_sphere_2d(PyObject *UNUSED(self), P
/* fully-contained in the other */
(dist < fabsf(rad_a - rad_b)) ||
/* co-incident */
(dist < FLT_EPSILON)) {
(dist < FLT_EPSILON))
{
/* out of range */
PyTuple_SET_ITEMS(ret, Py_INCREF_RET(Py_None), Py_INCREF_RET(Py_None));
}
@@ -302,14 +308,16 @@ static PyObject *M_Geometry_intersect_tri_tri_2d(PyObject *UNUSED(self), PyObjec
&tri_pair_py[0][2],
&tri_pair_py[1][0],
&tri_pair_py[1][1],
&tri_pair_py[1][2])) {
&tri_pair_py[1][2]))
{
return NULL;
}
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) {
if (mathutils_array_parse(
tri_pair[i][j], 2, 2 | MU_ARRAY_SPILL, tri_pair_py[i][j], error_prefix) == -1) {
tri_pair[i][j], 2, 2 | MU_ARRAY_SPILL, tri_pair_py[i][j], error_prefix) == -1)
{
return NULL;
}
}
@@ -340,7 +348,8 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject *args)
}
if ((coords_len = mathutils_array_parse_alloc_v(
(float **)&coords, 3 | MU_ARRAY_SPILL, args, "normal")) == -1) {
(float **)&coords, 3 | MU_ARRAY_SPILL, args, "normal")) == -1)
{
return NULL;
}
@@ -384,7 +393,8 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject *args)
if ((((len = mathutils_array_parse(tri[0], 2, 3, py_tri[0], error_prefix)) != -1) &&
(mathutils_array_parse(tri[1], len, len, py_tri[1], error_prefix) != -1) &&
(mathutils_array_parse(tri[2], len, len, py_tri[2], error_prefix) != -1)) == 0) {
(mathutils_array_parse(tri[2], len, len, py_tri[2], error_prefix) != -1)) == 0)
{
return NULL;
}
@@ -501,7 +511,8 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
&py_plane_co,
&py_plane_no,
PyC_ParseBool,
&no_flip)) {
&no_flip))
{
return NULL;
}
@@ -509,7 +520,8 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
(mathutils_array_parse(line_b, 3, 3 | MU_ARRAY_SPILL, py_line_b, error_prefix) != -1) &&
(mathutils_array_parse(plane_co, 3, 3 | MU_ARRAY_SPILL, py_plane_co, error_prefix) != -1) &&
(mathutils_array_parse(plane_no, 3, 3 | MU_ARRAY_SPILL, py_plane_no, error_prefix) !=
-1)) == 0) {
-1)) == 0)
{
return NULL;
}
@@ -554,7 +566,8 @@ static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObje
&py_plane_a_co,
&py_plane_a_no,
&py_plane_b_co,
&py_plane_b_no)) {
&py_plane_b_no))
{
return NULL;
}
@@ -565,7 +578,8 @@ static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObje
(mathutils_array_parse(plane_b_co, 3, 3 | MU_ARRAY_SPILL, py_plane_b_co, error_prefix) !=
-1) &&
(mathutils_array_parse(plane_b_no, 3, 3 | MU_ARRAY_SPILL, py_plane_b_no, error_prefix) !=
-1)) == 0) {
-1)) == 0)
{
return NULL;
}
@@ -624,14 +638,16 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
&py_sphere_co,
&sphere_radius,
PyC_ParseBool,
&clip)) {
&clip))
{
return NULL;
}
if (((mathutils_array_parse(line_a, 3, 3 | MU_ARRAY_SPILL, py_line_a, error_prefix) != -1) &&
(mathutils_array_parse(line_b, 3, 3 | MU_ARRAY_SPILL, py_line_b, error_prefix) != -1) &&
(mathutils_array_parse(sphere_co, 3, 3 | MU_ARRAY_SPILL, py_sphere_co, error_prefix) !=
-1)) == 0) {
-1)) == 0)
{
return NULL;
}
@@ -644,18 +660,21 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
switch (isect_line_sphere_v3(line_a, line_b, sphere_co, sphere_radius, isect_a, isect_b)) {
case 1:
if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a, line_b)) >= 0.0f) &&
(lambda <= 1.0f)))) {
(lambda <= 1.0f))))
{
use_a = false;
}
use_b = false;
break;
case 2:
if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a, line_b)) >= 0.0f) &&
(lambda <= 1.0f)))) {
(lambda <= 1.0f))))
{
use_a = false;
}
if (!(!clip || (((lambda = line_point_factor_v3(isect_b, line_a, line_b)) >= 0.0f) &&
(lambda <= 1.0f)))) {
(lambda <= 1.0f))))
{
use_b = false;
}
break;
@@ -709,14 +728,16 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
&py_sphere_co,
&sphere_radius,
PyC_ParseBool,
&clip)) {
&clip))
{
return NULL;
}
if (((mathutils_array_parse(line_a, 2, 2 | MU_ARRAY_SPILL, py_line_a, error_prefix) != -1) &&
(mathutils_array_parse(line_b, 2, 2 | MU_ARRAY_SPILL, py_line_b, error_prefix) != -1) &&
(mathutils_array_parse(sphere_co, 2, 2 | MU_ARRAY_SPILL, py_sphere_co, error_prefix) !=
-1)) == 0) {
-1)) == 0)
{
return NULL;
}
@@ -729,18 +750,21 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
switch (isect_line_sphere_v2(line_a, line_b, sphere_co, sphere_radius, isect_a, isect_b)) {
case 1:
if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a, line_b)) >= 0.0f) &&
(lambda <= 1.0f)))) {
(lambda <= 1.0f))))
{
use_a = false;
}
use_b = false;
break;
case 2:
if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a, line_b)) >= 0.0f) &&
(lambda <= 1.0f)))) {
(lambda <= 1.0f))))
{
use_a = false;
}
if (!(!clip || (((lambda = line_point_factor_v2(isect_b, line_a, line_b)) >= 0.0f) &&
(lambda <= 1.0f)))) {
(lambda <= 1.0f))))
{
use_b = false;
}
break;
@@ -790,7 +814,8 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
(mathutils_array_parse(
line_a, 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_line_a, error_prefix) != -1) &&
(mathutils_array_parse(
line_b, 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_line_b, error_prefix) != -1)) == 0) {
line_b, 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_line_b, error_prefix) != -1)) == 0)
{
return NULL;
}
@@ -830,13 +855,14 @@ static PyObject *M_Geometry_intersect_point_tri(PyObject *UNUSED(self), PyObject
return NULL;
}
if (mathutils_array_parse(pt, 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_pt, error_prefix) ==
-1) {
if (mathutils_array_parse(pt, 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_pt, error_prefix) == -1)
{
return NULL;
}
for (i = 0; i < ARRAY_SIZE(tri); i++) {
if (mathutils_array_parse(
tri[i], 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_tri[i], error_prefix) == -1) {
tri[i], 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_tri[i], error_prefix) == -1)
{
return NULL;
}
}
@@ -875,13 +901,14 @@ static PyObject *M_Geometry_closest_point_on_tri(PyObject *UNUSED(self), PyObjec
return NULL;
}
if (mathutils_array_parse(pt, 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_pt, error_prefix) ==
-1) {
if (mathutils_array_parse(pt, 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_pt, error_prefix) == -1)
{
return NULL;
}
for (i = 0; i < ARRAY_SIZE(tri); i++) {
if (mathutils_array_parse(
tri[i], 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_tri[i], error_prefix) == -1) {
tri[i], 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_tri[i], error_prefix) == -1)
{
return NULL;
}
}
@@ -1000,7 +1027,8 @@ static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyOb
if (((mathutils_array_parse(pt, 3, 3 | MU_ARRAY_SPILL, py_pt, error_prefix) != -1) &&
(mathutils_array_parse(plane_co, 3, 3 | MU_ARRAY_SPILL, py_plane_co, error_prefix) != -1) &&
(mathutils_array_parse(plane_no, 3, 3 | MU_ARRAY_SPILL, py_plane_no, error_prefix) !=
-1)) == 0) {
-1)) == 0)
{
return NULL;
}
@@ -1041,7 +1069,8 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje
"OOOOOOO:barycentric_transform",
&py_pt_src,
UNPACK3_EX(&, py_tri_src, ),
UNPACK3_EX(&, py_tri_dst, ))) {
UNPACK3_EX(&, py_tri_dst, )))
{
return NULL;
}
@@ -1052,7 +1081,8 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje
if (((mathutils_array_parse(tri_src[i], 3, 3 | MU_ARRAY_SPILL, py_tri_src[i], error_prefix) !=
-1) &&
(mathutils_array_parse(tri_dst[i], 3, 3 | MU_ARRAY_SPILL, py_tri_dst[i], error_prefix) !=
-1)) == 0) {
-1)) == 0)
{
return NULL;
}
}
@@ -1098,7 +1128,8 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a
}
if ((planes_len = mathutils_array_parse_alloc_v(
(float **)&planes, 4, py_planes, "points_in_planes")) == -1) {
(float **)&planes, 4, py_planes, "points_in_planes")) == -1)
{
return NULL;
}
@@ -1175,7 +1206,8 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject
for (i = 0; i < 4; i++) {
int dims_tmp;
if ((dims_tmp = mathutils_array_parse(
data[i], 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_data[i], error_prefix)) == -1) {
data[i], 2, 3 | MU_ARRAY_SPILL | MU_ARRAY_ZERO, py_data[i], error_prefix)) == -1)
{
return NULL;
}
dims = max_ii(dims, dims_tmp);
@@ -1597,7 +1629,8 @@ static PyObject *M_Geometry_delaunay_2d_cdt(PyObject *UNUSED(self), PyObject *ar
&faces,
&output_type,
&epsilon,
&need_ids)) {
&need_ids))
{
return NULL;
}

View File

@@ -45,7 +45,8 @@ static PyObject *M_Interpolate_poly_3d_calc(PyObject *UNUSED(self), PyObject *ar
}
if (mathutils_array_parse(
fp, 2, 3 | MU_ARRAY_ZERO, point, "pt must be a 2-3 dimensional vector") == -1) {
fp, 2, 3 | MU_ARRAY_ZERO, point, "pt must be a 2-3 dimensional vector") == -1)
{
return NULL;
}

View File

@@ -320,7 +320,8 @@ static PyObject *py_kdtree_find_range(PyKDTree *self, PyObject *args, PyObject *
const char *keywords[] = {"co", "radius", NULL};
if (!PyArg_ParseTupleAndKeywords(
args, kwargs, "Of:find_range", (char **)keywords, &py_co, &radius)) {
args, kwargs, "Of:find_range", (char **)keywords, &py_co, &radius))
{
return NULL;
}

View File

@@ -307,8 +307,8 @@ static PyObject *M_Noise_random_unit_vector(PyObject *UNUSED(self), PyObject *ar
float norm = 2.0f;
int vec_num = 3;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "|$i:random_unit_vector", (char **)kwlist, &vec_num)) {
if (!PyArg_ParseTupleAndKeywords(args, kw, "|$i:random_unit_vector", (char **)kwlist, &vec_num))
{
return NULL;
}
@@ -392,7 +392,8 @@ static PyObject *M_Noise_noise(PyObject *UNUSED(self), PyObject *args, PyObject
int noise_basis_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "O|$s:noise", (char **)kwlist, &value, &noise_basis_str)) {
args, kw, "O|$s:noise", (char **)kwlist, &value, &noise_basis_str))
{
return NULL;
}
@@ -400,7 +401,8 @@ static PyObject *M_Noise_noise(PyObject *UNUSED(self), PyObject *args, PyObject
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_basis_str, &noise_basis_enum, "noise") ==
-1) {
-1)
{
return NULL;
}
@@ -431,7 +433,8 @@ static PyObject *M_Noise_noise_vector(PyObject *UNUSED(self), PyObject *args, Py
int noise_basis_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "O|$s:noise_vector", (char **)kwlist, &value, &noise_basis_str)) {
args, kw, "O|$s:noise_vector", (char **)kwlist, &value, &noise_basis_str))
{
return NULL;
}
@@ -439,7 +442,8 @@ static PyObject *M_Noise_noise_vector(PyObject *UNUSED(self), PyObject *args, Py
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "noise_vector") == -1) {
bpy_noise_types, noise_basis_str, &noise_basis_enum, "noise_vector") == -1)
{
return NULL;
}
@@ -490,7 +494,8 @@ static PyObject *M_Noise_turbulence(PyObject *UNUSED(self), PyObject *args, PyOb
&hd,
&noise_basis_str,
&as,
&fs)) {
&fs))
{
return NULL;
}
@@ -498,7 +503,8 @@ static PyObject *M_Noise_turbulence(PyObject *UNUSED(self), PyObject *args, PyOb
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "turbulence") == -1) {
bpy_noise_types, noise_basis_str, &noise_basis_enum, "turbulence") == -1)
{
return NULL;
}
@@ -547,7 +553,8 @@ static PyObject *M_Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *arg
&hd,
&noise_basis_str,
&as,
&fs)) {
&fs))
{
return NULL;
}
@@ -555,7 +562,8 @@ static PyObject *M_Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *arg
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "turbulence_vector") == -1) {
bpy_noise_types, noise_basis_str, &noise_basis_enum, "turbulence_vector") == -1)
{
return NULL;
}
@@ -595,15 +603,9 @@ static PyObject *M_Noise_fractal(PyObject *UNUSED(self), PyObject *args, PyObjec
float H, lac, oct;
int noise_basis_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(args,
kw,
"Offf|$s:fractal",
(char **)kwlist,
&value,
&H,
&lac,
&oct,
&noise_basis_str)) {
if (!PyArg_ParseTupleAndKeywords(
args, kw, "Offf|$s:fractal", (char **)kwlist, &value, &H, &lac, &oct, &noise_basis_str))
{
return NULL;
}
@@ -611,7 +613,8 @@ static PyObject *M_Noise_fractal(PyObject *UNUSED(self), PyObject *args, PyObjec
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "fractal") == -1) {
bpy_noise_types, noise_basis_str, &noise_basis_enum, "fractal") == -1)
{
return NULL;
}
@@ -657,7 +660,8 @@ static PyObject *M_Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args, P
&H,
&lac,
&oct,
&noise_basis_str)) {
&noise_basis_str))
{
return NULL;
}
@@ -665,7 +669,8 @@ static PyObject *M_Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args, P
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "multi_fractal") == -1) {
bpy_noise_types, noise_basis_str, &noise_basis_enum, "multi_fractal") == -1)
{
return NULL;
}
@@ -716,7 +721,8 @@ static PyObject *M_Noise_variable_lacunarity(PyObject *UNUSED(self), PyObject *a
&value,
&d,
&noise_type1_str,
&noise_type2_str)) {
&noise_type2_str))
{
return NULL;
}
@@ -724,7 +730,8 @@ static PyObject *M_Noise_variable_lacunarity(PyObject *UNUSED(self), PyObject *a
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_type1_str, &noise_type1_enum, "variable_lacunarity") == -1) {
bpy_noise_types, noise_type1_str, &noise_type1_enum, "variable_lacunarity") == -1)
{
return NULL;
}
@@ -732,12 +739,13 @@ static PyObject *M_Noise_variable_lacunarity(PyObject *UNUSED(self), PyObject *a
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_type2_str, &noise_type2_enum, "variable_lacunarity") == -1) {
bpy_noise_types, noise_type2_str, &noise_type2_enum, "variable_lacunarity") == -1)
{
return NULL;
}
if (mathutils_array_parse(vec, 3, 3, value, "variable_lacunarity: invalid 'position' arg") ==
-1) {
if (mathutils_array_parse(vec, 3, 3, value, "variable_lacunarity: invalid 'position' arg") == -1)
{
return NULL;
}
@@ -782,7 +790,8 @@ static PyObject *M_Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args,
&lac,
&oct,
&ofs,
&noise_basis_str)) {
&noise_basis_str))
{
return NULL;
}
@@ -790,7 +799,8 @@ static PyObject *M_Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args,
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "hetero_terrain") == -1) {
bpy_noise_types, noise_basis_str, &noise_basis_enum, "hetero_terrain") == -1)
{
return NULL;
}
@@ -842,7 +852,8 @@ static PyObject *M_Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *
&oct,
&ofs,
&gn,
&noise_basis_str)) {
&noise_basis_str))
{
return NULL;
}
@@ -850,8 +861,8 @@ static PyObject *M_Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "hybrid_multi_fractal") ==
-1) {
bpy_noise_types, noise_basis_str, &noise_basis_enum, "hybrid_multi_fractal") == -1)
{
return NULL;
}
@@ -904,7 +915,8 @@ static PyObject *M_Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *
&oct,
&ofs,
&gn,
&noise_basis_str)) {
&noise_basis_str))
{
return NULL;
}
@@ -912,8 +924,8 @@ static PyObject *M_Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *
/* pass through */
}
else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "ridged_multi_fractal") ==
-1) {
bpy_noise_types, noise_basis_str, &noise_basis_enum, "ridged_multi_fractal") == -1)
{
return NULL;
}
@@ -952,7 +964,8 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args, PyObjec
int i;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "O|$sf:voronoi", (char **)kwlist, &value, &metric_str, &me)) {
args, kw, "O|$sf:voronoi", (char **)kwlist, &value, &metric_str, &me))
{
return NULL;
}