Depsgraph: Fix wrong relations built for drivers
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 4 Dec 2017 16:37:21 +0000 (17:37 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Dec 2017 09:21:33 +0000 (10:21 +0100)
When target was changed from bone to regular object, new dependency graph was
still trying to build relations as if driver was using bone.

source/blender/depsgraph/intern/builder/deg_builder_relations.cc

index 2489466392033fa4f9968f1b40e2e417cb23ec2f..a445068b9a89dd53f25e30abf81ed0e3e76cb01f 100644 (file)
@@ -1088,7 +1088,10 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
                                continue;
                        }
                        /* Special handling for directly-named bones. */
-                       if ((dtar->flag & DTAR_FLAG_STRUCT_REF) && (dtar->pchan_name[0])) {
+                       if ((dtar->flag & DTAR_FLAG_STRUCT_REF) &&
+                           (((Object *)dtar->id)->type == OB_ARMATURE) &&
+                           (dtar->pchan_name[0]))
+                       {
                                Object *object = (Object *)dtar->id;
                                bPoseChannel *target_pchan =
                                        BKE_pose_channel_find_name(object->pose,