[Bf-blender-cvs] [00d2e9096f8] master: ID management: use FOREACH_MAIN_ID in some places.

Bastien Montagne noreply at git.blender.org
Mon Feb 18 17:16:49 CET 2019


Commit: 00d2e9096f8b57027e5ff48b057856d5b4b0f3cf
Author: Bastien Montagne
Date:   Mon Feb 18 16:13:11 2019 +0100
Branches: master
https://developer.blender.org/rB00d2e9096f8b57027e5ff48b057856d5b4b0f3cf

ID management: use FOREACH_MAIN_ID in some places.

===================================================================

M	source/blender/blenkernel/intern/blendfile.c

===================================================================

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 */



More information about the Bf-blender-cvs mailing list