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:
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_mesh_convert.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_convert.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.c b/source/blender/bmesh/intern/bmesh_mesh_convert.c
index 4671df90d53..c30f71e029f 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.c
@@ -22,7 +22,7 @@
* \section bm_mesh_conv_shapekey Converting Shape Keys
*
* When converting to/from a Mesh/BMesh you can optionally pass a shape key to edit.
- * This has the effect of editing the shape key-block rather then the original mesh vertex coords
+ * This has the effect of editing the shape key-block rather than the original mesh vertex coords
* (although additional geometry is still allowed and uses fallback locations on converting).
*
* While this works for any mesh/bmesh this is made use of by entering and exiting edit-mode.
@@ -829,7 +829,6 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
/* Go through and find any shape-key custom-data layers
* that might not have corresponding KeyBlocks, and add them if necessary. */
- j = 0;
for (i = 0; i < bm->vdata.totlayer; i++) {
if (bm->vdata.layers[i].type != CD_SHAPEKEY) {
continue;
@@ -845,8 +844,6 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
currkey = BKE_keyblock_add(me->key, bm->vdata.layers[i].name);
currkey->uid = bm->vdata.layers[i].uid;
}
-
- j++;
}
/* Editing the base key should update others. */
@@ -893,19 +890,17 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
}
for (currkey = me->key->block.first; currkey; currkey = currkey->next) {
- const bool apply_offset = (ofs && (currkey != actkey) &&
- (bm->shapenr - 1 == currkey->relative));
- int cd_shape_offset;
int keyi;
const float(*ofs_pt)[3] = ofs;
float *newkey, (*oldkey)[3], *fp;
- j = bm_to_mesh_shape_layer_index_from_kb(bm, currkey);
- cd_shape_offset = CustomData_get_n_offset(&bm->vdata, CD_SHAPEKEY, j);
- if (cd_shape_offset < 0) {
- /* The target Mesh has more shapekeys than the BMesh. */
- continue;
- }
+ const int currkey_uuid = bm_to_mesh_shape_layer_index_from_kb(bm, currkey);
+ const int cd_shape_offset = (currkey_uuid == -1) ? -1 :
+ CustomData_get_n_offset(&bm->vdata,
+ CD_SHAPEKEY,
+ currkey_uuid);
+ const bool apply_offset = (cd_shape_offset != -1) && (ofs != NULL) && (currkey != actkey) &&
+ (bm->shapenr - 1 == currkey->relative);
fp = newkey = MEM_callocN(me->key->elemsize * bm->totvert, "currkey->data");
oldkey = currkey->data;
@@ -927,7 +922,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
}
}
}
- else if (j != -1) {
+ else if (cd_shape_offset != -1) {
/* In most cases this runs. */
copy_v3_v3(fp, BM_ELEM_CD_GET_VOID_P(eve, cd_shape_offset));
}
@@ -1101,7 +1096,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
med->flag = BM_edge_flag_to_mflag(eed);
/* Handle this differently to editmode switching,
- * only enable draw for single user edges rather then calculating angle. */
+ * only enable draw for single user edges rather than calculating angle. */
if ((med->flag & ME_EDGEDRAW) == 0) {
if (eed->l && eed->l == eed->l->radial_next) {
med->flag |= ME_EDGEDRAW;