[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48938] branches/soc-2011-tomato: Merging r48928 through r48937 from trunk into soc-2011-tomato

Sergey Sharybin sergey.vfx at gmail.com
Sun Jul 15 12:51:36 CEST 2012


Revision: 48938
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48938
Author:   nazgul
Date:     2012-07-15 10:51:36 +0000 (Sun, 15 Jul 2012)
Log Message:
-----------
Merging r48928 through r48937 from trunk into soc-2011-tomato

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48928
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48937

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c
    branches/soc-2011-tomato/source/blender/blenlib/BLI_rect.h
    branches/soc-2011-tomato/source/blender/blenlib/intern/rct.c
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
    branches/soc-2011-tomato/source/blender/editors/gpencil/drawgpencil.c
    branches/soc-2011-tomato/source/blender/editors/interface/interface_draw.c
    branches/soc-2011-tomato/source/blender/editors/interface/interface_handlers.c
    branches/soc-2011-tomato/source/blender/editors/screen/area.c
    branches/soc-2011-tomato/source/blender/editors/screen/screen_ops.c
    branches/soc-2011-tomato/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2011-tomato/source/blender/editors/space_file/file_ops.c
    branches/soc-2011-tomato/source/blender/editors/space_image/image_buttons.c
    branches/soc-2011-tomato/source/blender/editors/space_image/image_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
    branches/soc-2011-tomato/source/blender/editors/space_node/node_edit.c
    branches/soc-2011-tomato/source/blender/editors/space_node/node_select.c
    branches/soc-2011-tomato/source/blender/editors/space_node/node_state.c
    branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_edit.c
    branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_select.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_view.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_mask_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_mask.c
    branches/soc-2011-tomato/source/blender/render/intern/source/shadbuf.c
    branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_draw.c
    branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_event_system.c

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-48927
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-48937

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2012-07-15 10:48:19 UTC (rev 48937)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2012-07-15 10:51:36 UTC (rev 48938)
@@ -708,6 +708,7 @@
             row.prop(active_layer, "invert", text="", icon='IMAGE_ALPHA')
 
             layout.prop(active_layer, "blend")
+            layout.prop(active_layer, "falloff")
 
 
 class CLIP_PT_active_mask_spline(Panel):

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c	2012-07-15 10:48:19 UTC (rev 48937)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c	2012-07-15 10:51:36 UTC (rev 48938)
@@ -32,6 +32,7 @@
 
 #include "DNA_vec_types.h"
 #include "DNA_mask_types.h"
+#include "DNA_scene_types.h"
 
 #include "BLI_utildefines.h"
 #include "BLI_scanfill.h"
@@ -93,9 +94,16 @@
 	float  alpha;
 	char   blend;
 	char   blend_flag;
+	char   falloff;
 
 } MaskRasterLayer;
 
+typedef struct MaskRasterSplineInfo {
+	unsigned int vertex_offset;
+	unsigned int vertex_total;
+	unsigned int is_cyclic;
+} MaskRasterSplineInfo;
+
 /**
  * opaque local struct for mask pixel lookup, each MaskLayer needs one of these
  */
@@ -107,7 +115,6 @@
 	rctf bounds;
 };
 
-
 /* --------------------------------------------------------------------- */
 /* alloc / free functions                                                */
 /* --------------------------------------------------------------------- */
@@ -293,6 +300,17 @@
 	}
 }
 
