Optimization: pass Main to BKE_library_foreach_ID_link() and use its relations.

Use Main->relations in BKE_library_foreach_ID_link(), when possible
(i.e. IDWALK_READONLY is set), and if the data is available of course.

This is quite minor optimization, no sensible improvements are expected,
but does not hurt either to avoid potentially tens of looping over e.g.
objects constraints and modifiers, or heap of drivers...
This commit is contained in:
2017-01-30 21:41:44 +01:00
parent fbd28d375a
commit eadfd901ad
10 changed files with 41 additions and 26 deletions

View File

@@ -263,7 +263,7 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
}
data_cb.id_curr = id;
BKE_library_foreach_ID_link(id, foreach_libblock_id_user_map_callback, &data_cb, IDWALK_NOP);
BKE_library_foreach_ID_link(NULL, id, foreach_libblock_id_user_map_callback, &data_cb, IDWALK_NOP);
if (data_cb.py_id_curr) {
Py_DECREF(data_cb.py_id_curr);