[Bf-blender-cvs] [d5c69ff] id-remap: Fix bad handling of non-linkable IDs on reload.

Bastien Montagne noreply at git.blender.org
Tue Sep 22 21:27:53 CEST 2015


Commit: d5c69ffeb9d05f7c08c1f89d3efd519287f5e780
Author: Bastien Montagne
Date:   Tue Sep 22 21:26:41 2015 +0200
Branches: id-remap
https://developer.blender.org/rBd5c69ffeb9d05f7c08c1f89d3efd519287f5e780

Fix bad handling of non-linkable IDs on reload.

They would be removed from bmain, but never added again nor freed - in this case
we can simply explicitely reload them in fact, non-linkable is only a user-related status...

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

M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index b8ed429..6752c7d 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3043,24 +3043,19 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, const bool reloa
 			while (lba_idx--) {
 				ID *id = lbarray[lba_idx]->first;
 				const int idcode = id ? GS(id->name) : 0;
-				const bool is_linkable = id ? BKE_idcode_is_linkable(idcode) : false;
 
 				for (; id; id = id->next) {
 					if (id->lib == lib) {
-						/* We remove it from current Main, and if linkable add it to items to link... */
+						WMLinkAppendDataItem *item;
+
+						/* We remove it from current Main, and add it to items to link... */
+						/* Note that non-linkable IDs (like e.g. shapekeys) are also explicitely linked here... */
 						BLI_remlink(lbarray[lba_idx], id);
-						if (is_linkable) {
-							WMLinkAppendDataItem *item = wm_link_append_data_item_add(lapp_data, id->name + 2, idcode, id);
-							BLI_BITMAP_SET_ALL(item->libraries, true, lapp_data->num_libraries);
-						}
-						/* Note that non-linkable IDs (like e.g. shapekeys) are supposed to be reloaded together
-						 * with their users! */
+						item = wm_link_append_data_item_add(lapp_data, id->name + 2, idcode, id);
+						BLI_BITMAP_SET_ALL(item->libraries, true, lapp_data->num_libraries);
 
 						printf("\tdatablock to seek for: %s\n", id->name);
 					}
-					else if (id == (ID *)lib) {
-						/* The Library datablock itself... XXX Do we need to remove it actually? */
-					}
 				}
 			}
 
@@ -3113,7 +3108,7 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, const bool reloa
 					}
 				}
 
-				if (old_id->us > 0) {
+				if (old_id->us > 0 && new_id) {
 					size_t len = strlen(old_id->name);
 
 					/* XXX TODO This is utterly weak!!! */




More information about the Bf-blender-cvs mailing list