Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2020-10-21 16:51:15 +0300
committerJeroen Bakker <jeroen@blender.org>2020-10-28 11:21:02 +0300
commit05b4d8d13a9ca3691c7aa8f2ceebd8155bd31fa7 (patch)
tree8b2f200084b19da9830724a2cf6174d7083b20d4
parent7e39e0a9f62b13e0b3a91df4cf9477a4eaef3dd9 (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.
-rw-r--r--source/blender/blenkernel/intern/armature.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 04051edd334..27c16d6f1c0 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -2782,6 +2782,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); */