[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48985] branches/soc-2011-tomato: Merging r48981 through r48984 from trunk into soc-2011-tomato

Sergey Sharybin sergey.vfx at gmail.com
Mon Jul 16 21:24:25 CEST 2012


Revision: 48985
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48985
Author:   nazgul
Date:     2012-07-16 19:24:25 +0000 (Mon, 16 Jul 2012)
Log Message:
-----------
Merging r48981 through r48984 from trunk into soc-2011-tomato

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

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.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-48980
   + /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-48984

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c	2012-07-16 19:23:15 UTC (rev 48984)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c	2012-07-16 19:24:25 UTC (rev 48985)
@@ -446,7 +446,8 @@
 	bucket->tot_segment++;
 }
 
-static void feather_bucket_check_intersect(float (*feather_points)[2], FeatherEdgesBucket *bucket, int cur_a, int cur_b)
+static void feather_bucket_check_intersect(float (*feather_points)[2], int tot_feather_point, FeatherEdgesBucket *bucket,
+                                           int cur_a, int cur_b)
 {
 	int i;
 
@@ -464,30 +465,61 @@
 			continue;
 
 		if (isect_seg_seg_v2(v1, v2, v3, v4)) {
-			int k;
+			int k, len;
 			float p[2];
 
 			isect_seg_seg_v2_point(v1, v2, v3, v4, p);
 
-			for (k = check_b; k <= cur_a; k++) {
-				copy_v2_v2(feather_points[k], p);
+			/* TODO: for now simply choose the shortest loop, could be made smarter in some way */
+			len = cur_a - check_b;
+			if (len < tot_feather_point - len) {
+				for (k = check_b; k <= cur_a; k++) {
+					copy_v2_v2(feather_points[k], p);
+				}
 			}
+			else {
+				if (cur_b < check_a) {
+					/* special case when intersection happens with first segment */
+					for (k = cur_b; k <= check_a; k++) {
+						copy_v2_v2(feather_points[k], p);
+					}
+				}
+				else {
+					for (k = 0; k <= check_a; k++) {
+						copy_v2_v2(feather_points[k], p);
+					}
 
+					for (k = cur_b; k < tot_feather_point; k++) {
+						copy_v2_v2(feather_points[k], p);
+					}
+				}
+			}
+
 			break;
 		}
 	}
 }
 
-static void spline_feather_collapse_inner_loops(float (*feather_points)[2], int tot_feather_point)
+static int feather_bucket_index_from_coord(float co[2], float min[2], float max[2],
+                                           const int buckets_per_side, const float bucket_size)
 {
-#define BUCKET_SIDE_INDEX(co, min, max) ((int) ((co - min) / (max - min + FLT_EPSILON) / bucket_size))
+#define BUCKET_SIDE_INDEX(co, min, max) ((int) ((co - min) / (max - min) / bucket_size))
 
-#define BUCKET_INDEX_DELTA(co, dx, dy) \
-	BUCKET_SIDE_INDEX(co[1] + dy, min[1], max[1]) * buckets_per_side + \
-		BUCKET_SIDE_INDEX(co[0] + dx, min[0], max[0])
+	int x = BUCKET_SIDE_INDEX(co[0], min[0], max[0]);
+	int y = BUCKET_SIDE_INDEX(co[1], min[1], max[1]);
 
-#define BUCKET_INDEX(co) BUCKET_INDEX_DELTA(co, 0, 0)
+	x = MIN2(x, buckets_per_side - 1);
+	y = MIN2(y, buckets_per_side - 1);
 
+	return y * buckets_per_side + x;
+#undef BUCKET_SIDE_INDEX
+}
+
+static void spline_feather_collapse_inner_loops(float (*feather_points)[2], int tot_feather_point)
+{
+#define BUCKET_INDEX(co) \
+	feather_bucket_index_from_coord(co, min, max, buckets_per_side, bucket_size)
+
 	const int buckets_per_side = 10;
 	const int tot_bucket = buckets_per_side * buckets_per_side;
 	const float bucket_size = 1.0f / buckets_per_side;
@@ -532,10 +564,10 @@
 		FeatherEdgesBucket *start_bucket = &buckets[start_bucket_index];
 		FeatherEdgesBucket *end_bucket = &buckets[end_bucket_index];
 
-		feather_bucket_check_intersect(feather_points, start_bucket, cur_a, cur_b);
+		feather_bucket_check_intersect(feather_points, tot_feather_point, start_bucket, cur_a, cur_b);
 
 		if (start_bucket != end_bucket)
-			feather_bucket_check_intersect(feather_points, end_bucket, cur_a, cur_b);
+			feather_bucket_check_intersect(feather_points, tot_feather_point, end_bucket, cur_a, cur_b);
 	}
 
 	/* free buckets */
@@ -547,7 +579,6 @@
 	MEM_freeN(buckets);
 
 #undef BUCKET_INDEX
-#undef BUCKET_SIZE_INDEX
 }
 
 /**


Property changes on: branches/soc-2011-tomato/source/blender/editors/interface/interface.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c: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/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-48980
   + /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c: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/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-48984


Property changes on: branches/soc-2011-tomato/source/blender/editors/space_outliner
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/trunk/blender/source/blender/editors/space_outliner:36831-48980
   + /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/trunk/blender/source/blender/editors/space_outliner:36831-48984




More information about the Bf-blender-cvs mailing list