Closed cmbasnett closed 11 months ago
@cmbasnett
We use bpy_prop_array
to represent the Iterable.
Ref: #125
BTW, all parameters not properties should be handled as typing.Iterable
instead of bpy_prop_array
?
I'm afraid that fixed patch will make another side-effect.
@cmbasnett
Any response about above comment?
I'm not sure if all of them should, as it depends on the internal implementation of the function in the C code.
In the code for VertexGroup.add, index
(a bad name to begin with), it has the following for the argument:
/* TODO: see how array size of 0 works, this shouldn't be used. */
parm = RNA_def_int_array(func, "index", 1, nullptr, 0, 0, "", "List of indices", 0, 0);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
I suppose it is automatically converting the iterator to a List, since the RNA functions take the indices like this:
static void rna_VertexGroup_vertex_add(ID *id,
bDeformGroup *def,
ReportList *reports,
const int *index,
int index_num,
float weight,
int assignmode)
I think it would be a pretty safe assumption that iterators could be used for this one and other arguments that take a list of integers.
This issue is now fixed.
System Information
Expected behavior
When calling
VertexGroup.add
, I should be able to pass in anIterable[int]
(e.g.,range
,map
etc.).Description about the bug
The
index
argument only acceptsbpy_prop_array[int]
(I don't think this is even correct).Screenshots/Files [Optional]
Additional comments [Optional]