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:
authorSybren A. Stüvel <sybren@blender.org>2020-08-13 13:53:21 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-08-13 14:56:41 +0300
commitcb2565195e72ee4dc5c0b53b7cd5037b2169d55f (patch)
tree5288e2157e252264f84516736ae24d9025654505 /source/blender/blenkernel
parent46aa30240005bfbb527e1f3e2a9279eb61e19a54 (diff)
Fix T65148: Drivers can't access shape keys
It was impossible for drivers to use shape key properties, modifiers generate a new mesh. After mesh evaluation the shape keys are no longer necessary, and because of this the `key` pointer was not copied. As drivers work on evaluated data, however, they do need this `key` pointer. This commit makes the `key` pointer available in evaluated meshes, but this is somewhat dangerous. There was an explicit reason why the key on result was kept at null pointer: to have the evaluated mesh in a consistent state. Assigning this pointer makes it potentially inconsistent, as the evaluated mesh and the original shape key may have different topologies. Reviewed By: sergey Differential Revision: https://developer.blender.org/D7785
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 63e7933dd56..0dc85dfaa18 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1810,6 +1810,12 @@ static void mesh_build_data(struct Depsgraph *depsgraph,
BKE_object_boundbox_calc_from_mesh(ob, mesh_eval);
+ /* Make sure that drivers can target shapekey properties.
+ * Note that this causes a potential inconsistency, as the shapekey may have a
+ * different topology than the evaluated mesh. */
+ BLI_assert(mesh->key == NULL || DEG_is_evaluated_id(&mesh->key->id));
+ mesh_eval->key = mesh->key;
+
if ((ob->mode & OB_MODE_ALL_SCULPT) && ob->sculpt) {
if (DEG_is_active(depsgraph)) {
BKE_sculpt_update_object_after_eval(depsgraph, ob);