Bugfix [#32440] Segmentation fault when moving bone in pose mode when Ghost

Around Frame is enabled

It turns out that the final "rebuild pose" at the end of each ghost drawing step
was at fault here, as it resulted in bones referring to a different set of
constraints after each ghost drawing step. However, most of the time, these new
references pointed to non-existent locations, causing the segfaults.

To fix this, I've removed this last rebuild step, which seems to work fine (no
major problems seem to arise from this). Also, to ensure that the other object
parameters have not changed (as a result of the reevaluation that needs to go
on), we now evaluate the object once more after all the ghost drawing (but
before final restore) so that object parameters (and potentially sub-data) are
all restored to their original values.

An upside of removing the final rebuild step is that "In Range" and "On
Keyframe" ghosting options now work with proxies again. Previously, trying to
move bones (but without autokey enabled) would mean that bones would snap back
to their unkeyed positions.
This commit is contained in:
Joshua Leung 2012-08-30 12:59:46 +00:00
parent ded5e9cd23
commit 5eba863429

@ -2378,7 +2378,11 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
/* before disposing of temp pose, use it to restore object to a sane state */
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)cfrao, ADT_RECALC_ALL);
/* clean up temporary pose */
ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */
BKE_pose_free(posen);
@ -2386,7 +2390,6 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
CFRA = cfrao;
ob->pose = poseo;
arm->flag = flago;
BKE_pose_rebuild(ob, ob->data);
ob->mode |= OB_MODE_POSE;
ob->ipoflag = ipoflago;
}
@ -2457,7 +2460,11 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
/* before disposing of temp pose, use it to restore object to a sane state */
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)cfrao, ADT_RECALC_ALL);
/* clean up temporary pose */
ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */
BLI_dlrbTree_free(&keys);
BKE_pose_free(posen);
@ -2466,7 +2473,6 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
CFRA = cfrao;
ob->pose = poseo;
arm->flag = flago;
BKE_pose_rebuild(ob, ob->data);
ob->mode |= OB_MODE_POSE;
}
@ -2544,7 +2550,11 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
/* before disposing of temp pose, use it to restore object to a sane state */
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)cfrao, ADT_RECALC_ALL);
/* clean up temporary pose */
ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */
BKE_pose_free(posen);
@ -2552,7 +2562,6 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
CFRA = cfrao;
ob->pose = poseo;
arm->flag = flago;
BKE_pose_rebuild(ob, ob->data);
ob->mode |= OB_MODE_POSE;
}