[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48954] branches/soc-2011-tomato: svn merge ^/trunk/blender -r48937:48953

Campbell Barton ideasman42 at gmail.com
Mon Jul 16 10:48:07 CEST 2012


Revision: 48954
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48954
Author:   campbellbarton
Date:     2012-07-16 08:48:06 +0000 (Mon, 16 Jul 2012)
Log Message:
-----------
svn merge ^/trunk/blender -r48937:48953

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

Modified Paths:
--------------
    branches/soc-2011-tomato/build_files/cmake/macros.cmake
    branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c
    branches/soc-2011-tomato/source/blender/blenlib/BLI_math_geom.h
    branches/soc-2011-tomato/source/blender/blenlib/intern/math_geom.c
    branches/soc-2011-tomato/source/blender/compositor/SConscript
    branches/soc-2011-tomato/source/blender/editors/include/ED_object.h
    branches/soc-2011-tomato/source/blender/editors/object/object_relations.c
    branches/soc-2011-tomato/source/blender/editors/space_node/node_edit.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/outliner_edit.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/nodes/composite/node_composite_tree.c
    branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_init_exit.c
    branches/soc-2011-tomato/source/creator/CMakeLists.txt
    branches/soc-2011-tomato/source/gameengine/Converter/BL_ActionActuator.cpp

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-48937
   + /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-48953

Modified: branches/soc-2011-tomato/build_files/cmake/macros.cmake
===================================================================
--- branches/soc-2011-tomato/build_files/cmake/macros.cmake	2012-07-16 08:42:55 UTC (rev 48953)
+++ branches/soc-2011-tomato/build_files/cmake/macros.cmake	2012-07-16 08:48:06 UTC (rev 48954)
@@ -23,6 +23,25 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
+macro(list_insert_after
+	list_id item_check item_add
+	)
+	set(_index)
+	list(FIND ${list_id} "${item_check}" _index)
+	math(EXPR _index "${_index} + 1")
+	list(INSERT ${list_id} "${_index}" ${item_add})
+	unset(_index)
+endmacro()
+
+macro(list_insert_before
+	list_id item_check item_add
+	)
+	set(_index)
+	list(FIND ${list_id} "${item_check}" _index)
+	list(INSERT ${list_id} "${_index}" ${item_add})
+	unset(_index)
+endmacro()
+
 # foo_bar.spam --> foo_barMySuffix.spam
 macro(file_suffix
 	file_name_new file_name file_suffix

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-16 08:42:55 UTC (rev 48953)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c	2012-07-16 08:48:06 UTC (rev 48954)
@@ -356,10 +356,10 @@
 				const float *v2 = cos[face[1]];
 				const float *v3 = cos[face[2]];
 
-				xmin = fminf(v1[0], fminf(v2[0], v3[0]));
-				xmax = fmaxf(v1[0], fmaxf(v2[0], v3[0]));
-				ymin = fminf(v1[1], fminf(v2[1], v3[1]));
-				ymax = fmaxf(v1[1], fmaxf(v2[1], v3[1]));
+				xmin = minf(v1[0], minf(v2[0], v3[0]));
+				xmax = maxf(v1[0], maxf(v2[0], v3[0]));
+				ymin = minf(v1[1], minf(v2[1], v3[1]));
+				ymax = maxf(v1[1], maxf(v2[1], v3[1]));
 			}
 			else {
 				const float *v1 = cos[face[0]];
@@ -367,10 +367,10 @@
 				const float *v3 = cos[face[2]];
 				const float *v4 = cos[face[3]];
 
-				xmin = fminf(v1[0], fminf(v2[0], fminf(v3[0], v4[0])));
-				xmax = fmaxf(v1[0], fmaxf(v2[0], fmaxf(v3[0], v4[0])));
-				ymin = fminf(v1[1], fminf(v2[1], fminf(v3[1], v4[1])));
-				ymax = fmaxf(v1[1], fmaxf(v2[1], fmaxf(v3[1], v4[1])));
+				xmin = minf(v1[0], minf(v2[0], minf(v3[0], v4[0])));
+				xmax = maxf(v1[0], maxf(v2[0], maxf(v3[0], v4[0])));
+				ymin = minf(v1[1], minf(v2[1], minf(v3[1], v4[1])));
+				ymax = maxf(v1[1], maxf(v2[1], maxf(v3[1], v4[1])));
 			}
 
 
