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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-14 21:53:39 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-14 21:58:14 +0300
commitdc25e69c2d5586d2635688ab18d2606be8c1ff57 (patch)
treee054a1fa7b956a0b74f85ec74dbad7ca6a52fb3d /source/blender/blenkernel/intern/anim.c
parent2e09b277d51bc03a3a38c78aacf82cb106f03ada (diff)
Fix motion paths not updating correctly for bones in some cases.
Sometimes the evaluated pose channel pointers can change during depsgraph evaluation, so we can't store them ahead of time. The object pointer should be ok since evaluated ID memory is reused.
Diffstat (limited to 'source/blender/blenkernel/intern/anim.c')
-rw-r--r--source/blender/blenkernel/intern/anim.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index c7730d8877b..e2cecb32a36 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -275,7 +275,6 @@ typedef struct MPathTarget {
* that provide all the coordinates we want to save off)
*/
Object *ob_eval; /* evaluated object */
- bPoseChannel *pchan_eval; /* evaluated posechannel (if applicable) */
} MPathTarget;
/* ........ */
@@ -348,9 +347,6 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
bMotionPath *mpath = mpt->mpath;
bMotionPathVert *mpv;
- Object *ob_eval = mpt->ob_eval;
- bPoseChannel *pchan_eval = mpt->pchan_eval;
-
/* current frame must be within the range the cache works for
* - is inclusive of the first frame, but not the last otherwise we get buffer overruns
*/
@@ -361,8 +357,17 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
/* get the relevant cache vert to write to */
mpv = mpath->points + (CFRA - mpath->start_frame);
+ Object *ob_eval = mpt->ob_eval;
+
+ /* Lookup evaluated pose channel, here because the depsgraph
+ * evaluation can change them so they are not cached in mpt. */
+ bPoseChannel *pchan_eval = NULL;
+ if (mpt->pchan) {
+ pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, mpt->pchan->name);
+ }
+
/* pose-channel or object path baking? */
- if (mpt->pchan_eval) {
+ if (pchan_eval) {
/* heads or tails */
if (mpath->flag & MOTIONPATH_FLAG_BHEAD) {
copy_v3_v3(mpv->co, pchan_eval->pose_head);
@@ -425,9 +430,6 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
// TODO: Create a copy of background depsgraph that only contain these entities, and only evaluates them..
for (mpt = targets->first; mpt; mpt = mpt->next) {
mpt->ob_eval = DEG_get_evaluated_object(depsgraph, mpt->ob);
- if (mpt->pchan) {
- mpt->pchan_eval = BKE_pose_channel_find_name(mpt->ob_eval->pose, mpt->pchan->name);
- }
AnimData *adt = BKE_animdata_from_id(&mpt->ob_eval->id);