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>2012-04-24 03:01:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-24 03:01:03 +0400
commit03f451f2f18cccd80d0d56391c4836da34641a60 (patch)
treecccbf490c4f740bf074418b9c61ae3732eec8698 /source/blender/bmesh
parent68595376795ce7cc9bf01fb5851a2bc76a97a01c (diff)
fix own error with subdivision (broke icosphere), also noticed icosphere vanished at subd-5 which didnt happen before bmesh.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c6
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c10
2 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index e247a69f1e9..f72efe8ab5f 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -484,12 +484,14 @@ static int bm_to_mesh_shape_layer_index_from_kb(BMesh *bm, KeyBlock *currkey)
BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
{
/* this is a cheap way to set the edge draw, its not precise and will
- * pick the first 2 faces an edge uses */
+ * pick the first 2 faces an edge uses.
+ * The dot comparison is a little arbitrary, but set so that a 5 subd
+ * IcoSphere won't vanish but subd 6 will (as with pre-bmesh blender) */
if ( /* (med->flag & ME_EDGEDRAW) && */ /* assume to be true */
(e->l && (e->l != e->l->radial_next)) &&
- (dot_v3v3(e->l->f->no, e->l->radial_next->f->no) > 0.998f))
+ (dot_v3v3(e->l->f->no, e->l->radial_next->f->no) > 0.9995f))
{
med->flag &= ~ME_EDGEDRAW;
}
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index d5f46ebfc85..7da02a594d5 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -109,7 +109,11 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
copy_v3_v3(co, v->co);
copy_v3_v3(prev_co, co);
- if (params->use_smooth) {
+ if (UNLIKELY(params->use_sphere)) { /* subdivide sphere */
+ normalize_v3(co);
+ mul_v3_fl(co, params->smooth);
+ }
+ else if (params->use_smooth) {
/* we calculate an offset vector vec1[], to be added to *co */
float len, nor[3], nor1[3], nor2[3], smooth = params->smooth;
@@ -134,10 +138,6 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
add_v3_v3(co, tvec);
}
- else if (params->use_sphere) { /* subdivide sphere */
- normalize_v3(co);
- mul_v3_fl(co, params->smooth);
- }
if (params->use_fractal) {
float len = len_v3v3(vsta->co, vend->co);