Fix T62048: crash when turning off curve path animation with Spline IK.

Both fix missing depsgraph flag, and gracefully give up on missing data.
This commit is contained in:
Alexander Gavrilov 2019-04-13 17:36:57 +03:00
parent 51c8a6f491
commit 3d8790faf1
Notes: blender-bot 2023-02-14 11:00:17 +01:00
Referenced by issue #63949, Blender hangs on Preferences>Settings (Linux OpenCL)
Referenced by issue #62048, Crash when turning of path animation while Spline IK is active.
2 changed files with 6 additions and 19 deletions

View File

@ -71,7 +71,7 @@ typedef struct tSplineIK_Tree {
/* ----------- */
/* Tag the bones in the chain formed by the given bone for IK */
static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPoseChannel *pchan_tip)
static void splineik_init_tree_from_pchan(Scene *UNUSED(scene), Object *UNUSED(ob), bPoseChannel *pchan_tip)
{
bPoseChannel *pchan, *pchanRoot = NULL;
bPoseChannel *pchanChain[255];
@ -102,28 +102,14 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
return;
/* make sure that the constraint targets are ok
* - this is a workaround for a depsgraph bug...
* - this is a workaround for a depsgraph bug or dependency cycle...
*/
if (ikData->tar) {
/* note: when creating constraints that follow path, the curve gets the CU_PATH set now,
* currently for paths to work it needs to go through the bevlist/displist system (ton)
*/
CurveCache *cache = ikData->tar->runtime.curve_cache;
/* TODO: Make sure this doesn't crash. */
#if 0
/* only happens on reload file, but violates depsgraph still... fix! */
if (ELEM(NULL, ikData->tar->curve_cache, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) {
BKE_displist_make_curveTypes(depsgraph, scene, ikData->tar, 0);
/* path building may fail in EditMode after removing verts [#33268]*/
if (ELEM(NULL, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) {
/* BLI_assert(cu->path != NULL); */
return;
}
if (ELEM(NULL, cache, cache->path, cache->path->data)) {
return;
}
#else
(void) scene;
#endif
}
/* find the root bone and the chain of bones from the root to the tip

View File

@ -262,6 +262,7 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object,
if (data->tar != NULL) {
ComponentKey target_key(&data->tar->id, NodeType::GEOMETRY);
add_relation(target_key, init_ik_key, "Curve.Path -> Spline IK");
add_special_eval_flag(&data->tar->id, DAG_EVAL_NEED_CURVE_PATH);
}
pchan->flag |= POSE_DONE;
OperationKey final_transforms_key(