diff options
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.c | 5 | ||||
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 12 | ||||
-rw-r--r-- | source/blender/python/gpu/gpu_py_matrix.c | 9 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_capi_utils.c | 7 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 17 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_operator.c | 4 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 9 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 58 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_array.c | 13 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_callback.c | 18 |
10 files changed, 89 insertions, 63 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 522927f56e2..279208993a0 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -4071,9 +4071,8 @@ int bpy_bm_generic_valid_check(BPy_BMGeneric *self) * the previous action. */ #if 0 if (BM_mesh_validate(self->bm) == false) { - PyErr_Format(PyExc_ReferenceError, - "BMesh used by %.200s has become invalid", - Py_TYPE(self)->tp_name); + PyErr_Format( + PyExc_ReferenceError, "BMesh used by %.200s has become invalid", Py_TYPE(self)->tp_name); return -1; } #endif diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index d96bef797cb..056e3a33b6e 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -168,8 +168,7 @@ PyObject *BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent) static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value) { switch (prop->type) { - case IDP_STRING: - { + case IDP_STRING: { char *st; if (!PyUnicode_Check(value)) { PyErr_SetString(PyExc_TypeError, "expected a string!"); @@ -198,8 +197,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject return 0; } - case IDP_INT: - { + case IDP_INT: { int ivalue = PyLong_AsSsize_t(value); if (ivalue == -1 && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "expected an int type"); @@ -208,8 +206,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject IDP_Int(prop) = ivalue; break; } - case IDP_FLOAT: - { + case IDP_FLOAT: { float fvalue = (float)PyFloat_AsDouble(value); if (fvalue == -1 && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "expected a float"); @@ -218,8 +215,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject IDP_Float(self->prop) = fvalue; break; } - case IDP_DOUBLE: - { + case IDP_DOUBLE: { double dvalue = PyFloat_AsDouble(value); if (dvalue == -1 && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "expected a float"); diff --git a/source/blender/python/gpu/gpu_py_matrix.c b/source/blender/python/gpu/gpu_py_matrix.c index 85d65ee4e2c..93cca78bad9 100644 --- a/source/blender/python/gpu/gpu_py_matrix.c +++ b/source/blender/python/gpu/gpu_py_matrix.c @@ -505,12 +505,9 @@ static struct PyMethodDef bpygpu_matrix_methods[] = { /* TODO */ #if 0 - {"rotate", (PyCFunction)bpygpu_matrix_rotate, - METH_O, bpygpu_matrix_rotate_doc}, - {"rotate_axis", (PyCFunction)bpygpu_matrix_rotate_axis, - METH_O, bpygpu_matrix_rotate_axis_doc}, - {"look_at", (PyCFunction)bpygpu_matrix_look_at, - METH_O, bpygpu_matrix_look_at_doc}, + {"rotate", (PyCFunction)bpygpu_matrix_rotate, METH_O, bpygpu_matrix_rotate_doc}, + {"rotate_axis", (PyCFunction)bpygpu_matrix_rotate_axis, METH_O, bpygpu_matrix_rotate_axis_doc}, + {"look_at", (PyCFunction)bpygpu_matrix_look_at, METH_O, bpygpu_matrix_look_at_doc}, #endif /* Write State */ diff --git a/source/blender/python/intern/bpy_capi_utils.c b/source/blender/python/intern/bpy_capi_utils.c index db1684a7bca..2ff357896d5 100644 --- a/source/blender/python/intern/bpy_capi_utils.c +++ b/source/blender/python/intern/bpy_capi_utils.c @@ -136,7 +136,12 @@ bool BPy_errors_to_report_ex(ReportList *reports, const bool use_full, const boo } #if 0 /* ARG!. workaround for a bug in blenders use of vsnprintf */ - BKE_reportf(reports, RPT_ERROR, "%s\nlocation: %s:%d\n", _PyUnicode_AsString(pystring), filename, lineno); + BKE_reportf(reports, + RPT_ERROR, + "%s\nlocation: %s:%d\n", + _PyUnicode_AsString(pystring), + filename, + lineno); #else pystring_format = PyUnicode_FromFormat( TIP_("%s\nlocation: %s:%d\n"), _PyUnicode_AsString(pystring), filename, lineno); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 1b36ded884d..774ce2b9422 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -184,7 +184,7 @@ void BPY_modules_update(bContext *C) #if 0 /* slow, this runs all the time poll, draw etc 100's of time a sec. */ PyObject *mod = PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0); PyModule_AddObject(mod, "data", BPY_rna_module()); - PyModule_AddObject(mod, "types", BPY_rna_types()); /* atm this does not need updating */ + PyModule_AddObject(mod, "types", BPY_rna_types()); /* atm this does not need updating */ #endif /* refreshes the main struct */ @@ -213,9 +213,9 @@ static PyObject *CCL_initPython(void) static struct _inittab bpy_internal_modules[] = { {"mathutils", PyInit_mathutils}, #if 0 - {"mathutils.geometry", PyInit_mathutils_geometry}, - {"mathutils.noise", PyInit_mathutils_noise}, - {"mathutils.kdtree", PyInit_mathutils_kdtree}, + {"mathutils.geometry", PyInit_mathutils_geometry}, + {"mathutils.noise", PyInit_mathutils_noise}, + {"mathutils.kdtree", PyInit_mathutils_kdtree}, #endif {"_bpy_path", BPyInit__bpy_path}, {"bgl", BPyInit_bgl}, @@ -223,9 +223,9 @@ static struct _inittab bpy_internal_modules[] = { {"imbuf", BPyInit_imbuf}, {"bmesh", BPyInit_bmesh}, #if 0 - {"bmesh.types", BPyInit_bmesh_types}, - {"bmesh.utils", BPyInit_bmesh_utils}, - {"bmesh.utils", BPyInit_bmesh_geometry}, + {"bmesh.types", BPyInit_bmesh_types}, + {"bmesh.utils", BPyInit_bmesh_utils}, + {"bmesh.utils", BPyInit_bmesh_geometry}, #endif #ifdef WITH_AUDASPACE {"aud", AUD_initPython}, @@ -841,7 +841,8 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult * if (BPy_StructRNA_Check(list_item)) { #if 0 - CollectionPointerLink *link = MEM_callocN(sizeof(CollectionPointerLink), "bpy_context_get"); + CollectionPointerLink *link = MEM_callocN(sizeof(CollectionPointerLink), + "bpy_context_get"); link->ptr = ((BPy_StructRNA *)item)->ptr; BLI_addtail(&result->list, link); #endif diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 1e979ad1d0b..2c31fcda12d 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -298,9 +298,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) { /* no props */ if (kw != NULL) { - PyErr_Format(PyExc_AttributeError, - "Operator \"%s\" does not take any args", - opname); + PyErr_Format(PyExc_AttributeError, "Operator \"%s\" does not take any args", opname); return NULL; } diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 19315d9f2cc..a0a6c73fe1f 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -1382,7 +1382,11 @@ static size_t strswapbufcpy(char *buf, const char **orig) char *dst = buf; size_t i = 0; *orig = buf; - while ((*dst = *src)) { dst++; src++; i++; } + while ((*dst = *src)) { + dst++; + src++; + i++; + } return i + 1; /* include '\0' */ } #endif @@ -1541,7 +1545,8 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, * immediately after use, so we need to duplicate them, ugh. * annoying because it works most of the time without this. */ { - EnumPropertyItem *items_dup = MEM_mallocN((sizeof(EnumPropertyItem) * (seq_len + 1)) + (sizeof(char) * totbuf), + EnumPropertyItem *items_dup = MEM_mallocN((sizeof(EnumPropertyItem) * (seq_len + 1)) + + (sizeof(char) * totbuf), "enum_items_from_py2"); EnumPropertyItem *items_ptr = items_dup; char *buf = ((char *)items_dup) + (sizeof(EnumPropertyItem) * (seq_len + 1)); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index cf45d6ca2d9..1f041b4ca48 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1448,11 +1448,14 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) #if 0 /* gives python decoding errors while generating docs :( */ char error_str[256]; - BLI_snprintf(error_str, sizeof(error_str), + BLI_snprintf(error_str, + sizeof(error_str), "RNA Warning: Current value \"%d\" " "matches no enum in '%s', '%s', '%s'", - val, RNA_struct_identifier(ptr->type), - ptr_name, RNA_property_identifier(prop)); + val, + RNA_struct_identifier(ptr->type), + ptr_name, + RNA_property_identifier(prop)); PyErr_Warn(PyExc_RuntimeWarning, error_str); #endif @@ -1464,8 +1467,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) ret = PyUnicode_FromString(""); #if 0 - PyErr_Format(PyExc_AttributeError, - "RNA Error: Current value \"%d\" matches no enum", val); + PyErr_Format(PyExc_AttributeError, "RNA Error: Current value \"%d\" matches no enum", val); ret = NULL; #endif } @@ -2807,14 +2809,18 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX; /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */ - if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL; - if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL; + if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) + return NULL; + if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) + return NULL; if (start < 0 || stop < 0) { /* only get the length for negative values */ Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); - if (start < 0) start += len; - if (stop < 0) stop += len; + if (start < 0) + start += len; + if (stop < 0) + stop += len; } if (stop - start <= 0) { @@ -4262,9 +4268,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) } else { #if 0 - PyErr_Format(PyExc_AttributeError, - "bpy_struct: attribute \"%.200s\" not found", - name); + PyErr_Format(PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" not found", name); ret = NULL; #endif /* Include this in case this instance is a subtype of a python class @@ -5113,14 +5117,14 @@ static int foreach_parse_args(BPy_PropertyRNA *self, array_tot = RNA_property_array_length(&self->ptr, self->prop); } - target_tot = array_tot * (*attr_tot); /* rna_access.c - rna_raw_access(...) uses this same method */ if (target_tot != (*tot)) { PyErr_Format(PyExc_TypeError, "foreach_get(attr, sequence) sequence length mismatch given %d, needed %d", - *tot, target_tot); + *tot, + target_tot); return -1; } #endif @@ -5482,11 +5486,14 @@ static struct PyMethodDef pyrna_struct_methods[] = { /* experimental */ /* unused for now */ #if 0 - {"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS, NULL}, - {"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS, NULL}, + {"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS, NULL}, + {"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS, NULL}, - {"callback_add", (PyCFunction)pyrna_callback_classmethod_add, METH_VARARGS | METH_CLASS, NULL}, - {"callback_remove", (PyCFunction)pyrna_callback_classmethod_remove, METH_VARARGS | METH_CLASS, NULL}, + {"callback_add", (PyCFunction)pyrna_callback_classmethod_add, METH_VARARGS | METH_CLASS, NULL}, + {"callback_remove", + (PyCFunction)pyrna_callback_classmethod_remove, + METH_VARARGS | METH_CLASS, + NULL}, #endif {NULL, NULL, 0, NULL}, }; @@ -5852,7 +5859,10 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject int lineno; PyC_FileAndNum(&fn, &lineno); printf("pyrna_func_call > %.200s.%.200s : %.200s:%d\n", - RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), fn, lineno); + RNA_struct_identifier(self_ptr->type), + RNA_function_identifier(self_func), + fn, + lineno); } #endif @@ -7090,8 +7100,8 @@ static PyObject *pyrna_srna_Subtype(StructRNA *srna) /* always use O not N when calling, N causes refcount errors */ #if 0 - newclass = PyObject_CallFunction(metaclass, "s(O) {sss()}", - idname, py_base, "__module__", "bpy.types", "__slots__"); + newclass = PyObject_CallFunction( + metaclass, "s(O) {sss()}", idname, py_base, "__module__", "bpy.types", "__slots__"); #else { /* longhand of the call above */ @@ -8521,8 +8531,10 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class #if 0 if (RNA_struct_py_type_get(srna)) { PyErr_Format(PyExc_ValueError, - "register_class(...): %.200s's parent class %.200s is already registered, this is not allowed", - ((PyTypeObject *)py_class)->tp_name, RNA_struct_identifier(srna)); + "register_class(...): %.200s's parent class %.200s is already registered, this " + "is not allowed", + ((PyTypeObject *)py_class)->tp_name, + RNA_struct_identifier(srna)); return NULL; } #endif diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index 7097999201a..847ecde354a 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -283,8 +283,12 @@ static int validate_array_length(PyObject *rvalue, /* BLI_snprintf(error_str, error_str_size, * "%s.%s: array length cannot be changed to %d", * RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */ - PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d", - error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); + PyErr_Format(PyExc_ValueError, + "%s %s.%s: array length cannot be changed to %d", + error_prefix, + RNA_struct_identifier(ptr->type), + RNA_property_identifier(prop), + tot); return -1; } #else @@ -883,7 +887,10 @@ PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index) #if 0 /* XXX this is not used (and never will?) */ /* Given an array property, creates an N-dimensional tuple of values. */ -static PyObject *pyrna_py_from_array_internal(PointerRNA *ptr, PropertyRNA *prop, int dim, int *index) +static PyObject *pyrna_py_from_array_internal(PointerRNA *ptr, + PropertyRNA *prop, + int dim, + int *index) { PyObject *tuple; int i, len; diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index b24a28229aa..7d690cb7d47 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -135,7 +135,12 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args) char *cb_event_str = NULL; int cb_event; - if (!PyArg_ParseTuple(args, "OO!|s:bpy_struct.callback_add", &cb_func, &PyTuple_Type, &cb_args, &cb_event_str)) { + if (!PyArg_ParseTuple(args, + "OO!|s:bpy_struct.callback_add", + &cb_func, + &PyTuple_Type, + &cb_args, + &cb_event_str)) { return NULL; } @@ -147,9 +152,8 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args) if (RNA_struct_is_a(self->ptr.type, &RNA_Region)) { if (cb_event_str) { if (pyrna_enum_value_from_id( - region_draw_mode_items, cb_event_str, - &cb_event, "bpy_struct.callback_add()") == -1) - { + region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") == + -1) { return NULL; } } @@ -157,7 +161,8 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args) cb_event = REGION_DRAW_POST_PIXEL; } - handle = ED_region_draw_cb_activate(((ARegion *)self->ptr.data)->type, cb_region_draw, (void *)args, cb_event); + handle = ED_region_draw_cb_activate( + ((ARegion *)self->ptr.data)->type, cb_region_draw, (void *)args, cb_event); Py_INCREF(args); } else { @@ -181,7 +186,8 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args) handle = PyCapsule_GetPointer(py_handle, rna_capsual_id); if (handle == NULL) { - PyErr_SetString(PyExc_ValueError, "callback_remove(handle): NULL handle given, invalid or already removed"); + PyErr_SetString(PyExc_ValueError, + "callback_remove(handle): NULL handle given, invalid or already removed"); return NULL; } |