Fix T66991 Crash when deleting edit bones when pchan is referenced by bendybone
This was caused by loose pointers. This diff takes care of clearing the fields of other bones before deleting the pchan. Reviewers: brecht, sergey Reviewed By: brecht, sergey Differential Revision: https://developer.blender.org/D5258
This commit is contained in:
@@ -729,6 +729,21 @@ void BKE_pose_channels_hash_free(bPose *pose)
|
||||
}
|
||||
}
|
||||
|
||||
static void pose_channels_remove_internal_links(Object *ob, bPoseChannel *unlinked_pchan)
|
||||
{
|
||||
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
|
||||
if (pchan->bbone_prev == unlinked_pchan) {
|
||||
pchan->bbone_prev = NULL;
|
||||
}
|
||||
if (pchan->bbone_next == unlinked_pchan) {
|
||||
pchan->bbone_next = NULL;
|
||||
}
|
||||
if (pchan->custom_tx == unlinked_pchan) {
|
||||
pchan->custom_tx = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selectively remove pose channels.
|
||||
*/
|
||||
@@ -747,6 +762,7 @@ void BKE_pose_channels_remove(Object *ob,
|
||||
if (filter_fn(pchan->name, user_data)) {
|
||||
/* Bone itself is being removed */
|
||||
BKE_pose_channel_free(pchan);
|
||||
pose_channels_remove_internal_links(ob, pchan);
|
||||
if (ob->pose->chanhash) {
|
||||
BLI_ghash_remove(ob->pose->chanhash, pchan->name, NULL, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user