+static void layer_bucket_init_dummy(MaskRasterLayer *layer)
+{
+	layer->buckets_x = 0;
+	layer->buckets_y = 0;
+
+	layer->buckets_xy_scalar[0] = 0.0f;
+	layer->buckets_xy_scalar[1] = 0.0f;
+
+	layer->buckets_face = NULL;
+}
+
 static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
 {
 	MemArena *arena = BLI_memarena_new(1 << 16, __func__);
@@ -358,34 +376,42 @@
 
 			/* not essential but may as will skip any faces outside the view */
 			if (!((xmax < 0.0f) || (ymax < 0.0f) || (xmin > 1.0f) || (ymin > 1.0f))) {
-				const unsigned int xi_min = (unsigned int) ((xmin - layer->bounds.xmin) * layer->buckets_xy_scalar[0]);
-				const unsigned int xi_max = (unsigned int) ((xmax - layer->bounds.xmin) * layer->buckets_xy_scalar[0]);
-				const unsigned int yi_min = (unsigned int) ((ymin - layer->bounds.ymin) * layer->buckets_xy_scalar[1]);
-				const unsigned int yi_max = (unsigned int) ((ymax - layer->bounds.ymin) * layer->buckets_xy_scalar[1]);
-				void *face_index_void = SET_UINT_IN_POINTER(face_index);
 
-				unsigned int xi, yi;
+				CLAMP(xmin, 0.0f,  1.0f);
+				CLAMP(ymin, 0.0f,  1.0f);
+				CLAMP(xmax, 0.0f,  1.0f);
+				CLAMP(ymax, 0.0f,  1.0f);
 
-				for (yi = yi_min; yi <= yi_max; yi++) {
-					unsigned int bucket_index = (layer->buckets_x * yi) + xi_min;
-					for (xi = xi_min; xi <= xi_max; xi++, bucket_index++) {
-						// unsigned int bucket_index = (layer->buckets_x * yi) + xi; /* correct but do in outer loop */
+				{
+					const unsigned int xi_min = (unsigned int) ((xmin - layer->bounds.xmin) * layer->buckets_xy_scalar[0]);
+					const unsigned int xi_max = (unsigned int) ((xmax - layer->bounds.xmin) * layer->buckets_xy_scalar[0]);
+					const unsigned int yi_min = (unsigned int) ((ymin - layer->bounds.ymin) * layer->buckets_xy_scalar[1]);
+					const unsigned int yi_max = (unsigned int) ((ymax - layer->bounds.ymin) * layer->buckets_xy_scalar[1]);
+					void *face_index_void = SET_UINT_IN_POINTER(face_index);
 
-						BLI_assert(xi < layer->buckets_x);
-						BLI_assert(yi < layer->buckets_y);
-						BLI_assert(bucket_index < bucket_tot);
+					unsigned int xi, yi;
 
-						/* check if the bucket intersects with the face */
-						/* note: there is a tradeoff here since checking box/tri intersections isn't
-						 * as optimal as it could be, but checking pixels against faces they will never intersect
-						 * with is likely the greater slowdown here - so check if the cell intersects the face */
-						if (layer_bucket_isect_test(layer, face_index,
-						                            xi, yi,
-						                            bucket_size_x, bucket_size_y,
-						                            bucket_max_rad_squared))
-						{
-							BLI_linklist_prepend_arena(&bucketstore[bucket_index], face_index_void, arena);
-							bucketstore_tot[bucket_index]++;
+					for (yi = yi_min; yi <= yi_max; yi++) {
+						unsigned int bucket_index = (layer->buckets_x * yi) + xi_min;
+						for (xi = xi_min; xi <= xi_max; xi++, bucket_index++) {
+							// unsigned int bucket_index = (layer->buckets_x * yi) + xi; /* correct but do in outer loop */
+
+							BLI_assert(xi < layer->buckets_x);
+							BLI_assert(yi < layer->buckets_y);
+							BLI_assert(bucket_index < bucket_tot);
+
+							/* check if the bucket intersects with the face */
+							/* note: there is a tradeoff here since checking box/tri intersections isn't
+							 * as optimal as it could be, but checking pixels against faces they will never intersect
+							 * with is likely the greater slowdown here - so check if the cell intersects the face */
+							if (layer_bucket_isect_test(layer, face_index,
+							                            xi, yi,
+							                            bucket_size_x, bucket_size_y,
+							                            bucket_max_rad_squared))
+							{
+								BLI_linklist_prepend_arena(&bucketstore[bucket_index], face_index_void, arena);
+								bucketstore_tot[bucket_index]++;
+							}
 						}
 					}
 				}
@@ -431,6 +457,7 @@
                                    const short do_aspect_correct, const short do_mask_aa,
                                    const short do_feather)
 {
+	const rctf default_bounds = {0.0f, 1.0f, 0.0f, 1.0f};
 	const int resol = SPLINE_RESOL;  /* TODO: real size */
 	const float pixel_size = 1.0f / MIN2(width, height);
 
@@ -446,7 +473,7 @@
 
 		const unsigned int tot_splines = BLI_countlist(&masklay->splines);
 		/* we need to store vertex ranges for open splines for filling */
-		unsigned int (*open_spline_ranges)[2] = MEM_callocN(sizeof(open_spline_ranges) * tot_splines, __func__);
+		MaskRasterSplineInfo *open_spline_ranges = MEM_callocN(sizeof(*open_spline_ranges) * tot_splines, __func__);
 		unsigned int   open_spline_index = 0;
 
 		MaskSpline *spline;
@@ -467,6 +494,7 @@
 		BLI_scanfill_begin(&sf_ctx);
 
 		for (spline = masklay->splines.first; spline; spline = spline->next) {
+			const unsigned int is_cyclic = (spline->flag & MASK_SPLINE_CYCLIC) != 0;
 			const unsigned int is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0;
 
 			float (*diff_points)[2];
@@ -605,8 +633,9 @@
 						float co_feather[3];
 						co_feather[2] = 1.0f;
 
-						open_spline_ranges[open_spline_index ][0] = sf_vert_tot;
-						open_spline_ranges[open_spline_index ][1] = tot_diff_point;
+						open_spline_ranges[open_spline_index].vertex_offset = sf_vert_tot;
+						open_spline_ranges[open_spline_index].vertex_total = tot_diff_point;
+						open_spline_ranges[open_spline_index].is_cyclic = is_cyclic;
 						open_spline_index++;
 
 
@@ -639,8 +668,11 @@
 
 							tot_feather_quads += 2;
 						}
-						tot_feather_quads -= 2;
 
+						if (!is_cyclic) {
+							tot_feather_quads -= 2;
+						}
+
 						MEM_freeN(diff_feather_points);
 
 						/* ack these are infact tris, but they are extra faces so no matter,
@@ -723,8 +755,8 @@
 
 			/* feather only splines */
 			while (open_spline_index > 0) {
-				unsigned int start_vidx          = open_spline_ranges[--open_spline_index][0];
-				unsigned int tot_diff_point_sub1 = open_spline_ranges[  open_spline_index][1] - 1;
+				unsigned int start_vidx          = open_spline_ranges[--open_spline_index].vertex_offset;
+				unsigned int tot_diff_point_sub1 = open_spline_ranges[  open_spline_index].vertex_total - 1;
 				unsigned int k, j;
 
 				j = start_vidx;
@@ -734,20 +766,36 @@
 
 					BLI_assert(j == start_vidx + (k * 3));
 
-					*(face++) = j + 0;
-					*(face++) = j + 1;
-					*(face++) = j + 4; /* next span */
-					*(face++) = j + 3; /* next span */
+					*(face++) = j + 3; /* next span */ /* z 1 */
+					*(face++) = j + 0;                 /* z 1 */
+					*(face++) = j + 1;                 /* z 0 */
+					*(face++) = j + 4; /* next span */ /* z 0 */
 
 					face_index++;
 
-					*(face++) = j + 0;
-					*(face++) = j + 3; /* next span */
-					*(face++) = j + 5; /* next span */
-					*(face++) = j + 2;
+					*(face++) = j + 0;                 /* z 1 */
+					*(face++) = j + 3; /* next span */ /* z 1 */
+					*(face++) = j + 5; /* next span */ /* z 0 */
+					*(face++) = j + 2;                 /* z 0 */
 
 					face_index++;
 				}
+
+				if (open_spline_ranges[open_spline_index].is_cyclic) {
+					*(face++) = start_vidx + 0; /* next span */ /* z 1 */
+					*(face++) = j          + 0;                 /* z 1 */
+					*(face++) = j          + 1;                 /* z 0 */
+					*(face++) = start_vidx + 1; /* next span */ /* z 0 */
+
+					face_index++;
+
+					*(face++) = j          + 0;                 /* z 1 */
+					*(face++) = start_vidx + 0; /* next span */ /* z 1 */
+					*(face++) = start_vidx + 2; /* next span */ /* z 0 */
+					*(face++) = j          + 2;                 /* z 0 */
+
+					face_index++;
+				}
 			}
 
 			MEM_freeN(open_spline_ranges);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list