[Bf-blender-cvs] [2c0c4313996] blender-v3.4-release: Fix T102221: Entering editmode invalidates the driver associated with that mesh

Sergey Sharybin noreply at git.blender.org
Thu Nov 3 16:52:24 CET 2022


Commit: 2c0c43139962ee43db7235d39db22ec77d3349f3
Author: Sergey Sharybin
Date:   Thu Nov 3 15:48:54 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB2c0c43139962ee43db7235d39db22ec77d3349f3

Fix T102221: Entering editmode invalidates the driver associated with that mesh

The regression is caused by D13824 0f89bcdbebf5.

This fix follows the code from Sybren (D7785) to make object-mode
drivers from shapekey value to work. This intuitively makes sense
since the D13824 made the edit mode evaluation and ownership follow
the object mode more closely.

Differential Revision: https://developer.blender.org/D16380

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

M	source/blender/blenkernel/intern/DerivedMesh.cc

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

diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc
index 97ff45e93ce..bfdfc447baf 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -1648,6 +1648,12 @@ static void editbmesh_build_data(struct Depsgraph *depsgraph,
   const bool is_mesh_eval_owned = (me_final != mesh->runtime->mesh_eval);
   BKE_object_eval_assign_data(obedit, &me_final->id, is_mesh_eval_owned);
 
+  /* 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 == nullptr || DEG_is_evaluated_id(&mesh->key->id));
+  me_final->key = mesh->key;
+
   obedit->runtime.editmesh_eval_cage = me_cage;
 
   obedit->runtime.geometry_set_eval = non_mesh_components;



More information about the Bf-blender-cvs mailing list