Revision: 49035
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49035
Author:   campbellbarton
Date:     2012-07-18 16:24:13 +0000 (Wed, 18 Jul 2012)
Log Message:
-----------
workaround for a bug with zero edges getting removed got feather faces out of 
sync and crashed

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c
    trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp
    trunk/blender/source/blender/makesrna/intern/rna_mask.c

Modified: trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c     
2012-07-18 14:30:31 UTC (rev 49034)
+++ trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c     
2012-07-18 16:24:13 UTC (rev 49035)
@@ -47,6 +47,10 @@
 
 #ifndef USE_RASKTER
 
+/* this is rather and annoying hack, use define to isolate it.
+ * problem is caused by scanfill removing edges on us. */
+#define USE_SCANFILL_EDGE_WORKAROUND
+
 #define SPLINE_RESOL_CAP_PER_PIXEL 2
 #define SPLINE_RESOL_CAP_MIN 8
 #define SPLINE_RESOL_CAP_MAX 64
@@ -548,6 +552,11 @@
                unsigned int sf_vert_tot = 0;
                unsigned int tot_feather_quads = 0;
 
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+               unsigned int tot_boundary_used = 0;
+               unsigned int tot_boundary_found = 0;
+#endif
+
                if (masklay->restrictflag & MASK_RESTRICT_RENDER) {
                        /* skip the layer */
                        mr_handle->layers_tot--;
@@ -580,6 +589,7 @@
                        if (do_feather) {
                                diff_feather_points = 
BKE_mask_spline_feather_differentiated_points_with_resolution_ex(
                                                          spline, 
&tot_diff_feather_points, resol, TRUE);
+                               BLI_assert(diff_feather_points);
                        }
                        else {
                                tot_diff_feather_points = 0;
@@ -661,8 +671,15 @@
 
                                        for (j = 0; j < tot_diff_point; j++) {
                                                ScanFillEdge *sf_edge = 
BLI_scanfill_edge_add(&sf_ctx, sf_vert_prev, sf_vert);
-                                               sf_edge->tmp.c = 
SF_EDGE_IS_BOUNDARY;
 
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+                                               if (diff_feather_points) {
+                                                       sf_edge->tmp.c = 
SF_EDGE_IS_BOUNDARY;
+                                                       tot_boundary_used++;
+                                               }
+#else
+                                               (void)sf_edge;
+#endif
                                                sf_vert_prev = sf_vert;
                                                sf_vert = sf_vert->next;
                                        }
@@ -877,10 +894,20 @@
                                                *(face++) = 
sf_edge->v1->keyindex;
                                                face_index++;
                                                FACE_ASSERT(face - 4, 
sf_vert_tot);
+
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+                                               tot_boundary_found++;
+#endif
                                        }
                                }
                        }
 
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+                       if (tot_boundary_found != tot_boundary_used) {
+                               BLI_assert(tot_boundary_found < 
tot_boundary_used);
+                       }
+#endif
+
                        /* feather only splines */
                        while (open_spline_index > 0) {
                                const unsigned int vertex_offset         = 
open_spline_ranges[--open_spline_index].vertex_offset;
@@ -999,15 +1026,22 @@
 
                        MEM_freeN(open_spline_ranges);
 
-                       // fprintf(stderr, "%d %d\n", face_index, sf_face_tot + 
tot_feather_quads);
+//                     fprintf(stderr, "%u %u (%u %u), %u\n", face_index, 
sf_tri_tot + tot_feather_quads, sf_tri_tot, tot_feather_quads, 
tot_boundary_used - tot_boundary_found);
 
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+                       BLI_assert(face_index + (tot_boundary_used - 
tot_boundary_found) == sf_tri_tot + tot_feather_quads);
+#else
                        BLI_assert(face_index == sf_tri_tot + 
tot_feather_quads);
-
+#endif
                        {
                                MaskRasterLayer *layer = 
&mr_handle->layers[masklay_index];
 
                                if (BLI_rctf_isect(&default_bounds, &bounds, 
&bounds)) {
-                                       layer->face_tot = sf_tri_tot + 
tot_feather_quads;
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+                                       layer->face_tot = (sf_tri_tot + 
tot_feather_quads) - (tot_boundary_used - tot_boundary_found);
+#else
+                                       layer->face_tot = (sf_tri_tot + 
tot_feather_quads);
+#endif
                                        layer->face_coords = face_coords;
                                        layer->face_array  = face_array;
                                        layer->bounds = bounds;

Modified: trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp        
2012-07-18 14:30:31 UTC (rev 49034)
+++ trunk/blender/source/blender/compositor/intern/COM_WorkScheduler.cpp        
2012-07-18 16:24:13 UTC (rev 49035)
@@ -36,10 +36,13 @@
 #include "BLI_threads.h"
 
 #if COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD
-#warning COM_CURRENT_THREADING_MODEL COM_TM_NOTHREAD is activated. Use only 
for debugging.
+#  ifndef DEBUG  /* test this so we dont get warnings in debug builds */
+#    warning COM_CURRENT_THREADING_MODEL COM_TM_NOTHREAD is activated. Use 
only for debugging.
+#  endif
 #elif COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
+   /* do nothing - default */
 #else
-#error COM_CURRENT_THREADING_MODEL No threading model selected
+#  error COM_CURRENT_THREADING_MODEL No threading model selected
 #endif
 
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_mask.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_mask.c     2012-07-18 
14:30:31 UTC (rev 49034)
+++ trunk/blender/source/blender/makesrna/intern/rna_mask.c     2012-07-18 
16:24:13 UTC (rev 49035)
@@ -642,7 +642,7 @@
        /* render settings */
        prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "alpha");
-       RNA_def_property_range(prop, 0.0, 1.0f);
+       RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
        RNA_def_property_ui_text(prop, "Opacity", "Render Opacity");
        RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
 

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to