[Bf-blender-cvs] [6dffedc] id-remap: Fix several issues with logic of core id-remap:

Bastien Montagne noreply at git.blender.org
Mon Dec 7 17:34:59 CET 2015


Commit: 6dffedc75eee032fdf7be726690ba335289f2dbf
Author: Bastien Montagne
Date:   Mon Dec 7 17:33:35 2015 +0100
Branches: id-remap
https://developer.blender.org/rB6dffedc75eee032fdf7be726690ba335289f2dbf

Fix several issues with logic of core id-remap:

* We need to clear the 'user-one' flags and potential usercount for old_id.
* We need to consider ID usages inside a same lib as **never** being indirect ones.

Also re-enabled proxy checking for now (not sure why I commented it, think testing stuff or so...).

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

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

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

diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 6ad2f0b..a5f6503 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1086,9 +1086,10 @@ static bool foreach_libblock_remap_callback(void *user_data, ID **id_p, int cb_f
 		 *       on the other hand since they get reset to lib data on file open/reload it is indirect too...
 		 *       Edit Mode is also a 'skip direct' case. */
 		const bool is_obj = (GS(id->name) == ID_OB);
-		const bool is_proxy = false; //(is_obj && (((Object *)id)->proxy || ((Object *)id)->proxy_group));
+		const bool is_proxy = (is_obj && (((Object *)id)->proxy || ((Object *)id)->proxy_group));
 		const bool is_obj_editmode = (is_obj && BKE_object_is_in_editmode((Object *)id));
-		const bool is_indirect = (id->lib != NULL);
+		/* Note that indirect data from same file as processed ID is **not** considered indirect! */
+		const bool is_indirect = ((id->lib != NULL) && (id->lib != old_id->lib));
 		const bool skip_indirect = (id_remap_data->flag & ID_REMAP_SKIP_INDIRECT_USAGE) != 0;
 		const bool is_never_null = ((cb_flag & IDWALK_NEVER_NULL) && (new_id == NULL));
 		const bool skip_never_null = (id_remap_data->flag & ID_REMAP_SKIP_NEVER_NULL_USAGE) != 0;
@@ -1097,9 +1098,11 @@ static bool foreach_libblock_remap_callback(void *user_data, ID **id_p, int cb_f
 			id->flag |= LIB_DOIT;
 		}
 
-//		if (GS(old_id->name) == ID_AC)
+//		if (GS(old_id->name) == ID_TXT) {
+//			printf("\t\t %s (from %s) (%d)\n", old_id->name, old_id->lib ? old_id->lib->filepath : "<MAIN>", old_id->us);
 //			printf("\t\tIn %s (%p): remapping %s (%p) to %s (%p)\n",
 //			       id->name, id, old_id->name, old_id, new_id ? new_id->name : "<NONE>", new_id);
+//		}
 
 		/* Special hack in case it's Object->data and we are in edit mode (skipped_direct too). */
 		if ((is_never_null && skip_never_null) ||
@@ -1344,10 +1347,6 @@ void BKE_libblock_remap_locked(
 			}
 		}
 	}
-	else if (GS(old_id->name) == ID_LI) {
-		/* Libraries have one user, though they are not technically used by anyone... */
-		id_us_min(old_id);
-	}
 
 //	if (GS(old_id->name) == ID_AC) {
 //		printf("%s: END   %s (%p, %d) replaced by %s (%p, %d)\n",




More information about the Bf-blender-cvs mailing list