ID management: use FOREACH_MAIN_ID in some places.

This commit is contained in:
Bastien Montagne 2019-02-18 16:13:11 +01:00
parent 4c2330bd53
commit 00d2e9096f
1 changed files with 6 additions and 13 deletions

View File

@ -460,23 +460,16 @@ bool BKE_blendfile_read_from_memfile(
void BKE_blendfile_read_make_empty(bContext *C)
{
Main *bmain = CTX_data_main(C);
ListBase *lbarray[MAX_LIBARRAY];
ID *id;
int a;
a = set_listbasepointers(bmain, lbarray);
while (a--) {
id = lbarray[a]->first;
if (id != NULL) {
if (ELEM(GS(id->name), ID_SCE, ID_SCR, ID_WM, ID_WS)) {
continue;
}
while ((id = lbarray[a]->first)) {
BKE_id_delete(bmain, id);
}
FOREACH_MAIN_ID_BEGIN(bmain, id)
{
if (ELEM(GS(id->name), ID_SCE, ID_SCR, ID_WM, ID_WS)) {
break; /* Only breaks iter on that ID type, and continues with IDs of next type. */
}
BKE_id_delete(bmain, id);
}
FOREACH_MAIN_ID_END;
}
/* only read the userdef from a .blend */