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>2015-02-16 05:41:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-02-16 05:41:46 +0300
commit81be1c7a219070255d979af9e607bb9b7a6741b5 (patch)
treef44a6b9df21b11ad6544d49f76167b44a96e3504 /source/blender/editors
parent7975c0d35ac51c915140c6ebd78c981f9e37549b (diff)
Correct crash /w vertex slide with no faces
Error in recent commit
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/transform/transform.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index b928343d8bf..1740e54abbf 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -5272,6 +5272,7 @@ static void slide_origdata_create_data(
for (i = 0; i < v_num; i++, sv = (void *)(((char *)sv) + v_stride)) {
BMIter fiter;
BMFace *f;
+ bool has_faces = false;
/* copy face data */
BM_ITER_ELEM (f, &fiter, sv->v, BM_FACES_OF_VERT) {
@@ -5279,13 +5280,19 @@ static void slide_origdata_create_data(
BMFace *f_copy = BM_face_copy(sod->bm_origfaces, bm, f, true, true);
BLI_ghash_insert(sod->origfaces, f, f_copy);
}
+ has_faces = true;
}
/* store cd_loop_groups */
- sv->cd_loop_groups = BLI_memarena_alloc(sod->arena, layer_groups_array_size);
- for (j = 0; j < layer_index_dst; j++) {
- const int layer_nr = layer_math_map[j];
- sv->cd_loop_groups[j] = BM_vert_loop_groups_data_layer_create(bm, sv->v, layer_nr, sod->arena);
+ if (has_faces) {
+ sv->cd_loop_groups = BLI_memarena_alloc(sod->arena, layer_groups_array_size);
+ for (j = 0; j < layer_index_dst; j++) {
+ const int layer_nr = layer_math_map[j];
+ sv->cd_loop_groups[j] = BM_vert_loop_groups_data_layer_create(bm, sv->v, layer_nr, sod->arena);
+ }
+ }
+ else {
+ sv->cd_loop_groups = NULL;
}
}
}
@@ -5303,25 +5310,28 @@ static void slide_origdata_interp_data(
const int *layer_math_map = sod->layer_math_map;
for (i = 0; i < v_num; i++, sv = (void *)(((char *)sv) + v_stride)) {
- BMIter fiter;
- BMLoop *l;
- int j;
- BM_ITER_ELEM (l, &fiter, sv->v, BM_LOOPS_OF_VERT) {
- BMFace *f_copy; /* the copy of 'f' */
+ if (sv->cd_loop_groups) {
+ BMIter fiter;
+ BMLoop *l;
+ int j;
- f_copy = BLI_ghash_lookup(sod->origfaces, l->f);
+ BM_ITER_ELEM (l, &fiter, sv->v, BM_LOOPS_OF_VERT) {
+ BMFace *f_copy; /* the copy of 'f' */
- /* only loop data, no vertex data since that contains shape keys,
- * and we do not want to mess up other shape keys */
- BM_loop_interp_from_face(em->bm, l, f_copy, false, is_final);
+ f_copy = BLI_ghash_lookup(sod->origfaces, l->f);
- /* make sure face-attributes are correct (e.g. MTexPoly) */
- BM_elem_attrs_copy(sod->bm_origfaces, em->bm, f_copy, l->f);
- }
+ /* only loop data, no vertex data since that contains shape keys,
+ * and we do not want to mess up other shape keys */
+ BM_loop_interp_from_face(em->bm, l, f_copy, false, is_final);
+
+ /* make sure face-attributes are correct (e.g. MTexPoly) */
+ BM_elem_attrs_copy(sod->bm_origfaces, em->bm, f_copy, l->f);
+ }
- for (j = 0; j < sod->layer_math_map_num; j++) {
- BM_vert_loop_groups_data_layer_merge(em->bm, sv->cd_loop_groups[j], layer_math_map[j]);
+ for (j = 0; j < sod->layer_math_map_num; j++) {
+ BM_vert_loop_groups_data_layer_merge(em->bm, sv->cd_loop_groups[j], layer_math_map[j]);
+ }
}
}
}