[Bf-blender-cvs] [1d1b8bb] master: Fix T46067: ShrinkWrap + Threaded depsgraph crash

Campbell Barton noreply at git.blender.org
Thu Sep 10 10:38:57 CEST 2015


Commit: 1d1b8bb1968a96dc594c62aacab6e9b82256c346
Author: Campbell Barton
Date:   Thu Sep 10 18:27:50 2015 +1000
Branches: master
https://developer.blender.org/rB1d1b8bb1968a96dc594c62aacab6e9b82256c346

Fix T46067: ShrinkWrap + Threaded depsgraph crash

Note that allocating DM arrays from an editmesh is currently not threadsafe,
however even if were resolved, its more efficient to avoid having to do it in the first place.

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

M	source/blender/blenkernel/intern/shrinkwrap.c

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

diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index 5ecd2fc..7d49258 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -50,6 +50,7 @@
 #include "BKE_lattice.h"
 
 #include "BKE_deform.h"
+#include "BKE_editmesh.h"
 #include "BKE_mesh.h"  /* for OMP limits. */
 #include "BKE_subsurf.h"
 
@@ -278,6 +279,14 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, bool for
 		BLI_SPACE_TRANSFORM_SETUP(&local2aux, calc->ob, calc->smd->auxTarget);
 	}
 
+	/* use editmesh to avoid array allocation */
+	if (calc->smd->target && calc->target->type == DM_TYPE_EDITBMESH) {
+		treeData.em_evil = BKE_editmesh_from_object(calc->smd->target);
+	}
+	if (calc->smd->auxTarget && auxMesh->type == DM_TYPE_EDITBMESH) {
+		auxData.em_evil = BKE_editmesh_from_object(calc->smd->auxTarget);
+	}
+
 	/* After sucessufuly build the trees, start projection vertexs */
 	if (bvhtree_from_mesh_looptri(&treeData, calc->target, 0.0, 4, 6) &&
 	    (auxMesh == NULL || bvhtree_from_mesh_looptri(&auxData, auxMesh, 0.0, 4, 6)))




More information about the Bf-blender-cvs mailing list