@@ -617,10 +617,6 @@
 							sf_vert_tot++;
 						}
 
-						if (diff_feather_points) {
-							MEM_freeN(diff_feather_points);
-						}
-
 						tot_feather_quads += tot_diff_point;
 					}
 				}
@@ -673,8 +669,6 @@
 							tot_feather_quads -= 2;
 						}
 
-						MEM_freeN(diff_feather_points);
-
 						/* ack these are infact tris, but they are extra faces so no matter,
 						 * +1 becausing adding one vert results in 2 tris (joining the existing endpoints)
 						 */
@@ -687,9 +681,13 @@
 			if (diff_points) {
 				MEM_freeN(diff_points);
 			}
+
+			if (diff_feather_points) {
+				MEM_freeN(diff_feather_points);
+			}
 		}
 
-		if (sf_ctx.fillvertbase.first) {
+		{
 			unsigned int (*face_array)[4], *face;  /* access coords */
 			float        (*face_coords)[3], *cos; /* xy, z 0-1 (1.0 == filled) */
 			int sf_tri_tot;
@@ -727,9 +725,9 @@
 			/* tri's */
 			face = (unsigned int *)face_array;
 			for (sf_tri = sf_ctx.fillfacebase.first, face_index = 0; sf_tri; sf_tri = sf_tri->next, face_index++) {
+				*(face++) = sf_tri->v3->tmp.u;
+				*(face++) = sf_tri->v2->tmp.u;
 				*(face++) = sf_tri->v1->tmp.u;
-				*(face++) = sf_tri->v2->tmp.u;
-				*(face++) = sf_tri->v3->tmp.u;
 				*(face++) = TRI_VERT;
 			}
 
@@ -881,7 +879,7 @@
 		    (cos[1][2] < dist_orig) ||
 		    (cos[2][2] < dist_orig))
 		{
-			if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
+			if (isect_point_tri_v2_cw(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
 				/* we know all tris are close for now */
 				return maskrasterize_layer_z_depth_tri(xy, cos[face[0]], cos[face[1]], cos[face[2]]);
 			}
@@ -889,7 +887,7 @@
 #else
 		/* we know all tris are close for now */
 		if (1) {
-			if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
+			if (isect_point_tri_v2_cw(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
 				return 0.0f;
 			}
 		}
@@ -911,6 +909,8 @@
 				return maskrasterize_layer_z_depth_quad(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]]);
 			}
 #elif 1
+			/* don't use isect_point_tri_v2_cw because we could have bowtie quads */
+
 			if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
 				return maskrasterize_layer_z_depth_tri(xy, cos[face[0]], cos[face[1]], cos[face[2]]);
 			}
@@ -979,21 +979,21 @@
 		float value_layer;
 
 		if (BLI_in_rctf_v(&layer->bounds, xy)) {
-			float val = 1.0f - layer_bucket_depth_from_xy(layer, xy);
+			value_layer = 1.0f - layer_bucket_depth_from_xy(layer, xy);
 
 			switch (layer->falloff) {
 				case PROP_SMOOTH:
 					/* ease - gives less hard lines for dilate/erode feather */
-					val = (3.0f * val * val - 2.0f * val * val * val);
+					value_layer = (3.0f * value_layer * value_layer - 2.0f * value_layer * value_layer * value_layer);
 					break;
 				case PROP_SPHERE:
-					val = sqrtf(2.0f * val - val * val);
+					value_layer = sqrtf(2.0f * value_layer - value_layer * value_layer);
 					break;
 				case PROP_ROOT:
-					val = sqrtf(val);
+					value_layer = sqrtf(value_layer);
 					break;
 				case PROP_SHARP:
-					val = val * val;
+					value_layer = value_layer * value_layer;
 					break;
 				case PROP_LIN:
 				default:
@@ -1001,7 +1001,9 @@
 					break;
 			}
 
-			value_layer = val * layer->alpha;
+			if (layer->blend != MASK_BLEND_REPLACE) {
+				value_layer *= layer->alpha;
+			}
 		}
 		else {
 			value_layer = 0.0f;
@@ -1012,17 +1014,28 @@
 		}
 
 		switch (layer->blend) {
+			case MASK_BLEND_ADD:
+				value += value_layer;
+				break;
 			case MASK_BLEND_SUBTRACT:
-			{
 				value -= value_layer;
 				break;
-			}
-			case MASK_BLEND_ADD:
-			default:
-			{
+			case MASK_BLEND_LIGHTEN:
+				value = maxf(value, value_layer);
+				break;
+			case MASK_BLEND_DARKEN:
+				value = minf(value, value_layer);
+				break;
+			case MASK_BLEND_MUL:
+				value *= value_layer;
+				break;
+			case MASK_BLEND_REPLACE:
+				value = (value * (1.0f - layer->alpha)) + (value_layer * layer->alpha);
+				break;
+			default: /* same as add */
+				BLI_assert(0);
 				value += value_layer;
 				break;
-			}
 		}
 	}
 

