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

@@ -47,7 +47,8 @@ static PyObject *bpy_bm_new(PyObject *UNUSED(self), PyObject *args, PyObject *kw
bool use_operators = true;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "|$O&:new", (char **)kwlist, PyC_ParseBool, &use_operators)) {
args, kw, "|$O&:new", (char **)kwlist, PyC_ParseBool, &use_operators))
{
return NULL;
}
@@ -115,7 +116,8 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
PyC_ParseBool,
&do_loop_triangles,
PyC_ParseBool,
&is_destructive)) {
&is_destructive))
{
return NULL;
}

View File

@@ -259,7 +259,8 @@ static int bpy_slot_from_py(BMesh *bm,
(slot->slot_subtype.elem & BM_ALL_NOLOOP),
opname,
slot_name,
"single element") == -1) {
"single element") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
@@ -283,7 +284,8 @@ static int bpy_slot_from_py(BMesh *bm,
(slot->slot_subtype.elem & BM_ALL_NOLOOP),
opname,
slot_name,
"element buffer") == -1) {
"element buffer") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
@@ -296,7 +298,8 @@ static int bpy_slot_from_py(BMesh *bm,
(slot->slot_subtype.elem & BM_ALL_NOLOOP),
opname,
slot_name,
"element buffer") == -1) {
"element buffer") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
@@ -309,7 +312,8 @@ static int bpy_slot_from_py(BMesh *bm,
(slot->slot_subtype.elem & BM_ALL_NOLOOP),
opname,
slot_name,
"element buffer") == -1) {
"element buffer") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
BMO_slot_buffer_from_all(bm, bmop, bmop->slots_in, slot_name, BM_FACE);
@@ -328,7 +332,8 @@ static int bpy_slot_from_py(BMesh *bm,
(slot->slot_subtype.elem & BM_ALL_NOLOOP),
opname,
slot_name,
"element buffer") == -1) {
"element buffer") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
@@ -417,7 +422,8 @@ static int bpy_slot_from_py(BMesh *bm,
BM_ALL_NOLOOP,
opname,
slot_name,
"invalid key in dict") == -1) {
"invalid key in dict") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
@@ -426,7 +432,8 @@ static int bpy_slot_from_py(BMesh *bm,
BM_ALL_NOLOOP,
opname,
slot_name,
"invalid value in dict") == -1) {
"invalid value in dict") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
@@ -448,7 +455,8 @@ static int bpy_slot_from_py(BMesh *bm,
BM_ALL_NOLOOP,
opname,
slot_name,
"invalid key in dict") == -1) {
"invalid key in dict") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
@@ -481,7 +489,8 @@ static int bpy_slot_from_py(BMesh *bm,
BM_ALL_NOLOOP,
opname,
slot_name,
"invalid key in dict") == -1) {
"invalid key in dict") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
@@ -514,7 +523,8 @@ static int bpy_slot_from_py(BMesh *bm,
BM_ALL_NOLOOP,
opname,
slot_name,
"invalid key in dict") == -1) {
"invalid key in dict") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
@@ -547,7 +557,8 @@ static int bpy_slot_from_py(BMesh *bm,
BM_ALL_NOLOOP,
opname,
slot_name,
"invalid key in set") == -1) {
"invalid key in set") == -1)
{
return -1; /* error is set in bpy_slot_from_py_elem_check() */
}
@@ -738,7 +749,8 @@ PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
BMOperator bmop;
if ((PyTuple_GET_SIZE(args) == 1) && (py_bm = (BPy_BMesh *)PyTuple_GET_ITEM(args, 0)) &&
BPy_BMesh_Check(py_bm)) {
BPy_BMesh_Check(py_bm))
{
BPY_BM_CHECK_OBJ(py_bm);
bm = py_bm->bm;

View File

@@ -274,7 +274,8 @@ static int bpy_bmesh_select_mode_set(BPy_BMesh *self, PyObject *value)
BPY_BM_CHECK_INT(self);
if (PyC_FlagSet_ToBitfield(bpy_bm_scene_vert_edge_face_flags, value, &flag, "bm.select_mode") ==
-1) {
-1)
{
return -1;
}
if (flag == 0) {
@@ -1018,8 +1019,8 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
BPY_BM_CHECK_OBJ(self);
if (!PyArg_ParseTuple(args, "O:to_mesh", &py_mesh) ||
!(me = PyC_RNA_AsPointer(py_mesh, "Mesh"))) {
if (!PyArg_ParseTuple(args, "O:to_mesh", &py_mesh) || !(me = PyC_RNA_AsPointer(py_mesh, "Mesh")))
{
return NULL;
}
@@ -1100,7 +1101,8 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
PyC_ParseBool,
&use_vert_normal) ||
!(ob = PyC_RNA_AsPointer(py_object, "Object")) ||
!(depsgraph = PyC_RNA_AsPointer(py_depsgraph, "Depsgraph"))) {
!(depsgraph = PyC_RNA_AsPointer(py_depsgraph, "Depsgraph")))
{
return NULL;
}
@@ -1206,7 +1208,8 @@ static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *
PyC_ParseBool,
&use_shape_key,
&shape_key_index) ||
!(me = PyC_RNA_AsPointer(py_mesh, "Mesh"))) {
!(me = PyC_RNA_AsPointer(py_mesh, "Mesh")))
{
return NULL;
}
@@ -1303,14 +1306,9 @@ static PyObject *bpy_bmesh_transform(BPy_BMElem *self, PyObject *args, PyObject
BPY_BM_CHECK_OBJ(self);
if (!PyArg_ParseTupleAndKeywords(args,
kw,
"O!|$O!:transform",
(char **)kwlist,
&matrix_Type,
&mat,
&PySet_Type,
&filter)) {
if (!PyArg_ParseTupleAndKeywords(
args, kw, "O!|$O!:transform", (char **)kwlist, &matrix_Type, &mat, &PySet_Type, &filter))
{
return NULL;
}
@@ -1326,8 +1324,9 @@ static PyObject *bpy_bmesh_transform(BPy_BMElem *self, PyObject *args, PyObject
return NULL;
}
if (filter != NULL && PyC_FlagSet_ToBitfield(
bpy_bm_hflag_all_flags, filter, &filter_flags, "bm.transform") == -1) {
if (filter != NULL &&
PyC_FlagSet_ToBitfield(bpy_bm_hflag_all_flags, filter, &filter_flags, "bm.transform") == -1)
{
return NULL;
}
@@ -1367,7 +1366,8 @@ static PyObject *bpy_bmesh_calc_volume(BPy_BMElem *self, PyObject *args, PyObjec
BPY_BM_CHECK_OBJ(self);
if (!PyArg_ParseTupleAndKeywords(
args, kw, "|$O!:calc_volume", (char **)kwlist, &PyBool_Type, &is_signed)) {
args, kw, "|$O!:calc_volume", (char **)kwlist, &PyBool_Type, &is_signed))
{
return NULL;
}
@@ -1832,7 +1832,8 @@ static PyObject *bpy_bmface_copy_from_face_interp(BPy_BMFace *self, PyObject *ar
&BPy_BMFace_Type,
&py_face,
PyC_ParseBool,
&do_vertex)) {
&do_vertex))
{
return NULL;
}
@@ -1874,7 +1875,8 @@ static PyObject *bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw)
PyC_ParseBool,
&do_verts,
PyC_ParseBool,
&do_edges)) {
&do_edges))
{
return NULL;
}
@@ -2087,7 +2089,8 @@ static PyObject *bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *ar
PyC_ParseBool,
&do_vertex,
PyC_ParseBool,
&do_multires)) {
&do_multires))
{
return NULL;
}
@@ -2670,7 +2673,8 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec
(char **)kwlist,
&keyfunc,
PyC_ParseBool,
&do_reverse)) {
&do_reverse))
{
return NULL;
}
}

View File

