diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-18 19:14:40 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-18 19:16:33 +0300 |
commit | aed631fa477984b6b0041ae047aa4994c566dc21 (patch) | |
tree | f5421c1fddece3583e02c5d78a11dc1b10c332b3 /source | |
parent | 1414c4496cc492320ec5076fe17cfb8e89df6a01 (diff) |
Fix (unreported) wrong handling of some parameters combination in `bpy.data.user_map()`
Would add undesired keys...
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/intern/bpy_rna_id_collection.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c index 72c808aa630..31b135fe933 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.c +++ b/source/blender/python/intern/bpy_rna_id_collection.c @@ -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); |