diff options
author | Bastien Montagne <bastien@blender.org> | 2020-10-21 16:51:15 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-10-21 16:52:41 +0300 |
commit | 47a84bb33870d0fc8636d8d96f136d34e01ebce1 (patch) | |
tree | c3494a4cfd7b1f3045af5ba52dd1d22f8a63f1e3 /source/blender/blenkernel/intern/armature.c | |
parent | ba718c1513607987fff8255906ab36aa88d3919c (diff) |
Fix (studio-reported) Armature: bug in handling of custom bone transform.
This specific pose channel pointer was not handled at all during
rebuilding of poses, meaning that it could end up pointing at some freed
pchan.
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index e0b12228162..7b8ed47c513 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2540,6 +2540,13 @@ void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, const bool do_id_ for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { /* Find the custom B-Bone handles. */ BKE_pchan_rebuild_bbone_handles(pose, pchan); + /* Re-validate that we are still using a valid pchan form custom transform. */ + /* Note that we could store pointers of freed pchan in a GSet to speed this up, however this is + * supposed to be a rarely used feature, so for now assuming that always building that GSet + * would be less optimal. */ + if (pchan->custom_tx != NULL && BLI_findindex(&pose->chanbase, pchan->custom_tx) == -1) { + pchan->custom_tx = NULL; + } } /* printf("rebuild pose %s, %d bones\n", ob->id.name, counter); */ |