Commit: 3d8790faf17b665eecf10868939ce9fb9c794ddd
Author: Alexander Gavrilov
Date:   Sat Apr 13 17:36:57 2019 +0300
Branches: master
https://developer.blender.org/rB3d8790faf17b665eecf10868939ce9fb9c794ddd

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

Both fix missing depsgraph flag, and gracefully give up on missing data.

===================================================================

M       source/blender/blenkernel/intern/armature_update.c
M       source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/armature_update.c 
b/source/blender/blenkernel/intern/armature_update.c
index 5cd82803fae..1e9febd4d8e 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -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
diff --git 
a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
index 35652ebb53e..c9f86652262 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -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(

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to