[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51526] trunk/blender/source/blender: fix for issues in new decimator
Campbell Barton
ideasman42 at gmail.com
Tue Oct 23 08:38:00 CEST 2012
Revision: 51526
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51526
Author: campbellbarton
Date: 2012-10-23 06:37:58 +0000 (Tue, 23 Oct 2012)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/bmesh/intern/bmesh_decimate_collapse.c
trunk/blender/source/blender/makesrna/intern/rna_modifier.c
trunk/blender/source/blender/modifiers/intern/MOD_decimate.c
Modified: trunk/blender/source/blender/bmesh/intern/bmesh_decimate_collapse.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_decimate_collapse.c 2012-10-23 06:13:56 UTC (rev 51525)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_decimate_collapse.c 2012-10-23 06:37:58 UTC (rev 51526)
@@ -231,12 +231,6 @@
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 @@
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 @@
* - 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 */
Modified: trunk/blender/source/blender/makesrna/intern/rna_modifier.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_modifier.c 2012-10-23 06:13:56 UTC (rev 51525)
+++ trunk/blender/source/blender/makesrna/intern/rna_modifier.c 2012-10-23 06:37:58 UTC (rev 51526)
@@ -1143,7 +1143,7 @@
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");
Modified: trunk/blender/source/blender/modifiers/intern/MOD_decimate.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_decimate.c 2012-10-23 06:13:56 UTC (rev 51525)
+++ trunk/blender/source/blender/modifiers/intern/MOD_decimate.c 2012-10-23 06:37:58 UTC (rev 51526)
@@ -103,13 +103,28 @@
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;
}
More information about the Bf-blender-cvs
mailing list