@@ -203,8 +203,8 @@ int bpy_bm_generic_valid_check_source(BMesh *bm_source,
#define BPY_BM_CHECK_SOURCE_OBJ(bm, errmsg, ...) \
{ \
void *_args[] = {__VA_ARGS__}; \
if (UNLIKELY(bpy_bm_generic_valid_check_source(bm, errmsg, _args, ARRAY_SIZE(_args)) == \
-1)) { \
if (UNLIKELY(bpy_bm_generic_valid_check_source(bm, errmsg, _args, ARRAY_SIZE(_args)) == -1)) \
{ \
return NULL; \
} \
} \
@@ -212,8 +212,8 @@ int bpy_bm_generic_valid_check_source(BMesh *bm_source,
#define BPY_BM_CHECK_SOURCE_INT(bm, errmsg, ...) \
{ \
void *_args[] = {__VA_ARGS__}; \
if (UNLIKELY(bpy_bm_generic_valid_check_source(bm, errmsg, _args, ARRAY_SIZE(_args)) == \
-1)) { \
if (UNLIKELY(bpy_bm_generic_valid_check_source(bm, errmsg, _args, ARRAY_SIZE(_args)) == -1)) \
{ \
return -1; \
} \
} \

View File

@@ -1266,8 +1266,8 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
}
case CD_SHAPEKEY: {
float tmp_val[3];
if (UNLIKELY(mathutils_array_parse(tmp_val, 3, 3, py_value, "BMVert[shape] = value") ==
-1)) {
if (UNLIKELY(mathutils_array_parse(tmp_val, 3, 3, py_value, "BMVert[shape] = value") == -1))
{
ret = -1;
}
else {

View File

@@ -43,12 +43,9 @@ static PyObject *bpy_bm_utils_vert_collapse_edge(PyObject *UNUSED(self), PyObjec
BMesh *bm;
BMEdge *e_new = NULL;
if (!PyArg_ParseTuple(args,
"O!O!:vert_collapse_edge",
&BPy_BMVert_Type,
&py_vert,
&BPy_BMEdge_Type,
&py_edge)) {
if (!PyArg_ParseTuple(
args, "O!O!:vert_collapse_edge", &BPy_BMVert_Type, &py_vert, &BPy_BMEdge_Type, &py_edge))
{
return NULL;
}
@@ -116,7 +113,8 @@ static PyObject *bpy_bm_utils_vert_collapse_faces(PyObject *UNUSED(self), PyObje
&BPy_BMEdge_Type,
&py_edge,
&fac,
&do_join_faces)) {
&do_join_faces))
{
return NULL;
}
@@ -196,12 +194,9 @@ static PyObject *bpy_bm_utils_vert_splice(PyObject *UNUSED(self), PyObject *args
bool ok;
if (!PyArg_ParseTuple(args,
"O!O!:vert_splice",
&BPy_BMVert_Type,
&py_vert,
&BPy_BMVert_Type,
&py_vert_target)) {
if (!PyArg_ParseTuple(
args, "O!O!:vert_splice", &BPy_BMVert_Type, &py_vert, &BPy_BMVert_Type, &py_vert_target))
{
return NULL;
}
@@ -315,13 +310,9 @@ static PyObject *bpy_bm_utils_edge_split(PyObject *UNUSED(self), PyObject *args)
BMVert *v_new = NULL;
BMEdge *e_new = NULL;
if (!PyArg_ParseTuple(args,
"O!O!f:edge_split",
&BPy_BMEdge_Type,
&py_edge,
&BPy_BMVert_Type,
&py_vert,
&fac)) {
if (!PyArg_ParseTuple(
args, "O!O!f:edge_split", &BPy_BMEdge_Type, &py_edge, &BPy_BMVert_Type, &py_vert, &fac))
{
return NULL;
}
@@ -372,7 +363,8 @@ static PyObject *bpy_bm_utils_edge_rotate(PyObject *UNUSED(self), PyObject *args
BMEdge *e_new = NULL;
if (!PyArg_ParseTuple(
args, "O!|O&:edge_rotate", &BPy_BMEdge_Type, &py_edge, PyC_ParseBool, &do_ccw)) {
args, "O!|O&:edge_rotate", &BPy_BMEdge_Type, &py_edge, PyC_ParseBool, &do_ccw))
{
return NULL;
}
@@ -446,7 +438,8 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args,
PyC_ParseBool,
&edge_exists,
&BPy_BMEdge_Type,
&py_edge_example)) {
&py_edge_example))
{
return NULL;
}
@@ -460,7 +453,8 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args,
/* this doubles for checking that the verts are in the same mesh */
if ((l_a = BM_face_vert_share_loop(py_face->f, py_vert_a->v)) &&
(l_b = BM_face_vert_share_loop(py_face->f, py_vert_b->v))) {
(l_b = BM_face_vert_share_loop(py_face->f, py_vert_b->v)))
{
/* pass */
}
else {
@@ -564,7 +558,8 @@ static PyObject *bpy_bm_utils_face_split_edgenet(PyObject *UNUSED(self),
(char **)kwlist,
&BPy_BMFace_Type,
&py_face,
&edge_seq)) {
&edge_seq))
{
return NULL;
}
@@ -674,12 +669,9 @@ static PyObject *bpy_bm_utils_face_vert_separate(PyObject *UNUSED(self), PyObjec
BMLoop *l;
BMVert *v_old, *v_new;
if (!PyArg_ParseTuple(args,
"O!O!:face_vert_separate",
&BPy_BMFace_Type,
&py_face,
&BPy_BMVert_Type,
&py_vert)) {
if (!PyArg_ParseTuple(
args, "O!O!:face_vert_separate", &BPy_BMFace_Type, &py_face, &BPy_BMVert_Type, &py_vert))
{
return NULL;
}

View File

@@ -825,7 +825,8 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
pybuffer.format);
}
else if (ndimensions != pybuffer.ndim ||
!compare_dimensions(ndimensions, dimensions, pybuffer.shape)) {
!compare_dimensions(ndimensions, dimensions, pybuffer.shape))
{
PyErr_Format(PyExc_TypeError, "array size does not match");
}
else {

View File

@@ -123,8 +123,8 @@ static PyObject *py_blf_color(PyObject *UNUSED(self), PyObject *args)
int fontid;
float rgba[4];
if (!PyArg_ParseTuple(
args, "iffff:blf.color", &fontid, &rgba[0], &rgba[1], &rgba[2], &rgba[3])) {
if (!PyArg_ParseTuple(args, "iffff:blf.color", &fontid, &rgba[0], &rgba[1], &rgba[2], &rgba[3]))
{
return NULL;
}
@@ -361,7 +361,8 @@ static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args)
float rgba[4];
if (!PyArg_ParseTuple(
args, "iiffff:blf.shadow", &fontid, &level, &rgba[0], &rgba[1], &rgba[2], &rgba[3])) {
args, "iiffff:blf.shadow", &fontid, &level, &rgba[0], &rgba[1], &rgba[2], &rgba[3]))
{
return NULL;
}

View File

@@ -608,7 +608,8 @@ static IDProperty *idp_from_PySequence(const char *name, PyObject *ob)
else {
const char format = PyC_StructFmt_type_from_str(buffer.format);
if (PyC_StructFmt_type_is_float_any(format) ||
(PyC_StructFmt_type_is_int_any(format) && buffer.itemsize == 4)) {
(PyC_StructFmt_type_is_int_any(format) && buffer.itemsize == 4))
{
use_buffer = true;
}
else {
@@ -737,7 +738,8 @@ bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty *group,
* obviously this isn't a complete solution, but helps for common cases. */
prop_exist = IDP_GetPropertyFromGroup(group, prop->name);
if ((prop_exist != NULL) && (prop_exist->type == prop->type) &&
(prop_exist->subtype == prop->subtype)) {
(prop_exist->subtype == prop->subtype))
{
/* Preserve prev/next links!!! See #42593. */
prop->prev = prop_exist->prev;
prop->next = prop_exist->next;

View File

@@ -58,7 +58,8 @@ static bool idprop_ui_data_update_base(IDPropertyUIData *ui_data,
if (pyrna_enum_value_from_id(rna_enum_property_subtype_items,
rna_subtype,
&ui_data->rna_subtype,
"IDPropertyUIManager.update") == -1) {
"IDPropertyUIManager.update") == -1)
{
return false;
}
}
@@ -88,7 +89,8 @@ static bool idprop_ui_data_update_int_default(IDProperty *idprop,
int *new_default_array = (int *)MEM_malloc_arrayN(len, sizeof(int), __func__);
if (PyC_AsArray(
new_default_array, sizeof(int), default_value, len, &PyLong_Type, "ui_data_update") ==
-1) {
-1)
{
MEM_freeN(new_default_array);
return false;
}
@@ -130,7 +132,8 @@ static bool idprop_ui_data_update_int(IDProperty *idprop, PyObject *args, PyObje
&step,
&default_value,
&rna_subtype,
&description)) {
&description))
{
return false;
}
@@ -202,7 +205,8 @@ static bool idprop_ui_data_update_bool_default(IDProperty *idprop,
default_value,
len,
&PyBool_Type,
"ui_data_update") == -1) {
"ui_data_update") == -1)
{
MEM_freeN(new_default_array);
return false;
}
@@ -237,7 +241,8 @@ static bool idprop_ui_data_update_bool(IDProperty *idprop, PyObject *args, PyObj
(char **)kwlist,
&default_value,
&rna_subtype,
&description)) {
&description))
{
return false;
}
@@ -285,7 +290,8 @@ static bool idprop_ui_data_update_float_default(IDProperty *idprop,
default_value,
len,
&PyFloat_Type,
"ui_data_update") == -1) {
"ui_data_update") == -1)
{
MEM_freeN(new_default_array);
return false;
}
@@ -337,7 +343,8 @@ static bool idprop_ui_data_update_float(IDProperty *idprop, PyObject *args, PyOb
&precision,
&default_value,
&rna_subtype,
&description)) {
&description))
{
return false;
}
@@ -406,7 +413,8 @@ static bool idprop_ui_data_update_string(IDProperty *idprop, PyObject *args, PyO
(char **)kwlist,
&default_value,
&rna_subtype,
&description)) {
&description))
{
return false;
}
@@ -438,7 +446,8 @@ static bool idprop_ui_data_update_id(IDProperty *idprop, PyObject *args, PyObjec
const char *description = NULL;
const char *kwlist[] = {"subtype", "description", NULL};
if (!PyArg_ParseTupleAndKeywords(
args, kwargs, "|$zz:update", (char **)kwlist, &rna_subtype, &description)) {
args, kwargs, "|$zz:update", (char **)kwlist, &rna_subtype, &description))
{
return false;
}

