[Bf-blender-cvs] [d037ac315b4] master: Fix T80996: Weight Proximity modifier: crash going to editmode on a target in certain situations

Philipp Oeser noreply at git.blender.org
Tue Sep 22 09:49:03 CEST 2020


Commit: d037ac315b4dba2278a77d2db7b3b98861b3d093
Author: Philipp Oeser
Date:   Mon Sep 21 17:48:57 2020 +0200
Branches: master
https://developer.blender.org/rBd037ac315b4dba2278a77d2db7b3b98861b3d093

Fix T80996: Weight Proximity modifier: crash going to editmode on a
target in certain situations

Regression from rBdeaff945d0b96.

mesh_ensure_looptri_data would overflow.

Crash would only happen if a Data Transfer modifier (transferring
UVs) follows, so exact reason for this is not yet entirely clear. Also
there are edit-mode versions of the following BVH lookup functions so it
could be avoided (since this is a expensive operation), marking as TODO.

Similar fix as
- rB0945a79ed1eafae444d3021a5912cb39801a7209
- rB56d7e39b92997768b3db8ce2dbc262f869994145

Reviewers: mont29, campbellbarton

Maniphest Tasks: T80996

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

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

M	source/blender/modifiers/intern/MOD_weightvgproximity.c

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

diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 994f2c04921..c857ac53022 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -45,6 +45,7 @@
 #include "BKE_lib_id.h"
 #include "BKE_lib_query.h"
 #include "BKE_mesh.h"
+#include "BKE_mesh_wrapper.h"
 #include "BKE_modifier.h"
 #include "BKE_screen.h"
 #include "BKE_texture.h" /* Texture masking. */
@@ -552,6 +553,11 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
 
       /* We must check that we do have a valid target_mesh! */
       if (target_mesh != NULL) {
+
+        /* TODO: edit-mode versions of the BVH lookup functions are available so it could be
+         * avoided. */
+        BKE_mesh_wrapper_ensure_mdata(target_mesh);
+
         SpaceTransform loc2trgt;
         float *dists_v = use_trgt_verts ? MEM_malloc_arrayN(numIdx, sizeof(float), "dists_v") :
                                           NULL;



More information about the Bf-blender-cvs mailing list