Fix (unreported) crash when remapping armatures.

Objects' Pose holds references to the armature bones, so we have to force POSE_RECALC in those cases...
This commit is contained in:
Bastien Montagne 2016-07-07 14:52:39 +02:00
parent 8443628e66
commit 514700b307
1 changed files with 18 additions and 0 deletions

View File

@ -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);
}