View File

@@ -101,7 +101,8 @@ static PyObject *py_imbuf_resize(Py_ImBuf *self, PyObject *args, PyObject *kw)
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &size[0], &size[1], PyC_ParseStringEnum, &method)) {
args, kw, &_parser, &size[0], &size[1], PyC_ParseStringEnum, &method))
{
return NULL;
}
if (size[0] <= 0 || size[1] <= 0) {
@@ -145,7 +146,8 @@ static PyObject *py_imbuf_crop(Py_ImBuf *self, PyObject *args, PyObject *kw)
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &crop.xmin, &crop.ymin, &crop.xmax, &crop.ymax)) {
args, kw, &_parser, &crop.xmin, &crop.ymin, &crop.xmax, &crop.ymax))
{
return NULL;
}
@@ -156,7 +158,8 @@ static PyObject *py_imbuf_crop(Py_ImBuf *self, PyObject *args, PyObject *kw)
/* X order. */
!(crop.xmin <= crop.xmax) ||
/* Y order. */
!(crop.ymin <= crop.ymax)) {
!(crop.ymin <= crop.ymax))
{
PyErr_SetString(PyExc_ValueError, "ImBuf crop min/max not in range");
return NULL;
}

View File

@@ -200,7 +200,8 @@ int pyrna_enum_value_parse_string(PyObject *o, void *p)
}
struct BPy_EnumProperty_Parse *parse_data = p;
if (pyrna_enum_value_from_id(
parse_data->items, identifier, &parse_data->value, "enum identifier") == -1) {
parse_data->items, identifier, &parse_data->value, "enum identifier") == -1)
{
return 0;
}
@@ -218,7 +219,8 @@ int pyrna_enum_bitfield_parse_set(PyObject *o, void *p)
struct BPy_EnumProperty_Parse *parse_data = p;
if (pyrna_enum_bitfield_from_set(
parse_data->items, o, &parse_data->value, "enum identifier set") == -1) {
parse_data->items, o, &parse_data->value, "enum identifier set") == -1)
{
return 0;
}
parse_data->value_orig = o;

View File

@@ -214,8 +214,8 @@ static int PyC_AsArray_Multi_FAST_impl(void **array_p,
const int length = dims[0];
if (dims_len == 1) {
if (PyC_AsArray_FAST(*array_p, array_item_size, value_fast, length, type, error_prefix) ==
-1) {
if (PyC_AsArray_FAST(*array_p, array_item_size, value_fast, length, type, error_prefix) == -1)
{
return -1;
}
*array_p = POINTER_OFFSET(*array_p, array_item_size * length);
@@ -241,7 +241,8 @@ static int PyC_AsArray_Multi_FAST_impl(void **array_p,
dims_next,
dims_next_len,
type,
error_prefix) == -1) {
error_prefix) == -1)
{
return -1;
}
}
@@ -1309,7 +1310,8 @@ void *PyC_RNA_AsPointer(PyObject *value, const char *type_name)
if (STREQ(Py_TYPE(value)->tp_name, type_name) &&
(as_pointer = PyObject_GetAttrString(value, "as_pointer")) != NULL &&
PyCallable_Check(as_pointer)) {
PyCallable_Check(as_pointer))
{
void *result = NULL;
/* must be a 'type_name' object */

View File

@@ -71,7 +71,8 @@ static PyObject *pygpu_batch__tp_new(PyTypeObject *UNUSED(type), PyObject *args,
&BPyGPUVertBuf_Type,
&py_vertbuf,
&BPyGPUIndexBuf_Type,
&py_indexbuf)) {
&py_indexbuf))
{
return NULL;
}
@@ -136,8 +137,8 @@ static PyObject *pygpu_batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_bu
return NULL;
}
if (GPU_vertbuf_get_vertex_len(self->batch->verts[0]) !=
GPU_vertbuf_get_vertex_len(py_buf->buf)) {
if (GPU_vertbuf_get_vertex_len(self->batch->verts[0]) != GPU_vertbuf_get_vertex_len(py_buf->buf))
{
PyErr_Format(PyExc_TypeError,
"Expected %d length, got %d",
GPU_vertbuf_get_vertex_len(self->batch->verts[0]),
@@ -264,7 +265,8 @@ static PyObject *pygpu_batch_draw_instanced(BPyGPUBatch *self, PyObject *args, P
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &BPyGPUShader_Type, &py_program, &instance_start, &instance_count)) {
args, kw, &_parser, &BPyGPUShader_Type, &py_program, &instance_start, &instance_count))
{
return NULL;
}
@@ -305,7 +307,8 @@ static PyObject *pygpu_batch_draw_range(BPyGPUBatch *self, PyObject *args, PyObj
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &BPyGPUShader_Type, &py_program, &elem_start, &elem_count)) {
args, kw, &_parser, &BPyGPUShader_Type, &py_program, &elem_start, &elem_count))
{
return NULL;
}

View File

@@ -46,7 +46,8 @@ static bool pygpu_buffer_dimensions_tot_len_compare(const Py_ssize_t *shape_a,
const Py_ssize_t shape_b_len)
{
if (pygpu_buffer_dimensions_tot_elem(shape_a, shape_a_len) !=
pygpu_buffer_dimensions_tot_elem(shape_b, shape_b_len)) {
pygpu_buffer_dimensions_tot_elem(shape_b, shape_b_len))
{
PyErr_Format(PyExc_BufferError, "array size does not match");
return false;
}
@@ -382,7 +383,8 @@ static PyObject *pygpu_buffer__tp_new(PyTypeObject *UNUSED(type), PyObject *args
const struct PyC_StringEnum pygpu_dataformat = {bpygpu_dataformat_items, GPU_DATA_FLOAT};
if (!PyArg_ParseTuple(
args, "O&O|O: Buffer", PyC_ParseStringEnum, &pygpu_dataformat, &length_ob, &init)) {
args, "O&O|O: Buffer", PyC_ParseStringEnum, &pygpu_dataformat, &length_ob, &init))
{
return NULL;
}

View File

@@ -72,7 +72,8 @@ static PyObject *pygpu_IndexBuf__tp_new(PyTypeObject *UNUSED(type), PyObject *ar
}
if (pybuffer.itemsize != 4 ||
PyC_StructFmt_type_is_float_any(PyC_StructFmt_type_from_str(pybuffer.format))) {
PyC_StructFmt_type_is_float_any(PyC_StructFmt_type_from_str(pybuffer.format)))
{
PyErr_Format(PyExc_ValueError, "Each index must be an 4-bytes integer value");
PyBuffer_Release(&pybuffer);
return NULL;

View File

@@ -284,7 +284,8 @@ static PyObject *pygpu_framebuffer__tp_new(PyTypeObject *UNUSED(self),
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, &depth_attachment, &color_attachements)) {
args, kwds, &_parser, &depth_attachment, &color_attachements))
{
return NULL;
}
@@ -514,7 +515,8 @@ static PyObject *pygpu_framebuffer_read_color(BPyGPUFrameBuffer *self,
PyC_ParseStringEnum,
&pygpu_dataformat,
&BPyGPU_BufferType,
&py_buffer)) {
&py_buffer))
{
return NULL;
}
@@ -598,7 +600,8 @@ static PyObject *pygpu_framebuffer_read_depth(BPyGPUFrameBuffer *self,
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, &x, &y, &w, &h, &BPyGPU_BufferType, &py_buffer)) {
args, kwds, &_parser, &x, &y, &w, &h, &BPyGPU_BufferType, &py_buffer))
{
return NULL;
}

