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-10-23 10:37:58 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-23 10:37:58 +0400
commit13940cc78ece7b592a323123f31669034d73a833 (patch)
tree5572b9f14d9eb35b14dac9c8346115da07e44a36 /source/blender
parenta82af0d220835970f83c63ade5e1b2309a993ec5 (diff)
fix for issues in new decimator
- when an edge exists across a quad, dont attempt to triangulate it. (such a case isn't so common anyway) - silly mistake when checking if anything needed to be done in the modifier, percent was being checked for 1.0 even when not used.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/bmesh/intern/bmesh_decimate_collapse.c11
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c2
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c23
3 files changed, 24 insertions, 12 deletions
diff --git a/source/blender/bmesh/intern/bmesh_decimate_collapse.c b/source/blender/bmesh/intern/bmesh_decimate_collapse.c
index 8f275f6f3d3..5935a844988 100644
--- a/source/blender/bmesh/intern/bmesh_decimate_collapse.c
+++ b/source/blender/bmesh/intern/bmesh_decimate_collapse.c
@@ -231,12 +231,6 @@ static void bm_decim_build_edge_cost(BMesh *bm,
static int bm_decim_triangulate_begin(BMesh *bm)
{
-#ifdef USE_SAFETY_CHECKS
- const int check_double_edges = TRUE;
-#else
- const int check_double_edges = FALSE;
-#endif
-
BMIter iter;
BMFace *f;
// int has_quad; // could optimize this a little
@@ -285,6 +279,9 @@ static int bm_decim_triangulate_begin(BMesh *bm)
l_b = f_l[3];
}
+#ifdef USE_SAFETY_CHECKS
+ if (BM_edge_exists(l_a->v, l_b->v) == FALSE)
+#endif
{
BMFace *f_new;
BMLoop *l_new;
@@ -293,7 +290,7 @@ static int bm_decim_triangulate_begin(BMesh *bm)
* - if there is a quad that has a free standing edge joining it along
* where we want to split the face, there isnt a good way we can handle this.
* currently that edge will get removed when joining the tris back into a quad. */
- f_new = BM_face_split(bm, f, l_a->v, l_b->v, &l_new, NULL, check_double_edges);
+ f_new = BM_face_split(bm, f, l_a->v, l_b->v, &l_new, NULL, FALSE);
if (f_new) {
/* the value of this doesn't matter, only that the 2 loops match and have unique values */
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 23d9a9065d5..1ec2c391efc 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1143,7 +1143,7 @@ static void rna_def_modifier_decimate(BlenderRNA *brna)
prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "iter");
RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_range(prop, 1, 100, 1, 0);
+ RNA_def_property_ui_range(prop, 0, 100, 1, 0);
RNA_def_property_ui_text(prop, "Iterations", "Number of times reduce the geometry (unsubdivide only)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index a9bc9cbf83a..cf409c27b2f 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -103,13 +103,28 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
float *vweights = NULL;
#ifdef USE_TIMEIT
- TIMEIT_START(decim);
+ TIMEIT_START(decim);
#endif
- if (dmd->percent == 1.0f) {
- return dm;
+ switch (dmd->mode) {
+ case MOD_DECIM_MODE_COLLAPSE:
+ if (dmd->percent == 1.0f) {
+ return dm;
+ }
+ break;
+ case MOD_DECIM_MODE_UNSUBDIV:
+ if (dmd->iter == 0) {
+ return dm;
+ }
+ break;
+ case MOD_DECIM_MODE_DISSOLVE:
+ if (dmd->angle == 0.0f) {
+ return dm;
+ }
+ break;
}
- else if (dm->getNumPolys(dm) <= 3) {
+
+ if (dm->getNumPolys(dm) <= 3) {
modifier_setError(md, "%s", TIP_("Modifier requires more than 3 input faces"));
return dm;
}