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; }