Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2019-02-07 23:52:54 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-02-07 23:52:54 +0300
commitdd6dcf824793f62b70611cf588f52ab372697dbf (patch)
treec65654d8c9baae6c5a542f3a9ec7857fac6834bd /source/blender/blenkernel/intern/main.c
parent949bc7aa2a73df4a96b284c2f8182ec533878246 (diff)
Cleanup: Use new BKE_main_foreach_id() in a few more places...
Diffstat (limited to 'source/blender/blenkernel/intern/main.c')
-rw-r--r--source/blender/blenkernel/intern/main.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/main.c b/source/blender/blenkernel/intern/main.c
index 2d3988ed8f5..d5b9147b34f 100644
--- a/source/blender/blenkernel/intern/main.c
+++ b/source/blender/blenkernel/intern/main.c
@@ -140,7 +140,7 @@ void BKE_main_unlock(struct Main *bmain)
}
-static int main_relations_create_cb(void *user_data, ID *id_self, ID **id_pointer, int cb_flag)
+static int main_relations_create_idlink_cb(void *user_data, ID *id_self, ID **id_pointer, int cb_flag)
{
MainIDRelations *rel = user_data;
@@ -173,13 +173,15 @@ static int main_relations_create_cb(void *user_data, ID *id_self, ID **id_pointe
return IDWALK_RET_NOP;
}
+static bool main_relations_create_id_cb(Main *bmain, ID *id, void *UNUSED(user_data))
+{
+ BKE_library_foreach_ID_link(NULL, id, main_relations_create_idlink_cb, bmain->relations, IDWALK_READONLY);
+ return true;
+}
+
/** Generate the mappings between used IDs and their users, and vice-versa. */
void BKE_main_relations_create(Main *bmain)
{
- ListBase *lbarray[MAX_LIBARRAY];
- ID *id;
- int a;
-
if (bmain->relations != NULL) {
BKE_main_relations_free(bmain);
}
@@ -189,11 +191,7 @@ void BKE_main_relations_create(Main *bmain)
bmain->relations->id_user_to_used = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__);
bmain->relations->entry_pool = BLI_mempool_create(sizeof(MainIDRelationsEntry), 128, 128, BLI_MEMPOOL_NOP);
- for (a = set_listbasepointers(bmain, lbarray); a--; ) {
- for (id = lbarray[a]->first; id; id = id->next) {
- BKE_library_foreach_ID_link(NULL, id, main_relations_create_cb, bmain->relations, IDWALK_READONLY);
- }
- }
+ BKE_main_foreach_id(bmain, false, main_relations_create_id_cb, NULL);
}
void BKE_main_relations_free(Main *bmain)
@@ -237,6 +235,7 @@ bool BKE_main_listbase_foreach_id(
* \param reverse_type_order Allow to reverse order in which ID *types* are handled
* (i.e. does not reverse the order in which IDs themselves are handled
* whithin a give listbase).
+ * Note that in most cases, you want to set that parameter to true.
* \return false if the iteration was iterrupted by the callback.
*
* \warning \a callback may affect the ID, but DO NOT change the Main database (add/remove/reorder its IDs).