View File

@@ -291,7 +291,8 @@ static PyObject *pygpu_matrix_scale(PyObject *UNUSED(self), PyObject *value)
float scale[3];
int len;
if ((len = mathutils_array_parse(
scale, 2, 3, value, "gpu.matrix.scale(): invalid vector arg")) == -1) {
scale, 2, 3, value, "gpu.matrix.scale(): invalid vector arg")) == -1)
{
return NULL;
}
if (len == 2) {
@@ -331,7 +332,8 @@ static PyObject *pygpu_matrix_translate(PyObject *UNUSED(self), PyObject *value)
float offset[3];
int len;
if ((len = mathutils_array_parse(
offset, 2, 3, value, "gpu.matrix.translate(): invalid vector arg")) == -1) {
offset, 2, 3, value, "gpu.matrix.translate(): invalid vector arg")) == -1)
{
return NULL;
}
if (len == 2) {

View File

@@ -227,7 +227,8 @@ static PyObject *pygpu_offscreen__tp_new(PyTypeObject *UNUSED(self),
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, &width, &height, PyC_ParseStringEnum, &pygpu_textureformat)) {
args, kwds, &_parser, &width, &height, PyC_ParseStringEnum, &pygpu_textureformat))
{
return NULL;
}
@@ -369,7 +370,8 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar
(!(scene = PyC_RNA_AsPointer(py_scene, "Scene")) ||
!(view_layer = PyC_RNA_AsPointer(py_view_layer, "ViewLayer")) ||
!(v3d = PyC_RNA_AsPointer(py_view3d, "SpaceView3D")) ||
!(region = PyC_RNA_AsPointer(py_region, "Region")))) {
!(region = PyC_RNA_AsPointer(py_region, "Region"))))
{
return NULL;
}

View File

@@ -126,7 +126,8 @@ static PyObject *pygpu_shader__tp_new(PyTypeObject *UNUSED(type), PyObject *args
&params.geocode,
&params.libcode,
&params.defines,
&params.name)) {
&params.name))
{
return NULL;
}
@@ -219,7 +220,8 @@ static bool pygpu_shader_uniform_vector_impl(PyObject *args,
*r_count = 1;
if (!PyArg_ParseTuple(
args, "iOi|i:GPUShader.uniform_vector_*", r_location, &buffer, r_length, r_count)) {
args, "iOi|i:GPUShader.uniform_vector_*", r_location, &buffer, r_length, r_count))
{
return false;
}
@@ -286,8 +288,8 @@ static PyObject *pygpu_shader_uniform_vector_int(BPyGPUShader *self, PyObject *a
Py_buffer pybuffer;
if (!pygpu_shader_uniform_vector_impl(
args, sizeof(int), &location, &length, &count, &pybuffer)) {
if (!pygpu_shader_uniform_vector_impl(args, sizeof(int), &location, &length, &count, &pybuffer))
{
return NULL;
}
@@ -528,7 +530,8 @@ static PyObject *pygpu_shader_uniform_sampler(BPyGPUShader *self, PyObject *args
const char *name;
BPyGPUTexture *py_texture;
if (!PyArg_ParseTuple(
args, "sO!:GPUShader.uniform_sampler", &name, &BPyGPUTexture_Type, &py_texture)) {
args, "sO!:GPUShader.uniform_sampler", &name, &BPyGPUTexture_Type, &py_texture))
{
return NULL;
}
@@ -851,7 +854,8 @@ static PyObject *pygpu_shader_from_builtin(PyObject *UNUSED(self), PyObject *arg
pyc_parse_buitinshader_w_backward_compatibility,
&pygpu_bultinshader,
PyC_ParseStringEnum,
&pygpu_config)) {
&pygpu_config))
{
return NULL;
}

View File

@@ -499,7 +499,8 @@ static PyObject *pygpu_shader_info_fragment_out(BPyGPUShaderCreateInfo *self,
&pygpu_type,
&name,
PyC_ParseStringEnum,
&blend_type)) {
&blend_type))
{
return nullptr;
}
@@ -604,13 +605,15 @@ static PyObject *pygpu_shader_info_image(BPyGPUShaderCreateInfo *self,
PyC_ParseStringEnum,
&pygpu_imagetype,
&name,
&py_qualifiers)) {
&py_qualifiers))
{
return nullptr;
}
if (py_qualifiers &&
PyC_FlagSet_ToBitfield(
pygpu_qualifiers, py_qualifiers, (int *)&qualifier, "shader_info.image") == -1) {
pygpu_qualifiers, py_qualifiers, (int *)&qualifier, "shader_info.image") == -1)
{
return nullptr;
}
@@ -775,7 +778,8 @@ static PyObject *pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self,
nullptr,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, PyC_ParseStringEnum, &pygpu_type, &name, &array_size)) {
args, kwds, &_parser, PyC_ParseStringEnum, &pygpu_type, &name, &array_size))
{
return nullptr;
}

View File

@@ -140,7 +140,8 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject *UNUSED(self), PyObject *arg
PyC_ParseStringEnum,
&pygpu_textureformat,
&BPyGPU_BufferType,
&pybuffer_obj)) {
&pybuffer_obj))
{
return NULL;
}
@@ -301,7 +302,8 @@ static PyObject *pygpu_texture_clear(BPyGPUTexture *self, PyObject *args, PyObje
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, PyC_ParseStringEnum, &pygpu_dataformat, &py_values)) {
args, kwds, &_parser, PyC_ParseStringEnum, &pygpu_dataformat, &py_values))
{
return NULL;
}
@@ -315,8 +317,8 @@ static PyObject *pygpu_texture_clear(BPyGPUTexture *self, PyObject *args, PyObje
return NULL;
}
if (shape != 1 &&
ELEM(pygpu_dataformat.value_found, GPU_DATA_UINT_24_8, GPU_DATA_10_11_11_REV)) {
if (shape != 1 && ELEM(pygpu_dataformat.value_found, GPU_DATA_UINT_24_8, GPU_DATA_10_11_11_REV))
{
PyErr_SetString(PyExc_AttributeError,
"`UINT_24_8` and `10_11_11_REV` only support single values");
return NULL;
@@ -329,7 +331,8 @@ static PyObject *pygpu_texture_clear(BPyGPUTexture *self, PyObject *args, PyObje
py_values,
shape,
(pygpu_dataformat.value_found == GPU_DATA_FLOAT) ? &PyFloat_Type : &PyLong_Type,
"clear") == -1) {
"clear") == -1)
{
return NULL;
}

View File

@@ -244,7 +244,8 @@ static PyObject *pygpu_vertbuf__tp_new(PyTypeObject *UNUSED(type), PyObject *arg
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, &BPyGPUVertFormat_Type, &params.py_fmt, &params.len)) {
args, kwds, &_parser, &BPyGPUVertFormat_Type, &params.py_fmt, &params.len))
{
return NULL;
}

View File

@@ -108,7 +108,8 @@ static PyObject *pygpu_vertformat_attr_add(BPyGPUVertFormat *self, PyObject *arg
&comp_type,
&len,
PyC_ParseStringEnum,
&fetch_mode)) {
&fetch_mode))
{
return NULL;
}

View File

@@ -134,7 +134,8 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
PyC_ParseBool,
&packed,
PyC_ParseBool,
&local)) {
&local))
{
return NULL;
}
@@ -188,7 +189,8 @@ static PyObject *bpy_flip_name(PyObject *UNUSED(self), PyObject *args, PyObject
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &name_src, &name_src_len, PyC_ParseBool, &strip_digits)) {
args, kw, &_parser, &name_src, &name_src_len, PyC_ParseBool, &strip_digits))
{
return NULL;
}
@@ -320,7 +322,8 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, PyC_ParseStringEnum, &type, &major, &minor)) {
args, kw, &_parser, PyC_ParseStringEnum, &type, &major, &minor))
{
return NULL;
}
@@ -366,7 +369,8 @@ static PyObject *bpy_driver_secure_code_test(PyObject *UNUSED(self), PyObject *a
&PyDict_Type,
&py_namespace,
PyC_ParseBool,
&verbose)) {
&verbose))
{
return NULL;
}
return PyBool_FromLong(BPY_driver_secure_bytecode_test(py_code, py_namespace, verbose));

