PyRNA: all optional args now must be keyword args

In some cases the RNA API should be updated to make arguments use the
'required' flag, instead of adjusting Python scripts.

See T47811
This commit is contained in:
Campbell Barton 2018-08-28 13:50:24 +10:00
parent 5bf42ce022
commit 039b11f349
2 changed files with 11 additions and 1 deletions

View File

@ -78,7 +78,6 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
elif probe.type == 'PLANAR':
col = layout.column()
col.prop(probe, "influence_distance", text="Distance")
col.prop(probe, "falloff")
else:
col = layout.column()
col.prop(probe, "influence_type")

View File

@ -5654,6 +5654,17 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
item = NULL;
if (i < pyargs_len) {
/* New in 2.8x, optional arguments must be keywords. */
if (UNLIKELY((flag_parameter & PARM_REQUIRED) == 0)) {
PyErr_Format(PyExc_TypeError,
"%.200s.%.200s(): required parameter \"%.200s\" to be a keyword argument!",
RNA_struct_identifier(self_ptr->type),
RNA_function_identifier(self_func),
RNA_property_identifier(parm));
err = -1;
break;
}
item = PyTuple_GET_ITEM(args, i);
kw_arg = false;
}