[Bf-blender-cvs] [fab573bac0e] master: Fix T59338: Blender crashes immediately after loading attached file in ~80% of my attempts.

Bastien Montagne noreply at git.blender.org
Thu Feb 21 15:40:28 CET 2019


Commit: fab573bac0e1fbc88f8208372b3a5a2f7415c517
Author: Bastien Montagne
Date:   Wed Feb 20 16:59:04 2019 +0100
Branches: master
https://developer.blender.org/rBfab573bac0e1fbc88f8208372b3a5a2f7415c517

Fix T59338: Blender crashes immediately after loading attached file in ~80% of my attempts.

Issue was a concurrent modification of an evaluated mesh by two
other meshes using it as source for custom normals data transfer.

Note that this fixes the crash (modifiers are strictly forbidden to modify
any data besides their own!), but now will have to add a new CD type to
be able to specifically request 'computed' clnors data layer, and not
only 'encoded' one, for source mesh...

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

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

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

diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index 10d79ebdf96..3e5939b4e0f 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -249,7 +249,7 @@ int BKE_object_data_transfer_dttype_to_srcdst_index(const int dtdata_type)
 
 static void data_transfer_dtdata_type_preprocess(
         Mesh *me_src, Mesh *me_dst,
-        const int dtdata_type, const bool dirty_nors_dst)
+        const int dtdata_type, const bool dirty_nors_dst, const bool is_modifier)
 {
 	if (dtdata_type == DT_TYPE_LNOR) {
 		/* Compute custom normals into regular loop normals, which will be used for the transfer. */
@@ -267,7 +267,9 @@ static void data_transfer_dtdata_type_preprocess(
 		const bool use_split_nors_dst = (me_dst->flag & ME_AUTOSMOOTH) != 0;
 		const float split_angle_dst = me_dst->smoothresh;
 
-		BKE_mesh_calc_normals_split(me_src);
+		if (!is_modifier) {
+			BKE_mesh_calc_normals_split(me_src);
+		}
 
 		float (*poly_nors_dst)[3];
 		float (*loop_nors_dst)[3];
@@ -1145,7 +1147,7 @@ bool BKE_object_data_transfer_ex(
 			continue;
 		}
 
-		data_transfer_dtdata_type_preprocess(me_src, me_dst, dtdata_type, dirty_nors_dst);
+		data_transfer_dtdata_type_preprocess(me_src, me_dst, dtdata_type, dirty_nors_dst, is_modifier);
 
 		cddata_type = BKE_object_data_transfer_dttype_to_cdtype(dtdata_type);



More information about the Bf-blender-cvs mailing list