Example #1
0
PyObject *BPy_Wrap_GetKeys(IDProperty *prop)
{
    PyObject *seq = PyList_New(prop->len);
    IDProperty *loop;
    int i;

    for (i=0, loop=prop->data.group.first; loop && (i < prop->len); loop=loop->next, i++)
        PyList_SET_ITEM(seq, i, PyUnicode_FromString(loop->name));

    /* if the id prop is corrupt, count the remaining */
    for (; loop; loop=loop->next, i++) {}

    if (i != prop->len) { /* if the loop didnt finish, we know the length is wrong */
        BPy_IDGroup_CorrectListLen(prop, seq, i);
        Py_DECREF(seq); /*free the list*/
        /*call self again*/
        return BPy_Wrap_GetKeys(prop);
    }

    return seq;
}
Example #2
0
static PyObject *BPy_IDGroup_GetKeys(BPy_IDProperty *self)
{
    return BPy_Wrap_GetKeys(self->prop);
}