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:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-03-27 16:34:00 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-03-27 16:34:00 +0400
commitf71f09d71436c06c8d7cff0c578249a97b0ac03c (patch)
treec01d8ae1d7d7588610e00072a77309de35f2785a /source/blender/blenkernel/intern/modifiers_bmesh.c
parent9c9745ef304f0a622de35e2446f062dc0e760a14 (diff)
Partial fix for bug 30695, "Array broke crease, weird visibility and slowdown"
* Array modifier creates BMesh from DM; add missing CD_CREASE layer for edge creases. * With a modifier stack like mirror+subsurf+array, face normals were wrong. Fix by removing CD_NORMAL layer from CCGDM output. Previously the elements in this layer were simply copied, so they did not reflect subdivision correctly. * Minor style fixes in bmo_dupe.c. Issues not yet addressed: * Subsurf's optimal draw setting for hiding subdivision edges is not respected by the array output. * Slowdown issue; array modifier is much slower than in 2.62.
Diffstat (limited to 'source/blender/blenkernel/intern/modifiers_bmesh.c')
-rw-r--r--source/blender/blenkernel/intern/modifiers_bmesh.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c
index 20fdd4b2b48..52b76eabc6c 100644
--- a/source/blender/blenkernel/intern/modifiers_bmesh.c
+++ b/source/blender/blenkernel/intern/modifiers_bmesh.c
@@ -49,6 +49,7 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
MLoop *mloop, *ml;
BMVert *v, **vtable, **verts = NULL;
BMEdge *e, **etable, **edges = NULL;
+ float has_face_normals;
BMFace *f;
BMIter liter;
BLI_array_declare(verts);
@@ -65,6 +66,9 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
totedge = dm->getNumEdges(dm);
/* totface = dm->getNumPolys(dm); */ /* UNUSED */
+ /* add crease layer */
+ BM_data_layer_add(bm, &bm->edata, CD_CREASE);
+
vtable = MEM_callocN(sizeof(void**) * totvert, "vert table in BMDM_Copy");
etable = MEM_callocN(sizeof(void**) * totedge, "edge table in BMDM_Copy");
@@ -89,12 +93,16 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
CustomData_to_bmesh_block(&dm->edgeData, &bm->edata, i, &e->head.data);
etable[i] = e;
+
+ /* add crease */
+ BM_elem_float_data_set(&bm->edata, e, CD_CREASE, (float)me->crease / 255.0f);
}
MEM_freeN(medge);
/*do faces*/
mp = dm->getPolyArray(dm);
mloop = dm->getLoopArray(dm);
+ has_face_normals = CustomData_has_layer(&dm->polyData, CD_NORMAL);
for (i = 0; i < dm->numPolyData; i++, mp++) {
BMLoop *l;
@@ -126,6 +134,13 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
}
CustomData_to_bmesh_block(&dm->polyData, &bm->pdata, i, &f->head.data);
+
+ if (has_face_normals) {
+ float *fno;
+
+ fno = CustomData_bmesh_get(&bm->pdata, &f->head.data, CD_NORMAL);
+ copy_v3_v3(f->no, fno);
+ }
}
MEM_freeN(vtable);