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>2013-06-03 03:20:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-03 03:20:49 +0400
commitdfad9b0c09eed2de2c3bedd64691bf11f637725c (patch)
tree86298761e9883ca7dc83b3b5a24a859bdd07bfce /source/blender/modifiers
parent99b55ef6eb7d677ead66b4166afe45688147a5b3 (diff)
fix [#35555] Collada: export destroys mesh in some cases
add arguments to calculate normals when converting to bmesh: BM_mesh_bm_from_me, DM_to_bmesh This gives some speedup to undo (which didnt need to re-calculate vertex normals), and array modifier which doesnt need to calculate face normals at all
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_array.c4
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c2
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c6
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c3
-rw-r--r--source/blender/modifiers/intern/MOD_triangulate.c2
5 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 36461851162..e09fa18ffc5 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -228,7 +228,7 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
/* Add the DerivedMesh's elements to the BMesh. The pre-existing
* elements were already tagged, so the new elements can be
* identified by not having the BM_ELEM_TAG flag set. */
- DM_to_bmesh_ex(dm, bm);
+ DM_to_bmesh_ex(dm, bm, false);
if (amd->flags & MOD_ARR_MERGE) {
/* if merging is enabled, find doubles */
@@ -330,7 +330,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
int UNUSED(initFlags))
{
DerivedMesh *result;
- BMesh *bm = DM_to_bmesh(dm);
+ BMesh *bm = DM_to_bmesh(dm, false);
BMOperator first_dupe_op, dupe_op, old_dupe_op, weld_op;
BMVert **first_geom = NULL;
int i, j;
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index cbb0e05aa4a..3713cb817f5 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -113,7 +113,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
const bool vertex_only = (bmd->flags & BME_BEVEL_VERT) != 0;
const bool do_clamp = !(bmd->flags & BME_BEVEL_OVERLAP_OK);
- bm = DM_to_bmesh(dm);
+ bm = DM_to_bmesh(dm, true);
if (vertex_only) {
if ((bmd->lim_flags & BME_BEVEL_VGROUP) && bmd->defgrp_name[0]) {
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index b8dccd9ffbe..aacf622c185 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -97,6 +97,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
DecimateModifierData *dmd = (DecimateModifierData *) md;
DerivedMesh *dm = derivedData, *result = NULL;
BMesh *bm;
+ bool calc_face_normal;
float *vweights = NULL;
@@ -112,16 +113,19 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (dmd->percent == 1.0f) {
return dm;
}
+ calc_face_normal = true;
break;
case MOD_DECIM_MODE_UNSUBDIV:
if (dmd->iter == 0) {
return dm;
}
+ calc_face_normal = false;
break;
case MOD_DECIM_MODE_DISSOLVE:
if (dmd->angle == 0.0f) {
return dm;
}
+ calc_face_normal = true;
break;
}
@@ -159,7 +163,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
}
- bm = DM_to_bmesh(dm);
+ bm = DM_to_bmesh(dm, calc_face_normal);
switch (dmd->mode) {
case MOD_DECIM_MODE_COLLAPSE:
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 0c50d4d3323..d877932b81d 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -56,8 +56,9 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
BMIter iter;
BMEdge *e;
float threshold = cosf((emd->split_angle + 0.00001f) * (float)M_PI / 180.0f);
+ const bool calc_face_normals = (emd->flags & MOD_EDGESPLIT_FROMANGLE) != 0;
- bm = DM_to_bmesh(dm);
+ bm = DM_to_bmesh(dm, calc_face_normals);
if (emd->flags & MOD_EDGESPLIT_FROMANGLE) {
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c
index fd0bc218bc4..9155aa0044b 100644
--- a/source/blender/modifiers/intern/MOD_triangulate.c
+++ b/source/blender/modifiers/intern/MOD_triangulate.c
@@ -40,7 +40,7 @@ static DerivedMesh *triangulate_dm(DerivedMesh *dm, const int flag)
int total_edges, i;
MEdge *me;
- bm = DM_to_bmesh(dm);
+ bm = DM_to_bmesh(dm, true);
BM_mesh_triangulate(bm, (flag & MOD_TRIANGULATE_BEAUTY), false, NULL, NULL);