View File

@@ -508,7 +508,8 @@ static PyObject *bpy_app_is_job_running(PyObject *UNUSED(self), PyObject *args,
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, pyrna_enum_value_parse_string, &job_type_enum)) {
args, kwds, &_parser, pyrna_enum_value_parse_string, &job_type_enum))
{
return NULL;
}
wmWindowManager *wm = G_MAIN->wm.first;

View File

@@ -310,7 +310,8 @@ void BPY_app_handlers_reset(const bool do_all)
PyObject **dict_ptr;
if (PyFunction_Check(item) && (dict_ptr = _PyObject_GetDictPtr(item)) && (*dict_ptr) &&
(PyDict_GetItem(*dict_ptr, perm_id_str) != NULL)) {
(PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
{
/* keep */
}
else {

View File

@@ -49,7 +49,8 @@ static PyObject *bpy_app_icons_new_triangles(PyObject *UNUSED(self), PyObject *a
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &coords_range[0], &coords_range[1], &py_coords, &py_colors)) {
args, kw, &_parser, &coords_range[0], &coords_range[1], &py_coords, &py_colors))
{
return NULL;
}

View File

@@ -320,7 +320,8 @@ static PyObject *app_translations_py_messages_register(BlenderAppTranslations *s
&PyUnicode_Type,
&module_name,
&PyDict_Type,
&uuid_dict)) {
&uuid_dict))
{
return NULL;
}
@@ -371,7 +372,8 @@ static PyObject *app_translations_py_messages_unregister(BlenderAppTranslations
"O!:bpy.app.translations.unregister",
(char **)kwlist,
&PyUnicode_Type,
&module_name)) {
&module_name))
{
return NULL;
}
@@ -534,7 +536,8 @@ static PyObject *_py_pgettext(PyObject *args,
char *msgid, *msgctxt = NULL;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "s|z:bpy.app.translations.pgettext", (char **)kwlist, &msgid, &msgctxt)) {
args, kw, "s|z:bpy.app.translations.pgettext", (char **)kwlist, &msgid, &msgctxt))
{
return NULL;
}
@@ -544,7 +547,8 @@ static PyObject *_py_pgettext(PyObject *args,
(void)_pgettext;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "O|O:bpy.app.translations.pgettext", (char **)kwlist, &msgid, &msgctxt)) {
args, kw, "O|O:bpy.app.translations.pgettext", (char **)kwlist, &msgid, &msgctxt))
{
return NULL;
}
@@ -678,7 +682,8 @@ static PyObject *app_translations_locale_explode(BlenderAppTranslations *UNUSED(
char *language, *country, *variant, *language_country, *language_variant;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "s:bpy.app.translations.locale_explode", (char **)kwlist, &locale)) {
args, kw, "s:bpy.app.translations.locale_explode", (char **)kwlist, &locale))
{
return NULL;
}

View File

@@ -184,7 +184,8 @@ static void bpy_pydriver_namespace_update_frame(const float evaltime)
static void bpy_pydriver_namespace_update_self(struct PathResolvedRNA *anim_rna)
{
if ((g_pydriver_state_prev.self == NULL) ||
(pyrna_driver_is_equal_anim_rna(anim_rna, g_pydriver_state_prev.self) == false)) {
(pyrna_driver_is_equal_anim_rna(anim_rna, g_pydriver_state_prev.self) == false))
{
PyObject *item = pyrna_driver_self_from_anim_rna(anim_rna);
PyDict_SetItem(bpy_pydriver_Dict, bpy_intern_str_self, item);
Py_DECREF(item);
@@ -225,7 +226,8 @@ static void bpy_pydriver_namespace_update_depsgraph(struct Depsgraph *depsgraph)
}
if ((g_pydriver_state_prev.depsgraph == NULL) ||
(depsgraph != g_pydriver_state_prev.depsgraph->ptr.data)) {
(depsgraph != g_pydriver_state_prev.depsgraph->ptr.data))
{
PyObject *item = bpy_pydriver_depsgraph_as_pyobject(depsgraph);
PyDict_SetItem(bpy_pydriver_Dict, bpy_intern_str_depsgraph, item);
Py_DECREF(item);
@@ -753,7 +755,8 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
},
/* Always be verbose since this can give hints to why evaluation fails. */
true,
__func__)) {
__func__))
{
if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET)) {
G.f |= G_FLAG_SCRIPT_AUTOEXEC_FAIL;
BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Driver '%s'", expr);

View File

@@ -66,7 +66,8 @@ static bool bpy_gizmotype_target_property_def(wmGizmoType *gzt, PyObject *item)
&params.id,
pyrna_enum_value_parse_string,
&params.type_enum,
&params.array_length)) {
&params.array_length))
{
goto fail;
}
@@ -117,7 +118,8 @@ static void gizmo_properties_init(wmGizmoType *gzt)
if (bl_target_properties != NULL) {
PyObject *bl_target_properties_fast;
if (!(bl_target_properties_fast = PySequence_Fast(bl_target_properties,
"bl_target_properties sequence"))) {
"bl_target_properties sequence")))
{
/* PySequence_Fast sets the error */
PyErr_Print();
PyErr_Clear();

View File

@@ -401,7 +401,8 @@ void BPY_python_start(bContext *C, int argc, const char **argv)
{
char program_path[FILE_MAX];
if (BKE_appdir_program_python_search(
program_path, sizeof(program_path), PY_MAJOR_VERSION, PY_MINOR_VERSION)) {
program_path, sizeof(program_path), PY_MAJOR_VERSION, PY_MINOR_VERSION))
{
status = PyConfig_SetBytesString(&config, &config.executable, program_path);
pystatus_exit_on_error(status);
has_python_executable = true;
@@ -848,7 +849,8 @@ static bool bpy_module_ensure_compatible_version(void)
uint version_runtime_major = version_runtime >> 24;
uint version_runtime_minor = ((version_runtime & 0x00ff0000) >> 16);
if ((version_compile_major != version_runtime_major) ||
(version_compile_minor != version_runtime_minor)) {
(version_compile_minor != version_runtime_minor))
{
PyErr_Format(PyExc_ImportError,
"The version of \"bpy\" was compiled with: "
"(%u.%u) is incompatible with: (%u.%u) used by the interpreter!",

View File

@@ -219,7 +219,8 @@ static PyObject *bpy_lib_load(BPy_PropertyRNA *self, PyObject *args, PyObject *k
PyC_ParseBool,
&reuse_liboverrides,
PyC_ParseBool,
&create_liboverrides_runtime)) {
&create_liboverrides_runtime))
{
return NULL;
}
@@ -353,7 +354,8 @@ static void bpy_lib_exit_warn_idname(BPy_Library *self,
"load: '%s' does not contain %s[\"%s\"]",
self->abspath,
name_plural,
idname)) {
idname))
{
/* Spurious errors can appear at shutdown */
if (PyErr_ExceptionMatches(PyExc_Warning)) {
PyErr_WriteUnraisable((PyObject *)self);
@@ -370,7 +372,8 @@ static void bpy_lib_exit_warn_type(BPy_Library *self, PyObject *item)
1,
"load: '%s' expected a string type, not a %.200s",
self->abspath,
Py_TYPE(item)->tp_name)) {
Py_TYPE(item)->tp_name))
{
/* Spurious errors can appear at shutdown */
if (PyErr_ExceptionMatches(PyExc_Warning)) {
PyErr_WriteUnraisable((PyObject *)self);

View File

@@ -105,7 +105,8 @@ static PyObject *bpy_lib_write(BPy_PropertyRNA *self, PyObject *args, PyObject *
PyC_ParseBool,
&use_fake_user,
PyC_ParseBool,
&use_compress)) {
&use_compress))
{
return NULL;
}

View File

@@ -260,12 +260,14 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject *UNUSED(self), PyObject *args
&callback_args,
&callback_notify,
&PySet_Type,
&py_options)) {
&py_options))
{
return NULL;
}
if (py_options &&
(pyrna_enum_bitfield_from_set(py_options_enum, py_options, &options, error_prefix) == -1)) {
(pyrna_enum_bitfield_from_set(py_options_enum, py_options, &options, error_prefix) == -1))
{
return NULL;
}

View File

