diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-18 18:13:11 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-18 19:16:33 +0300 |
commit | 00d2e9096f8b57027e5ff48b057856d5b4b0f3cf (patch) | |
tree | 1636ea663910c56bd02a9c06e38f7ebcb7ee3586 /source/blender/blenkernel/intern/blendfile.c | |
parent | 4c2330bd537a6a6d1fa0030fe0bb14380dc7eeb6 (diff) |
ID management: use FOREACH_MAIN_ID in some places.
Diffstat (limited to 'source/blender/blenkernel/intern/blendfile.c')
-rw-r--r-- | source/blender/blenkernel/intern/blendfile.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index c410e6a718c..e7ea38d845b 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -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 */ |