Modified: branches/soc-2011-tomato/source/blender/blenlib/BLI_math_geom.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenlib/BLI_math_geom.h	2012-07-16 08:42:55 UTC (rev 48953)
+++ branches/soc-2011-tomato/source/blender/blenlib/BLI_math_geom.h	2012-07-16 08:48:06 UTC (rev 48954)
@@ -87,6 +87,7 @@
 #define ISECT_LINE_LINE_EXACT        1
 #define ISECT_LINE_LINE_CROSS        2
 
+int isect_line_line_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]);
 int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]);
 int isect_line_line_v2_int(const int a1[2], const int a2[2], const int b1[2], const int b2[2]);
 int isect_line_sphere_v3(const float l1[3], const float l2[3], const float sp[3], const float r, float r_p1[3], float r_p2[3]);
@@ -153,6 +154,7 @@
 int isect_point_quad_v2(const float p[2], const float a[2], const float b[2], const float c[2], const float d[2]);
 
 int isect_point_tri_v2(const float v1[2], const float v2[2], const float v3[2], const float pt[2]);
+int isect_point_tri_v2_cw(const float pt[2], const float v1[2], const float v2[2], const float v3[2]);
 int isect_point_tri_v2_int(const int x1, const int y1, const int x2, const int y2, const int a, const int b);
 int isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3]);
 

Modified: branches/soc-2011-tomato/source/blender/blenlib/intern/math_geom.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenlib/intern/math_geom.c	2012-07-16 08:42:55 UTC (rev 48953)
+++ branches/soc-2011-tomato/source/blender/blenlib/intern/math_geom.c	2012-07-16 08:48:06 UTC (rev 48954)
@@ -317,6 +317,21 @@
 	return ISECT_LINE_LINE_NONE;
 }
 
+/* intersect Line-Line, floats - gives intersection point */
+int isect_line_line_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2])
+{
+	float div;
+
+	div = (v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]);
+	if (div == 0.0f) return ISECT_LINE_LINE_COLINEAR;
+
+	vi[0] = ((v3[0] - v4[0]) * (v1[0] * v2[1] - v1[1] * v2[0]) - (v1[0] - v2[0]) * (v3[0] * v4[1] - v3[1] * v4[0])) / div;
+	vi[1] = ((v3[1] - v4[1]) * (v1[0] * v2[1] - v1[1] * v2[0]) - (v1[1] - v2[1]) * (v3[0] * v4[1] - v3[1] * v4[0])) / div;
+
+	return ISECT_LINE_LINE_CROSS;
+}
+
+
 /* intersect Line-Line, floats */
 int isect_line_line_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
 {
@@ -591,6 +606,20 @@
 
 /* point in tri */
 
+/* only single direction */
+int isect_point_tri_v2_cw(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
+{
+	if (line_point_side_v2(v1, v2, pt) >= 0.0f) {
+		if (line_point_side_v2(v2, v3, pt) >= 0.0f) {
+			if (line_point_side_v2(v3, v1, pt) >= 0.0f) {
+				return 1;
+			}
+		}
+	}
+
+	return 0;
+}
+
 int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
 {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list