diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-08 12:12:31 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-08 12:16:00 +0300 |
commit | 0e3475b00d44bc0220cee84d28daacaa6735f62f (patch) | |
tree | a73e783765addd0cec17ccf810902ec94e0aad71 /source/blender/blenkernel/intern/deform.c | |
parent | 351b24ac142d8f3b8f067b004e055018399eb469 (diff) |
Fix T61255: Mesh Data Transfer: Do not abort when destination has not all source data layers.
Originally, when transferring all source data layers to destination
meshes, code would abort in case destination did not have all needed
layers, and creating them was not allowed.
Now, it will instead transfer data to layers that exists, merely
skipping source ones for which it cannot find a matching destination.
Diffstat (limited to 'source/blender/blenkernel/intern/deform.c')
-rw-r--r-- | source/blender/blenkernel/intern/deform.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index c3f3516c714..a6c5ddf0285 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -1060,12 +1060,15 @@ static bool data_transfer_layersmapping_vgroups_multisrc_to_dst( idx_src++; if (idx_dst < idx_src) { - if (!use_create) { - return false; + if (use_create) { + /* Create as much vgroups as necessary! */ + for (; idx_dst < idx_src; idx_dst++) { + BKE_object_defgroup_add(ob_dst); + } } - /* Create as much vgroups as necessary! */ - for (; idx_dst < idx_src; idx_dst++) { - BKE_object_defgroup_add(ob_dst); + else { + /* Otherwise, just try to map what we can with existing dst vgroups. */ + idx_src = idx_dst; } } else if (use_delete && idx_dst > idx_src) { @@ -1115,14 +1118,14 @@ static bool data_transfer_layersmapping_vgroups_multisrc_to_dst( } if ((idx_dst = defgroup_name_index(ob_dst, dg_src->name)) == -1) { - if (!use_create) { - if (r_map) { - BLI_freelistN(r_map); - } - return false; + if (use_create) { + BKE_object_defgroup_add_name(ob_dst, dg_src->name); + idx_dst = ob_dst->actdef - 1; + } + else { + /* If we are not allowed to create missing dst vgroups, just skip matching src one. */ + continue; } - BKE_object_defgroup_add_name(ob_dst, dg_src->name); - idx_dst = ob_dst->actdef - 1; } if (r_map) { /* At this stage, we **need** a valid CD_MDEFORMVERT layer on dest! |