@@ -70,7 +70,8 @@ static void op_context_override_deprecated_warning(const char *action, const cha
"Passing in context overrides is deprecated in favor of "
"Context.temp_override(..), %s \"%s\"",
action,
opname) < 0) {
opname) < 0)
{
/* The function has no return value, the exception cannot
* be reported to the caller, so just log it. */
PyErr_WriteUnraisable(NULL);
@@ -196,7 +197,8 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
&PyDict_Type,
&kw,
&context_str,
&is_undo)) {
&is_undo))
{
return NULL;
}
@@ -397,7 +399,8 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
PyC_ParseBool,
&all_args,
PyC_ParseBool,
&macro_args)) {
&macro_args))
{
return NULL;
}

View File

@@ -743,7 +743,8 @@ static void bpy_prop_boolean_array_get_fn(struct PointerRNA *ptr,
ret,
&array_len_info,
&PyBool_Type,
"BoolVectorProperty get callback") == -1) {
"BoolVectorProperty get callback") == -1)
{
PyC_Err_PrintWithFunc(py_func);
}
else {
@@ -1004,7 +1005,8 @@ static void bpy_prop_int_array_get_fn(struct PointerRNA *ptr,
ret,
&array_len_info,
&PyLong_Type,
"IntVectorProperty get callback") == -1) {
"IntVectorProperty get callback") == -1)
{
PyC_Err_PrintWithFunc(py_func);
}
else {
@@ -1266,7 +1268,8 @@ static void bpy_prop_float_array_get_fn(struct PointerRNA *ptr,
ret,
&array_len_info,
&PyFloat_Type,
"FloatVectorProperty get callback") == -1) {
"FloatVectorProperty get callback") == -1)
{
PyC_Err_PrintWithFunc(py_func);
}
else {
@@ -2009,7 +2012,8 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast,
(item_size != 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value)) &&
(item_size != 5 || ((py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.icon) ||
(tmp_icon = PyUnicode_AsUTF8(PyTuple_GET_ITEM(item, 3)))) &&
py_long_as_int(PyTuple_GET_ITEM(item, 4), &tmp.value)))) {
py_long_as_int(PyTuple_GET_ITEM(item, 4), &tmp.value))))
{
if (is_enum_flag) {
if (item_size < 4) {
tmp.value = 1 << i;
@@ -2027,7 +2031,8 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast,
if (default_py && default_used == 0) {
if ((default_str_cmp != NULL && STREQ(default_str_cmp, tmp.identifier)) ||
(default_str_cmp == NULL && default_int_cmp == tmp.value)) {
(default_str_cmp == NULL && default_int_cmp == tmp.value))
{
*r_default_value = tmp.value;
default_used++; /* only ever 1 */
}
@@ -2161,7 +2166,8 @@ static const EnumPropertyItem *bpy_prop_enum_itemf_fn(struct bContext *C,
if (!(items_fast = PySequence_Fast(items,
"EnumProperty(...): "
"return value from the callback was not a sequence"))) {
"return value from the callback was not a sequence")))
{
err = -1;
}
else {
@@ -2571,7 +2577,8 @@ static int bpy_prop_arg_parse_id(PyObject *o, void *p)
parse_data->prop_free_handle = NULL;
if (UNLIKELY(RNA_def_property_free_identifier_deferred_prepare(
srna, id, &parse_data->prop_free_handle) == -1)) {
srna, id, &parse_data->prop_free_handle) == -1))
{
PyErr_Format(PyExc_TypeError,
"'%s' is defined as a non-dynamic type for '%s'",
id,
@@ -2840,7 +2847,8 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
&subtype_enum,
&update_fn,
&get_fn,
&set_fn)) {
&set_fn))
{
return NULL;
}
@@ -2990,7 +2998,8 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
&array_len_info,
&update_fn,
&get_fn,
&set_fn)) {
&set_fn))
{
return NULL;
}
@@ -3000,7 +3009,8 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
default_py,
&array_len_info,
&PyBool_Type,
"BoolVectorProperty(default=sequence)") == -1) {
"BoolVectorProperty(default=sequence)") == -1)
{
return NULL;
}
}
@@ -3177,7 +3187,8 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
&subtype_enum,
&update_fn,
&get_fn,
&set_fn)) {
&set_fn))
{
return NULL;
}
@@ -3354,7 +3365,8 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
&array_len_info,
&update_fn,
&get_fn,
&set_fn)) {
&set_fn))
{
return NULL;
}
@@ -3364,7 +3376,8 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
default_py,
&array_len_info,
&PyLong_Type,
"IntVectorProperty(default=sequence)") == -1) {
"IntVectorProperty(default=sequence)") == -1)
{
return NULL;
}
}
@@ -3543,7 +3556,8 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
&unit_enum,
&update_fn,
&get_fn,
&set_fn)) {
&set_fn))
{
return NULL;
}
@@ -3719,7 +3733,8 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
&array_len_info,
&update_fn,
&get_fn,
&set_fn)) {
&set_fn))
{
return NULL;
}
@@ -3729,7 +3744,8 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
default_py,
&array_len_info,
&PyFloat_Type,
"FloatVectorProperty(default=sequence)") == -1) {
"FloatVectorProperty(default=sequence)") == -1)
{
return NULL;
}
if (bpy_prop_array_is_matrix_compatible_ex(subtype_enum.value, &array_len_info)) {
@@ -3909,7 +3925,8 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
&set_fn,
&search_fn,
pyrna_enum_bitfield_parse_set,
&search_options_enum)) {
&search_options_enum))
{
return NULL;
}
@@ -4096,7 +4113,8 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
&tags_enum,
&update_fn,
&get_fn,
&set_fn)) {
&set_fn))
{
return NULL;
}
@@ -4117,8 +4135,8 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
}
/* items can be a list or a callable */
if (PyFunction_Check(
items)) { /* don't use PyCallable_Check because we need the function code for errors */
if (PyFunction_Check(items))
{ /* don't use PyCallable_Check because we need the function code for errors */
PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(items);
if (f_code->co_argcount != 2) {
PyErr_Format(PyExc_ValueError,
@@ -4145,7 +4163,8 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!(items_fast = PySequence_Fast(
items,
"EnumProperty(...): "
"expected a sequence of tuples for the enum items or a function"))) {
"expected a sequence of tuples for the enum items or a function")))
{
return NULL;
}
@@ -4310,7 +4329,8 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
bpy_prop_arg_parse_tag_defines,
&tags_enum,
&poll_fn,
&update_fn)) {
&update_fn))
{
return NULL;
}
@@ -4440,7 +4460,8 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
pyrna_enum_bitfield_parse_set,
&override_enum,
bpy_prop_arg_parse_tag_defines,
&tags_enum)) {
&tags_enum))
{
return NULL;
}

View File

