[Bf-blender-cvs] [43b255a2a16] datablock_idprops: Cleanup: remove 'generic' ID liblink function in readfile.c

Bastien Montagne noreply at git.blender.org
Mon Mar 27 16:57:40 CEST 2017


Commit: 43b255a2a16d26a7df168742193a440f79eec694
Author: Bastien Montagne
Date:   Mon Mar 27 16:50:15 2017 +0200
Branches: datablock_idprops
https://developer.blender.org/rB43b255a2a16d26a7df168742193a440f79eec694

Cleanup: remove 'generic' ID liblink function in readfile.c

We do need some generic ID handling refactor here (as was recently done
for writefile.c), but this out of scope of this patch - and not the way
to do it.

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

M	source/blender/blenloader/intern/readfile.c

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 06b1beec0bb..9f1ea7a3aea 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3353,8 +3353,9 @@ static void lib_link_armature(FileData *fd, Main *main)
 	for (arm = main->armature.first; arm; arm = arm->id.next) {
 		if (arm->id.tag & LIB_TAG_NEED_LINK) {
 			lib_link_animdata(fd, &arm->id, arm->adt);
-			for (bone = arm->bonebase.first; bone; bone = bone->next)
+			for (bone = arm->bonebase.first; bone; bone = bone->next) {
 				IDP_LibLinkProperty(bone->prop, fd);
+			}
 			arm->id.tag &= ~LIB_TAG_NEED_LINK;
 		}
 	}
@@ -3725,12 +3726,14 @@ static void direct_link_text(FileData *fd, Text *text)
 
 /* ************ READ IMAGE ***************** */
 
-static void lib_link_image(FileData *UNUSED(fd), Main *main)
+static void lib_link_image(FileData *fd, Main *main)
 {
 	Image *ima;
 	
 	for (ima = main->image.first; ima; ima = ima->id.next) {
 		if (ima->id.tag & LIB_TAG_NEED_LINK) {
+			IDP_LibLinkProperty(ima->id.properties, fd);
+			
 			ima->id.tag &= ~LIB_TAG_NEED_LINK;
 		}
 	}
@@ -3976,6 +3979,7 @@ static void lib_link_material(FileData *fd, Main *main)
 			
 			/* Link ID Properties -- and copy this comment EXACTLY for easy finding
 			 * of library blocks that implement this.*/
+			IDP_LibLinkProperty(ma->id.properties, fd);
 			
 			ma->ipo = newlibadr_us(fd, ma->id.lib, ma->ipo);  // XXX deprecated - old animation system
 			ma->group = newlibadr_us(fd, ma->id.lib, ma->group);
@@ -4438,6 +4442,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
 			
 			/* Link ID Properties -- and copy this comment EXACTLY for easy finding
 			 * of library blocks that implement this.*/
+			IDP_LibLinkProperty(me->id.properties, fd);
 			lib_link_animdata(fd, &me->id, me->adt);
 			
 			/* this check added for python created meshes */
@@ -4767,6 +4772,7 @@ static void lib_link_object(FileData *fd, Main *main)
 	
 	for (ob = main->object.first; ob; ob = ob->id.next) {
 		if (ob->id.tag & LIB_TAG_NEED_LINK) {
+			IDP_LibLinkProperty(ob->id.properties, fd);
 			lib_link_animdata(fd, &ob->id, ob->adt);
 			
 // XXX deprecated - old animation system <<<
@@ -5710,6 +5716,7 @@ static void lib_link_scene(FileData *fd, Main *main)
 		if (sce->id.tag & LIB_TAG_NEED_LINK) {
 			/* Link ID Properties -- and copy this comment EXACTLY for easy finding
 			 * of library blocks that implement this.*/
+			IDP_LibLinkProperty(sce->id.properties, fd);
 			lib_link_animdata(fd, &sce->id, sce->adt);
 			
 			lib_link_keyingsets(fd, &sce->id, &sce->keyingsets);
@@ -7382,22 +7389,6 @@ static void lib_link_library(FileData *UNUSED(fd), Main *main)
 	}
 }
 
-static void lib_link_id(FileData *fd, Main *main)
-{
-	ListBase *lbarray[MAX_LIBARRAY];
-	int i = set_listbasepointers(main, lbarray);
-	while (i--) {
-		ID *loop = lbarray[i]->first;
-		if (lbarray[i] == &main->nodetree)
-			continue; /* Since nodetrees aren't all in main, they do their own id-prop linking */
-		while (loop) {
-			if (loop->tag & LIB_TAG_NEED_LINK) /* Don't unset yet! */
-				IDP_LibLinkProperty(loop->properties, fd);
-			loop = loop->next;
-		}
-	}
-}
-
 /* Always call this once you have loaded new library data to set the relative paths correctly in relation to the blend file */
 static void fix_relpaths_library(const char *basepath, Main *main)
 {
@@ -7774,6 +7765,7 @@ static void lib_link_linestyle(FileData *fd, Main *main)
 		if (linestyle->id.tag & LIB_TAG_NEED_LINK) {
 			linestyle->id.tag &= ~LIB_TAG_NEED_LINK;
 
+			IDP_LibLinkProperty(linestyle->id.properties, fd);
 			lib_link_animdata(fd, &linestyle->id, linestyle->adt);
 			for (m = linestyle->color_modifiers.first; m; m = m->next) {
 				switch (m->type) {
@@ -8480,8 +8472,6 @@ static void lib_link_all(FileData *fd, Main *main)
 {
 	oldnewmap_sort(fd);
 	
-	lib_link_id(fd, main);
-
 	/* No load UI for undo memfiles */
 	if (fd->memfile == NULL) {
 		lib_link_windowmanager(fd, main);




More information about the Bf-blender-cvs mailing list