diff options
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 93106d5400f..a3b0c4739c4 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -58,7 +58,7 @@ #include "../generic/IDProp.h" /* for IDprop lookups */ #include "../generic/py_capi_utils.h" -static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix); +static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix); static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length); static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self); static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self); @@ -135,7 +135,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype) return 1; } -static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int index) +static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtype), int index) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -146,7 +146,7 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int return 1; } -static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int index) +static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtype), int index) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -176,7 +176,7 @@ Mathutils_Callback mathutils_rna_array_cb = { /* bpyrna matrix callbacks */ static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */ -static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype) +static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -187,7 +187,7 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype) return 1; } -static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype) +static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -864,7 +864,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha break; } } else { - if (pyrna_py_to_prop(ptr, prop, NULL, NULL, item, error_prefix)) { + if (pyrna_py_to_prop(ptr, prop, NULL, item, error_prefix)) { error_val= -1; break; } @@ -918,7 +918,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func) -static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix) +static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix) { /* XXX hard limits should be checked here */ int type = RNA_property_type(prop); @@ -941,7 +941,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p return -1; } /* done getting the length */ - ok= pyrna_py_to_array(ptr, prop, parms, data, value, error_prefix); + ok= pyrna_py_to_array(ptr, prop, data, value, error_prefix); if (!ok) { /* PyErr_Format(PyExc_AttributeError, "%.200s %s", error_prefix, error_str); */ @@ -964,7 +964,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p else param = PyLong_AsLong( value ); - if( param < 0 || param > 1) { + if(param < 0) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; } else { @@ -1391,7 +1391,7 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons } /* static PyObject *pyrna_prop_array_subscript_str(BPy_PropertyRNA *self, char *keyname) */ -static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length) +static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop) { PointerRNA newptr; PyObject *list = PyList_New(stop - start); @@ -1513,7 +1513,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject return PyList_New(0); } else if (step == 1) { - return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop, len); + return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop); } else { PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported with rna"); @@ -2431,7 +2431,7 @@ static char pyrna_struct_type_recast_doc[] = " :return: a new instance of this object with the type initialized again.\n" " :rtype: subclass of :class:`bpy_struct`"; -static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self, PyObject *args) +static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self) { PointerRNA r_ptr; RNA_pointer_recast(&self->ptr, &r_ptr); @@ -2751,7 +2751,7 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported"); return -1; } - return pyrna_py_to_prop(&self->ptr, prop, NULL, NULL, value, "bpy_struct: item.attr = val:"); + return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr = val:"); } else { return PyObject_GenericSetAttr((PyObject *)self, pyname, value); @@ -2835,7 +2835,7 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna else if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { if ((prop = RNA_struct_find_property(&r_ptr, name))) { /* pyrna_py_to_prop sets its own exceptions */ - return pyrna_py_to_prop(&r_ptr, prop, NULL, NULL, value, "BPy_PropertyRNA - Attribute (setattr):"); + return pyrna_py_to_prop(&r_ptr, prop, NULL, value, "BPy_PropertyRNA - Attribute (setattr):"); } } @@ -3409,7 +3409,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = { /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ -static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { +static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { BPy_StructRNA *base; @@ -3432,7 +3432,7 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ -static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { +static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { BPy_PropertyRNA *base; @@ -3454,15 +3454,14 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *k } } -PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *prop, void *data) +PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data) { PyObject *ret; int type = RNA_property_type(prop); int flag = RNA_property_flag(prop); - int a; if(RNA_property_array_check(ptr, prop)) { - int len; + int a, len; if (flag & PROP_DYNAMIC) { ParameterDynAlloc *data_alloc= data; @@ -3705,7 +3704,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) continue; } - err= pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, ""); + err= pyrna_py_to_prop(&funcptr, parm, iter.data, item, ""); if(err!=0) { /* the error generated isnt that useful, so generate it again with a useful prefix @@ -3718,7 +3717,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) else snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with argument %d, \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), i, parm_id); - pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, error_prefix); + pyrna_py_to_prop(&funcptr, parm, iter.data, item, error_prefix); break; } @@ -3823,13 +3822,13 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) flag= RNA_property_flag(parm); if (flag & PROP_OUTPUT) - PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, &parms, parm, iter.data)); + PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, parm, iter.data)); } RNA_parameter_list_end(&iter); } else - ret= pyrna_param_to_py(&funcptr, &parms, pret_single, retdata_single); + ret= pyrna_param_to_py(&funcptr, pret_single, retdata_single); /* possible there is an error in conversion */ if(ret==NULL) @@ -5013,7 +5012,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun if(strcmp(identifier, rna_attr) == 0) { \ item= PyObject_GetAttrString(py_class, py_attr); \ if(item && item != Py_None) { \ - if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) { \ + if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) { \ Py_DECREF(item); \ return -1; \ } \ @@ -5037,7 +5036,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun else { Py_DECREF(item); /* no need to keep a ref, the class owns it */ - if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) + if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) return -1; } } @@ -5157,7 +5156,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par continue; } - parmitem= pyrna_param_to_py(&funcptr, parms, parm, iter.data); + parmitem= pyrna_param_to_py(&funcptr, parm, iter.data); PyTuple_SET_ITEM(args, i, parmitem); i++; } @@ -5192,7 +5191,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par err= -1; } else if(ret_len==1) { - err= pyrna_py_to_prop(&funcptr, pret_single, parms, retdata_single, ret, "calling class function:"); + err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, "calling class function:"); } else if (ret_len > 1) { @@ -5215,7 +5214,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par /* only useful for single argument returns, we'll need another list loop for multiple */ if (flag & PROP_OUTPUT) { - err= pyrna_py_to_prop(&funcptr, parm, parms, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:"); + err= pyrna_py_to_prop(&funcptr, parm, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:"); if(err) break; } @@ -5329,7 +5328,7 @@ void pyrna_free_types(void) * - Should still be fixed - Campbell * */ -static PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class) +static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_class) { bContext *C= NULL; ReportList reports; @@ -5426,7 +5425,7 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN return 0; } -static PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class) +static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_class) { bContext *C= NULL; StructUnregisterFunc unreg; |