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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-03-08 13:49:49 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-03-08 19:53:31 +0300
commit8730984c708bdde6a2cf29fc4f29bd50c05b349c (patch)
treef3bf8b462ed4c42cd928fbace84efebe3be076e4 /source/blender/blenkernel/intern/data_transfer.c
parentcdba2bc0fce86e814aaa5a969a018b5c1c9f8b3b (diff)
Fix (unreported) datatransfer code could still modify source mesh in some cases.
Source (i.e. other) mesh should not be modified in any case in modifier evaluation case (this is forbidden by design and can lead to all kind of threaded locks and crashes), and doing so even in operator case was never a good idea either. Now that we can specifically request needed data (poly and/or loop normals) from evaluation code, we can finally get rid of those computations inside data transfer/mesh remapping area. This is hopefully the last remaining bit of this 'bad crashing code' in datatransfer area.
Diffstat (limited to 'source/blender/blenkernel/intern/data_transfer.c')
-rw-r--r--source/blender/blenkernel/intern/data_transfer.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index 4c4d57ddbac..cf6a5a7233a 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -257,7 +257,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 bool is_modifier)
+ const int dtdata_type, const bool dirty_nors_dst)
{
if (dtdata_type == DT_TYPE_LNOR) {
/* Compute custom normals into regular loop normals, which will be used for the transfer. */
@@ -275,9 +275,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;
- if (!is_modifier) {
- BKE_mesh_calc_normals_split(me_src);
- }
+ /* This should be ensured by cddata_masks we pass to code generating/giving us me_src now. */
+ BLI_assert(CustomData_get_layer(&me_src->ldata, CD_NORMAL) != NULL);
+ BLI_assert(CustomData_get_layer(&me_src->pdata, CD_NORMAL) != NULL);
float (*poly_nors_dst)[3];
float (*loop_nors_dst)[3];
@@ -1121,6 +1121,8 @@ bool BKE_object_data_transfer_ex(
/* Get source evaluated mesh.*/
BKE_object_data_transfer_dttypes_to_cdmask(data_types, &me_src_mask);
+ BKE_mesh_remap_calc_source_cddata_masks_from_map_modes(
+ map_vert_mode, map_edge_mode, map_loop_mode, map_poly_mode, &me_src_mask);
if (is_modifier) {
me_src = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_src, false);
@@ -1155,7 +1157,7 @@ bool BKE_object_data_transfer_ex(
continue;
}
- data_transfer_dtdata_type_preprocess(me_src, me_dst, dtdata_type, dirty_nors_dst, is_modifier);
+ data_transfer_dtdata_type_preprocess(me_src, me_dst, dtdata_type, dirty_nors_dst);
cddata_type = BKE_object_data_transfer_dttype_to_cdtype(dtdata_type);