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:
authorCampbell Barton <ideasman42@gmail.com>2020-09-13 11:11:38 +0300
committerJeroen Bakker <jeroen@blender.org>2020-09-16 15:24:26 +0300
commit46bdfcab10fad857baffdbcfc1179838aed5660d (patch)
tree43a6cfbe3d35ca8dad702e71584cc653b50bfb19
parent3be5697b889a9a3e677a504844e6b21eee0d753f (diff)
Fix T77584: Edit Mode crash with shape keys created on blank mesh
Entering edit-mode after creating shape keys on a blank mesh would crash. Regression in 9b9f84b317fef which prevented initializing empty shape keys when there is no shape key offset data available.
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index b8508f7e12c..b182d951004 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -884,19 +884,14 @@ 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 cd_shape_offset = CustomData_get_n_offset(&bm->vdata, CD_SHAPEKEY, j);
+ 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;
@@ -918,7 +913,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));
}