Fix T51150: user_remap on itself changes users to 0.
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 17 Apr 2017 20:33:07 +0000 (22:33 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 17 Apr 2017 20:33:07 +0000 (22:33 +0200)
Remapping to itself is nonsense here (was triggering an assert in
BKE_library code actually), just make it a bail out early in RNA
callback in that case.

source/blender/makesrna/intern/rna_ID.c

index 6ed2c55138cc87fb6a49fbf080048b282f187ca3..a74758a4f71763df6c00c69932f0d8d35793a210 100644 (file)
@@ -342,7 +342,7 @@ static void rna_ID_user_clear(ID *id)
 
 static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id)
 {
-       if (GS(id->name) == GS(new_id->name)) {
+       if ((GS(id->name) == GS(new_id->name)) && (id != new_id)) {
                /* For now, do not allow remapping data in linked data from here... */
                BKE_libblock_remap(bmain, id, new_id, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_NEVER_NULL_USAGE);
        }