[Bf-blender-cvs] [514700b] master: Fix (unreported) crash when remapping armatures.

Bastien Montagne noreply at git.blender.org
Thu Jul 7 15:09:45 CEST 2016


Commit: 514700b307ad4ea46cd1e238216363c93b9572a0
Author: Bastien Montagne
Date:   Thu Jul 7 14:52:39 2016 +0200
Branches: master
https://developer.blender.org/rB514700b307ad4ea46cd1e238216363c93b9572a0

Fix (unreported) crash when remapping armatures.

Objects' Pose holds references to the armature bones, so we have to force POSE_RECALC in those cases...

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

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

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

diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 81543fa..a290c1c 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -354,6 +354,15 @@ void BKE_libblock_remap_locked(
 			}
 		}
 	}
+	else if (GS(old_id->name) == ID_AR) {
+		/* Object's pose holds reference to armature bones... sic */
+		for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+			if (ob->data == old_id && ob->pose) {
+				BLI_assert(ob->type == OB_ARMATURE);
+				ob->pose->flag |= POSE_RECALC;
+			}
+		}
+	}
 
 	libblock_remap_data(bmain, NULL, old_id, new_id, remap_flags, &id_remap_data);
 
@@ -516,6 +525,15 @@ void BKE_libblock_relink_ex(
 		BLI_assert(new_id == NULL);
 	}
 
+	if (GS(id->name) == ID_OB) {
+		Object *ob = (Object *)id;
+		/* Object's pose holds reference to armature bones... sic */
+		if (ob->data && ob->pose && (old_id == NULL || GS(old_id->name) == ID_AR)) {
+			BLI_assert(ob->type == OB_ARMATURE);
+			ob->pose->flag |= POSE_RECALC;
+		}
+	}
+
 	libblock_remap_data(NULL, id, old_id, new_id, remap_flags, NULL);
 }




More information about the Bf-blender-cvs mailing list