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>2011-11-07 15:08:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-07 15:08:33 +0400
commit9842d845f8c4aae9631be0f38bbc0f938bb356d0 (patch)
tree4d26a73249d6db6c82ddeed8ae0df760b84d1f7b
parentb0a21add8a0c2ad05ca6cbff43e4490d674aac9d (diff)
don't write into bmesh edge indices when calculating solidify normals
-rw-r--r--source/blender/bmesh/editmesh_tools.c6
-rw-r--r--source/blender/bmesh/operators/extrudeops.c20
2 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/bmesh/editmesh_tools.c b/source/blender/bmesh/editmesh_tools.c
index 4735d3422f7..d05bf3e5177 100644
--- a/source/blender/bmesh/editmesh_tools.c
+++ b/source/blender/bmesh/editmesh_tools.c
@@ -5227,7 +5227,7 @@ int EdgeSlide(short immediate, float imperc)
interp_v2_v2v2(uv_tmp, suv->origuv, (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc));
fuv_link = suv->fuv_list;
while (fuv_link) {
- VECCOPY2D(((float *)fuv_link->link), uv_tmp);
+ copy_v2_v2(((float *)fuv_link->link), uv_tmp);
fuv_link = fuv_link->next;
}
}
@@ -5257,7 +5257,7 @@ int EdgeSlide(short immediate, float imperc)
interp_v2_v2v2(uv_tmp, suv->uv_down, suv->uv_up, fabs(newlen));
fuv_link = suv->fuv_list;
while (fuv_link) {
- VECCOPY2D(((float *)fuv_link->link), uv_tmp);
+ copy_v2_v2(((float *)fuv_link->link), uv_tmp);
fuv_link = fuv_link->next;
}
}
@@ -5274,7 +5274,7 @@ int EdgeSlide(short immediate, float imperc)
interp_v2_v2v2(uv_tmp, suv->uv_up, suv->uv_down, fabs(newlen));
fuv_link = suv->fuv_list;
while (fuv_link) {
- VECCOPY2D(((float *)fuv_link->link), uv_tmp);
+ copy_v2_v2(((float *)fuv_link->link), uv_tmp);
fuv_link = fuv_link->next;
}
}
diff --git a/source/blender/bmesh/operators/extrudeops.c b/source/blender/bmesh/operators/extrudeops.c
index 53086c272f8..c31c34a8b3e 100644
--- a/source/blender/bmesh/operators/extrudeops.c
+++ b/source/blender/bmesh/operators/extrudeops.c
@@ -348,16 +348,17 @@ static void calc_solidify_normals(BMesh *bm)
float edge_normal[3];
int i;
- /* Clear indices of verts & edges */
+ /* can't use BM_Edge_FaceCount because we need to count only marked faces */
+ int *edge_face_count= MEM_callocN(sizeof(int) * bm->totedge, __func__);
+
BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) {
BM_SetHFlag(v, BM_TMP_TAG);
}
- /* BMESH_TODO, don't abuse vertex index index info */
- /* this is used to count edge users, we can probably
- * use bmesh connectivity info here - campbell*/
+ /* todo - replace with func! */
+ i= 0;
BM_ITER(e, &eiter, bm, BM_EDGES_OF_MESH, NULL) {
- BM_SetIndex(e, 0);
+ BM_SetIndex(e, i++);
}
BM_ITER(f, &fiter, bm, BM_FACES_OF_MESH, NULL) {
@@ -366,15 +367,13 @@ static void calc_solidify_normals(BMesh *bm)
}
BM_ITER(e, &eiter, bm, BM_EDGES_OF_FACE, f) {
- /* Count number of marked faces using e */
- i = BM_GetIndex(e);
- BM_SetIndex(e, i+1);
/* And mark all edges and vertices on the
marked faces */
BMO_SetFlag(bm, e, EDGE_MARK);
BMO_SetFlag(bm, e->v1, VERT_MARK);
BMO_SetFlag(bm, e->v2, VERT_MARK);
+ edge_face_count[BM_GetIndex(e)]++;
}
}
@@ -383,7 +382,7 @@ static void calc_solidify_normals(BMesh *bm)
continue;
}
- i = BM_GetIndex(e);
+ i = edge_face_count[BM_GetIndex(e)]++;
if (i == 0 || i > 2) {
/* Edge & vertices are non-manifold even when considering
@@ -393,6 +392,8 @@ static void calc_solidify_normals(BMesh *bm)
BMO_SetFlag(bm, e->v2, VERT_NONMAN);
}
}
+ MEM_freeN(edge_face_count);
+ edge_face_count= NULL; /* dont re-use */
BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) {
if (BM_Nonmanifold_Vert(bm, v)) {
@@ -508,6 +509,7 @@ static void solidify_add_thickness(BMesh *bm, float dist)
float *angles = NULL;
BLI_array_staticdeclare(angles, 16);
+ /* BMESH_TODO, remove this when we are sure the array will be valid */
i = 0;
BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
BM_SetIndex(v, i++);