@@ -147,7 +147,8 @@ static void id_release_gc(struct ID *id)
while ((g = g->gc.gc_next) != gen) {
PyObject *ob = FROM_GC(g);
if (PyType_IsSubtype(Py_TYPE(ob), &pyrna_struct_Type) ||
PyType_IsSubtype(Py_TYPE(ob), &pyrna_prop_Type)) {
PyType_IsSubtype(Py_TYPE(ob), &pyrna_prop_Type))
{
BPy_DummyPointerRNA *ob_ptr = (BPy_DummyPointerRNA *)ob;
if (ob_ptr->ptr.owner_id == id) {
pyrna_invalidate(ob_ptr);
@@ -2051,7 +2052,8 @@ static int pyrna_py_to_prop(
}
if (pyrna_pydict_to_props(
&itemptr, item, true, "Converting a Python list to an RNA collection") == -1) {
&itemptr, item, true, "Converting a Python list to an RNA collection") == -1)
{
PyObject *msg = PyC_ExceptionBuffer();
const char *msg_char = PyUnicode_AsUTF8(msg);
PyErr_Clear();
@@ -2108,7 +2110,8 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
if (totdim > 1) {
// char error_str[512];
if (pyrna_py_to_array_index(
&self->ptr, self->prop, self->arraydim, self->arrayoffset, index, value, "") == -1) {
&self->ptr, self->prop, self->arraydim, self->arrayoffset, index, value, "") == -1)
{
/* Error is set. */
ret = -1;
}
@@ -2943,7 +2946,8 @@ static PyObject *prop_subscript_ass_array_slice__as_seq_fast(PyObject *value, in
PyObject *value_fast;
if (!(value_fast = PySequence_Fast(value,
"bpy_prop_array[slice] = value: "
"element in assignment is not a sequence type"))) {
"element in assignment is not a sequence type")))
{
return NULL;
}
if (PySequence_Fast_GET_SIZE(value_fast) != length) {
@@ -3077,7 +3081,8 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr,
}
if (!(value = PySequence_Fast(
value_orig, "bpy_prop_array[slice] = value: assignment is not a sequence type"))) {
value_orig, "bpy_prop_array[slice] = value: assignment is not a sequence type")))
{
return -1;
}
@@ -3371,7 +3376,8 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *key)
return 1;
}
if (pyrna_prop_collection_string_subscript_supported_or_error(
self, "bpy_prop_collection.__contains__") == -1) {
self, "bpy_prop_collection.__contains__") == -1)
{
return -1;
}
@@ -3503,7 +3509,8 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje
BPy_StructRNA *val = (BPy_StructRNA *)value;
if (val && self->ptr.type && val->ptr.type) {
if (!RNA_struct_idprops_datablock_allowed(self->ptr.type) &&
RNA_struct_idprops_contains_datablock(val->ptr.type)) {
RNA_struct_idprops_contains_datablock(val->ptr.type))
{
PyErr_SetString(
PyExc_TypeError,
"bpy_struct[key] = val: datablock id properties not supported for this type");
@@ -4338,10 +4345,11 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
}
else if (
/* RNA can't start with a "_", so for __dict__ and similar we can skip using RNA lookups. */
name[0] == '_') {
name[0] == '_')
{
/* Annoying exception, maybe we need to have different types for this... */
if (STR_ELEM(name, "__getitem__", "__setitem__") &&
!RNA_struct_idprops_check(self->ptr.type)) {
if (STR_ELEM(name, "__getitem__", "__setitem__") && !RNA_struct_idprops_check(self->ptr.type))
{
PyErr_SetString(PyExc_AttributeError, "bpy_struct: no __getitem__ support for this type");
ret = NULL;
}
@@ -4498,7 +4506,8 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
const char *attr_str = PyUnicode_AsUTF8(attr);
if (srna && !pyrna_write_check() &&
(is_deferred_prop || RNA_struct_type_find_property_no_base(srna, attr_str))) {
(is_deferred_prop || RNA_struct_type_find_property_no_base(srna, attr_str)))
{
PyErr_Format(PyExc_AttributeError,
"pyrna_struct_meta_idprop_setattro() "
"can't set in readonly state '%.200s.%S'",
@@ -5134,8 +5143,9 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
if (RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr)) {
return pyrna_struct_CreatePyObject(&newptr);
}
if (pyrna_prop_collection_string_subscript_supported_or_error(
self, "bpy_prop_collection.get") == -1) {
if (pyrna_prop_collection_string_subscript_supported_or_error(self,
"bpy_prop_collection.get") == -1)
{
return NULL;
}
}
@@ -5368,7 +5378,8 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
RawPropertyType raw_type;
if (foreach_parse_args(
self, args, &attr, &seq, &tot, &size, &raw_type, &attr_tot, &attr_signed) == -1) {
self, args, &attr, &seq, &tot, &size, &raw_type, &attr_tot, &attr_signed) == -1)
{
return NULL;
}
@@ -5654,7 +5665,8 @@ static PyObject *pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self,
else {
const char f = buf.format ? buf.format[0] : 0;
if ((prop_type == PROP_INT && (buf.itemsize != sizeof(int) || !ELEM(f, 'l', 'i'))) ||
(prop_type == PROP_FLOAT && (buf.itemsize != sizeof(float) || f != 'f'))) {
(prop_type == PROP_FLOAT && (buf.itemsize != sizeof(float) || f != 'f')))
{
PyBuffer_Release(&buf);
PyErr_Format(PyExc_TypeError, "incorrect sequence item type: %s", buf.format);
return NULL;
@@ -7279,7 +7291,8 @@ static PyObject *pyrna_srna_Subtype(StructRNA *srna)
#endif
if (RNA_struct_idprops_check(srna) &&
!PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type)) {
!PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type))
{
metaclass = (PyObject *)&pyrna_struct_meta_idprop_Type;
}
else {
@@ -7958,7 +7971,8 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
if (!RNA_struct_idprops_datablock_allowed(srna) &&
(*(PyCFunctionWithKeywords)PyCFunction_GET_FUNCTION(py_func) == BPy_PointerProperty ||
*(PyCFunctionWithKeywords)PyCFunction_GET_FUNCTION(py_func) == BPy_CollectionProperty) &&
RNA_struct_idprops_contains_datablock(type_srna)) {
RNA_struct_idprops_contains_datablock(type_srna))
{
PyErr_Format(PyExc_ValueError,
"bpy_struct \"%.200s\" registration error: "
"'%.200s' %.200s could not register because "
@@ -8064,7 +8078,8 @@ static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict)
/* in both cases PyDict_CheckExact(class_dict) will be true even
* though Operators have a metaclass dict namespace */
if ((annotations_dict = PyDict_GetItem(class_dict, bpy_intern_str___annotations__)) &&
PyDict_CheckExact(annotations_dict)) {
PyDict_CheckExact(annotations_dict))
{
while (PyDict_Next(annotations_dict, &pos, &key, &item)) {
ret = deferred_register_prop(srna, key, item);
@@ -8096,7 +8111,8 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
* This best fits having 'mix-in' classes for operators and render engines.
*/
if (py_superclass != &PyBaseObject_Type &&
!PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type)) {
!PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type))
{
ret = pyrna_deferred_register_class_recursive(srna, py_superclass);
if (ret != 0) {
@@ -8321,8 +8337,7 @@ static int bpy_class_validate_recursive(PointerRNA *dummy_ptr,
/* Sneaky workaround to use the class name as the bl_idname. */
#define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \
else if (STREQ(identifier, rna_attr)) \
{ \
else if (STREQ(identifier, rna_attr)) { \
if ((item = PyObject_GetAttr(py_class, py_attr))) { \
if (item != Py_None) { \
if (pyrna_py_to_prop(dummy_ptr, prop, NULL, item, "validating class:") != 0) { \
@@ -8678,8 +8693,8 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
ReportList *reports;
/* Alert the user, else they won't know unless they see the console. */
if ((!is_staticmethod) && (!is_classmethod) && (ptr->data) &&
RNA_struct_is_a(ptr->type, &RNA_Operator) &&
(is_valid_wm == (CTX_wm_manager(C) != NULL))) {
RNA_struct_is_a(ptr->type, &RNA_Operator) && (is_valid_wm == (CTX_wm_manager(C) != NULL)))
{
wmOperator *op = ptr->data;
reports = op->reports;
}

View File

@@ -199,7 +199,8 @@ static int pyrna_struct_anim_args_parse_no_resolve_fallback(PointerRNA *ptr,
{
bool path_unresolved = false;
if (pyrna_struct_anim_args_parse_ex(
ptr, error_prefix, path, r_path_full, r_index, &path_unresolved) == -1) {
ptr, error_prefix, path, r_path_full, r_index, &path_unresolved) == -1)
{
if (path_unresolved == true) {
if (pyrna_struct_anim_args_parse_no_resolve(ptr, error_prefix, path, r_path_full) == -1) {
return -1;
@@ -239,7 +240,8 @@ static int pyrna_struct_keyframe_parse(PointerRNA *ptr,
r_cfra,
r_group_name,
&PySet_Type,
&pyoptions)) {
&pyoptions))
{
return -1;
}
@@ -255,7 +257,8 @@ static int pyrna_struct_keyframe_parse(PointerRNA *ptr,
if (r_options) {
if (pyoptions &&
(pyrna_enum_bitfield_from_set(
rna_enum_keying_flag_items_api, pyoptions, r_options, error_prefix) == -1)) {
rna_enum_keying_flag_items_api, pyoptions, r_options, error_prefix) == -1))
{
return -1;
}
@@ -319,7 +322,8 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
&index,
&cfra,
&group_name,
&options) == -1) {
&options) == -1)
{
return NULL;
}
@@ -434,7 +438,8 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
&index,
&cfra,
&group_name,
NULL) == -1) {
NULL) == -1)
{
return NULL;
}
@@ -536,7 +541,8 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
}
if (pyrna_struct_anim_args_parse(
&self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) == -1) {
&self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) == -1)
{
return NULL;
}
@@ -618,7 +624,8 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
}
if (pyrna_struct_anim_args_parse_no_resolve_fallback(
&self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) == -1) {
&self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) == -1)
{
return NULL;
}

View File

@@ -144,7 +144,8 @@ static int validate_array_type(PyObject *seq,
is_dynamic,
check_item_type,
item_type_str,
error_prefix) == -1) {
error_prefix) == -1)
{
ok = 0;
}
@@ -402,7 +403,8 @@ static int validate_array(PyObject *rvalue,
(prop_flag & PROP_DYNAMIC) != 0,
check_item_type,
item_type_str,
error_prefix) == -1) {
error_prefix) == -1)
{
return -1;
}
@@ -537,7 +539,8 @@ static int py_to_array(PyObject *seq,
check_item_type,
item_type_str,
&totitem,
error_prefix) == -1) {
error_prefix) == -1)
{
return -1;
}
@@ -643,7 +646,8 @@ static int py_to_array_index(PyObject *py,
check_item_type,
item_type_str,
&totitem,
error_prefix) == -1) {
error_prefix) == -1)
{
return -1;
}

