Fix (unreported) wrong handling of some parameters combination in bpy.data.user_map()
Would add undesired keys...
This commit is contained in:
@@ -225,7 +225,8 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
|
||||
|
||||
FOREACH_MAIN_ID_BEGIN(bmain, id)
|
||||
{
|
||||
if (val_types_bitmap != NULL) {
|
||||
/* We cannot skip here in case we have some filter on key types... */
|
||||
if (key_types_bitmap == NULL && val_types_bitmap != NULL) {
|
||||
if (!id_check_type(id, val_types_bitmap)) {
|
||||
break; /* Break iter on that type of IDs, continues with next ID type. */
|
||||
}
|
||||
@@ -238,7 +239,12 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
|
||||
data_cb.py_id_key_lookup_only = pyrna_id_CreatePyObject(id);
|
||||
}
|
||||
|
||||
if (!data_cb.is_subset) {
|
||||
if (!data_cb.is_subset &&
|
||||
/* We do not want to pre-add keys of flitered out types. */
|
||||
(key_types_bitmap == NULL || id_check_type(id, key_types_bitmap)) &&
|
||||
/* We do not want to pre-add keys when we have filter on value types, but not on key types. */
|
||||
(val_types_bitmap == NULL || key_types_bitmap != NULL))
|
||||
{
|
||||
PyObject *key = data_cb.py_id_key_lookup_only;
|
||||
PyObject *set;
|
||||
|
||||
@@ -255,6 +261,10 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
|
||||
}
|
||||
}
|
||||
|
||||
if (val_types_bitmap != NULL && !id_check_type(id, val_types_bitmap)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
data_cb.id_curr = id;
|
||||
BKE_library_foreach_ID_link(NULL, id, foreach_libblock_id_user_map_callback, &data_cb, IDWALK_CB_NOP);
|
||||
|
||||
|
Reference in New Issue
Block a user