View File

@@ -296,7 +296,8 @@ PyObject *pyrna_callback_classmethod_add(PyObject *UNUSED(self), PyObject *args)
pyrna_enum_value_parse_string,
&params.space_type_enum,
pyrna_enum_value_parse_string,
&params.region_type_enum)) {
&params.region_type_enum))
{
return NULL;
}
@@ -324,7 +325,8 @@ PyObject *pyrna_callback_classmethod_add(PyObject *UNUSED(self), PyObject *args)
pyrna_enum_value_parse_string,
&params.region_type_enum,
pyrna_enum_value_parse_string,
&params.event_enum)) {
&params.event_enum))
{
return NULL;
}
@@ -391,7 +393,8 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar
if (srna == &RNA_WindowManager) {
if (!PyArg_ParseTuple(
args, "OO!:WindowManager.draw_cursor_remove", &cls, &PyCapsule_Type, &py_handle)) {
args, "OO!:WindowManager.draw_cursor_remove", &cls, &PyCapsule_Type, &py_handle))
{
return NULL;
}
handle_removed = WM_paint_cursor_end(handle);
@@ -411,7 +414,8 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar
&PyCapsule_Type,
&py_handle, /* already assigned, no matter */
pyrna_enum_value_parse_string,
&params.region_type_enum)) {
&params.region_type_enum))
{
return NULL;
}

View File

@@ -85,7 +85,8 @@ static PyObject *bpy_rna_context_temp_override_enter(BPyContextTempOverride *sel
return NULL;
}
if ((screen && BLI_findindex(&screen->regionbase, region) == -1) &&
(BLI_findindex(&area->regionbase, region) == -1)) {
(BLI_findindex(&area->regionbase, region) == -1))
{
PyErr_SetString(PyExc_TypeError, "Region not found in area");
return NULL;
}

View File

@@ -78,7 +78,8 @@ bool pyrna_driver_is_equal_anim_rna(const PathResolvedRNA *anim_rna, const PyObj
const PointerRNA *ptr_b = &(((const BPy_StructRNA *)py_anim_rna)->ptr);
if ((ptr_a->owner_id == ptr_b->owner_id) && (ptr_a->type == ptr_b->type) &&
(ptr_a->data == ptr_b->data)) {
(ptr_a->data == ptr_b->data))
{
return true;
}
}

View File

@@ -169,7 +169,8 @@ static void py_rna_gizmo_handler_get_cb(const wmGizmo *UNUSED(gz),
ret,
gz_prop->type->array_length,
&PyFloat_Type,
"Gizmo get callback: ") == -1) {
"Gizmo get callback: ") == -1)
{
goto fail;
}
}
@@ -361,7 +362,8 @@ static PyObject *bpy_gizmo_target_set_handler(PyObject *UNUSED(self), PyObject *
/* `get/set/range` */
&params.py_fn_slots[BPY_GIZMO_FN_SLOT_GET],
&params.py_fn_slots[BPY_GIZMO_FN_SLOT_SET],
&params.py_fn_slots[BPY_GIZMO_FN_SLOT_RANGE_GET])) {
&params.py_fn_slots[BPY_GIZMO_FN_SLOT_RANGE_GET]))
{
goto fail;
}
@@ -450,7 +452,8 @@ static PyObject *bpy_gizmo_target_get_value(PyObject *UNUSED(self), PyObject *ar
&params.gz_with_target.gz,
/* `target` */
py_rna_gizmo_target_id_parse_and_ensure_is_valid,
&params.gz_with_target)) {
&params.gz_with_target))
{
goto fail;
}
@@ -517,7 +520,8 @@ static PyObject *bpy_gizmo_target_set_value(PyObject *UNUSED(self), PyObject *ar
py_rna_gizmo_target_id_parse_and_ensure_is_valid,
&params.gz_with_target,
/* `value` */
&params.value)) {
&params.value))
{
goto fail;
}
@@ -534,7 +538,8 @@ static PyObject *bpy_gizmo_target_set_value(PyObject *UNUSED(self), PyObject *ar
params.value,
gz_prop->type->array_length,
&PyFloat_Type,
"Gizmo target property array: ") == -1) {
"Gizmo target property array: ") == -1)
{
goto fail;
}
WM_gizmo_target_property_float_set_array(BPY_context_get(), gz, gz_prop, value);
@@ -590,7 +595,8 @@ static PyObject *bpy_gizmo_target_get_range(PyObject *UNUSED(self), PyObject *ar
&params.gz_with_target.gz,
/* `target` */
py_rna_gizmo_target_id_parse_and_ensure_is_valid,
&params.gz_with_target)) {
&params.gz_with_target))
{
goto fail;
}

View File

@@ -168,7 +168,8 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, &subset, &PySet_Type, &key_types, &PySet_Type, &val_types)) {
args, kwds, &_parser, &subset, &PySet_Type, &key_types, &PySet_Type, &val_types))
{
return NULL;
}
@@ -226,7 +227,8 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
(key_types_bitmap == NULL || id_check_type(id, key_types_bitmap)) &&
/* We do not want to pre-add keys when we have filter on value types,
* but not on key types. */
(val_types_bitmap == NULL || key_types_bitmap != NULL)) {
(val_types_bitmap == NULL || key_types_bitmap != NULL))
{
PyObject *key = pyrna_id_CreatePyObject(id);
PyObject *set;
@@ -394,7 +396,8 @@ static PyObject *bpy_orphans_purge(PyObject *UNUSED(self), PyObject *args, PyObj
PyC_ParseBool,
&do_linked_ids,
PyC_ParseBool,
&do_recursive_cleanup)) {
&do_recursive_cleanup))
{
return NULL;
}

View File

@@ -71,7 +71,8 @@ static PyObject *bpy_rna_region_as_string(PyObject *self, PyObject *args, PyObje
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser, &region.curl, &region.curc, &region.sell, &region.selc)) {
args, kwds, &_parser, &region.curl, &region.curc, &region.sell, &region.selc))
{
return NULL;
}
@@ -136,7 +137,8 @@ static PyObject *bpy_rna_region_from_string(PyObject *self, PyObject *args, PyOb
&region.curl,
&region.curc,
&region.sell,
&region.selc)) {
&region.selc))
{
return NULL;
}

View File

@@ -201,11 +201,13 @@ bool python_script_error_jump(
r_offset,
r_lineno_end,
r_offset_end,
&text_py)) {
&text_py))
{
const char *filepath_exc = PyUnicode_AsUTF8(filepath_exc_py);
/* python adds a '/', prefix, so check for both */
if ((BLI_path_cmp(filepath_exc, filepath) == 0) ||
(ELEM(filepath_exc[0], '\\', '/') && BLI_path_cmp(filepath_exc + 1, filepath) == 0)) {
(ELEM(filepath_exc[0], '\\', '/') && BLI_path_cmp(filepath_exc + 1, filepath) == 0))
{
success = true;
}
}
@@ -216,7 +218,8 @@ bool python_script_error_jump(
for (tb = (PyTracebackObject *)PySys_GetObject("last_traceback");
tb && (PyObject *)tb != Py_None;
tb = tb->tb_next) {
tb = tb->tb_next)
{
PyObject *coerce;
const char *tb_filepath = traceback_filepath(tb, &coerce);
const int match = ((BLI_path_cmp(tb_filepath, filepath) == 0) ||

View File

@@ -186,7 +186,8 @@ static PyObject *bpyunits_to_value(PyObject *UNUSED(self), PyObject *args, PyObj
0,
};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser, &usys_str, &ucat_str, &inpt, &str_len, &uref)) {
args, kw, &_parser, &usys_str, &ucat_str, &inpt, &str_len, &uref))
{
return NULL;
}
@@ -283,7 +284,8 @@ static PyObject *bpyunits_to_string(PyObject *UNUSED(self), PyObject *args, PyOb
PyC_ParseBool,
&split_unit,
PyC_ParseBool,
&compatible_unit)) {
&compatible_unit))
{
return NULL;
}

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;
}