[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59745] branches/soc-2013-depsgraph_mt: Merging r59735 through r59744 from trunk into soc-2013-depsgraph_mt

Sergey Sharybin sergey.vfx at gmail.com
Mon Sep 2 19:28:00 CEST 2013


Revision: 59745
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59745
Author:   nazgul
Date:     2013-09-02 17:28:00 +0000 (Mon, 02 Sep 2013)
Log Message:
-----------
Merging r59735 through r59744 from trunk into soc-2013-depsgraph_mt

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

Modified Paths:
--------------
    branches/soc-2013-depsgraph_mt/intern/cycles/kernel/kernel_types.h
    branches/soc-2013-depsgraph_mt/release/scripts/startup/bl_ui/space_node.py
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/bpath.c
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/mesh.c
    branches/soc-2013-depsgraph_mt/source/blender/bmesh/intern/bmesh_operators.c
    branches/soc-2013-depsgraph_mt/source/blender/nodes/intern/node_util.c
    branches/soc-2013-depsgraph_mt/source/blender/nodes/shader/node_shader_util.c

Property Changed:
----------------
    branches/soc-2013-depsgraph_mt/
    branches/soc-2013-depsgraph_mt/source/blender/editors/interface/interface.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/space_outliner/


Property changes on: branches/soc-2013-depsgraph_mt
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_dev:58091-58422
/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/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037,48089,48092,48551-48552,48679,48790,48792-48793,49076,49087,49292,49294,49466,49894,50052,50126,52854-52856,54573,58822,58989
/branches/soc-2013-dingto:57424,57487,57507,57525,57599,57670,57918-57919,57981,58091,58245,58253,58587,58772,58774-58775,58828,58835,59032,59214,59220,59251,59601
/tags/blender-2.67b-release/blender:57122
/trunk/blender:57395-59734
   + /branches/ge_dev:58091-58422
/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/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037,48089,48092,48551-48552,48679,48790,48792-48793,49076,49087,49292,49294,49466,49894,50052,50126,52854-52856,54573,58822,58989
/branches/soc-2013-dingto:57424,57487,57507,57525,57599,57670,57918-57919,57981,58091,58245,58253,58587,58772,58774-58775,58828,58835,59032,59214,59220,59251,59601
/tags/blender-2.67b-release/blender:57122
/trunk/blender:57395-59744

Modified: branches/soc-2013-depsgraph_mt/intern/cycles/kernel/kernel_types.h
===================================================================
--- branches/soc-2013-depsgraph_mt/intern/cycles/kernel/kernel_types.h	2013-09-02 17:24:56 UTC (rev 59744)
+++ branches/soc-2013-depsgraph_mt/intern/cycles/kernel/kernel_types.h	2013-09-02 17:28:00 UTC (rev 59745)
@@ -392,10 +392,10 @@
 /* Ray */
 
 typedef struct Ray {
-	float3 P;
-	float3 D;
-	float t;
-	float time;
+	float3 P;		/* origin */
+	float3 D;		/* direction */
+	float t;		/* length of the ray */
+	float time;		/* time (for motion blur) */
 
 #ifdef __RAY_DIFFERENTIALS__
 	differential3 dP;

Modified: branches/soc-2013-depsgraph_mt/release/scripts/startup/bl_ui/space_node.py
===================================================================
--- branches/soc-2013-depsgraph_mt/release/scripts/startup/bl_ui/space_node.py	2013-09-02 17:24:56 UTC (rev 59744)
+++ branches/soc-2013-depsgraph_mt/release/scripts/startup/bl_ui/space_node.py	2013-09-02 17:28:00 UTC (rev 59745)
@@ -65,6 +65,8 @@
                     layout.prop(snode_id, "use_nodes")
 
             if snode.shader_type == 'WORLD':
+                row = layout.row()
+                row.enabled = not snode.pin
                 row.template_ID(scene, "world", new="world.new")
                 if snode_id:
                     row.prop(snode_id, "use_nodes")

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/bpath.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/bpath.c	2013-09-02 17:24:56 UTC (rev 59744)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/bpath.c	2013-09-02 17:28:00 UTC (rev 59745)
@@ -76,7 +76,7 @@
 #include "BKE_node.h"
 #include "BKE_report.h"
 #include "BKE_sequencer.h"
-#include "BKE_image.h" /* so we can check the image's type */
+#include "BKE_image.h"
 
 #include "BKE_bpath.h"  /* own include */
 
@@ -388,6 +388,13 @@
 	}
 }
 
+/* fix the image user "ok" tag after updating paths, so ImBufs get loaded */
+static void bpath_traverse_image_user_cb(Image *ima, ImageUser *iuser, void *customdata)
+{
+	if (ima == customdata)
+		iuser->ok = 1;
+}
+
 /* Run visitor function 'visit' on all paths contained in 'id'. */
 void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
 {
@@ -405,6 +412,8 @@
 			if (ima->packedfile == NULL || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
 				if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
 					rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data);
+					BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
+					BKE_image_walk_all_users(bmain, ima, bpath_traverse_image_user_cb);
 				}
 			}
 			break;

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/mesh.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/mesh.c	2013-09-02 17:24:56 UTC (rev 59744)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/mesh.c	2013-09-02 17:28:00 UTC (rev 59745)
@@ -3312,7 +3312,7 @@
  * Calculate smooth groups from sharp edges.
  *
  * \param r_totgroup The total number of groups, 1 or more.
- * \return Polygon aligned array of group index values (starting at 1)
+ * \return Polygon aligned array of group index values (bitflags, starting at 1).
  */
 int *BKE_mesh_calc_smoothgroups(const MEdge *medge, const int totedge,
                                 const MPoly *mpoly, const int totpoly,
@@ -3321,10 +3321,12 @@
 {
 	int *poly_groups;
 	int *poly_stack;
-	STACK_DECLARE(poly_stack);
 
 	int poly_prev = 0;
-	int poly_group_id = 0;
+	const int temp_poly_group_id = 3;  /* Placeholder value. */
+	const int poly_group_id_overflowed = 5;  /* Group we could not find any available bit, will be reset to 0 at end */
+	int tot_group = 0;
+	bool group_id_overflow = false;
 
 	/* map vars */
 	MeshElemMap *edge_poly_map;
@@ -3343,10 +3345,10 @@
 	poly_groups = MEM_callocN(sizeof(int) * totpoly, __func__);
 	poly_stack  = MEM_mallocN(sizeof(int) * totpoly, __func__);
 
-	STACK_INIT(poly_stack);
-
 	while (true) {
 		int poly;
+		int bit_poly_group_mask = 0;
+		int ps_curr_idx = 0, ps_end_idx = 0;  /* stack indices */
 
 		for (poly = poly_prev; poly < totpoly; poly++) {
 			if (poly_groups[poly] == 0) {
@@ -3362,49 +3364,92 @@
 		/* start searching from here next time */
 		poly_prev = poly + 1;
 
-		/* group starts at 1 */
-		poly_group_id++;
+		poly_groups[poly] = temp_poly_group_id;
+		poly_stack[ps_end_idx++] = poly;
 
-		poly_groups[poly] = poly_group_id;
-		STACK_PUSH(poly_stack, poly);
-
-		while ((poly = STACK_POP_ELSE(poly_stack, -1)) != -1) {
-
-			const MPoly *mp = &mpoly[poly];
+		while (ps_curr_idx != ps_end_idx) {
+			const MPoly *mp;
 			const MLoop *ml;
-			int j = mp->totloop;
+			int j;
 
-			BLI_assert(poly_groups[poly] == poly_group_id);
+			poly = poly_stack[ps_curr_idx++];
+			BLI_assert(poly_groups[poly] == temp_poly_group_id);
 
-			for (ml = &mloop[mp->loopstart]; j--; ml++) {
+			mp = &mpoly[poly];
+			for (ml = &mloop[mp->loopstart], j = mp->totloop; j--; ml++) {
+				/* loop over poly users */
+				const MeshElemMap *map_ele = &edge_poly_map[ml->e];
+				int *p = map_ele->indices;
+				int i = map_ele->count;
 				if (!(medge[ml->e].flag & ME_SHARP)) {
-					/* loop over poly users */
-					const MeshElemMap *map_ele = &edge_poly_map[ml->e];
-					int *p = map_ele->indices;
-					int i = map_ele->count;
-
 					for (; i--; p++) {
 						/* if we meet other non initialized its a bug */
-						BLI_assert(ELEM(poly_groups[*p], 0, poly_group_id));
+						BLI_assert(ELEM(poly_groups[*p], 0, temp_poly_group_id));
 
 						if (poly_groups[*p] == 0) {
-							poly_groups[*p] = poly_group_id;
-							STACK_PUSH(poly_stack, *p);
+							poly_groups[*p] = temp_poly_group_id;
+							poly_stack[ps_end_idx++] = *p;
 						}
 					}
 				}
+				else {
+					/* Find contiguous smooth groups already assigned, these are the values we can't reuse! */
+					for (; i--; p++) {
+						int bit = poly_groups[*p];
+						if (!ELEM3(bit, 0, temp_poly_group_id, poly_group_id_overflowed) &&
+						    !(bit_poly_group_mask & bit))
+						{
+							bit_poly_group_mask |= bit;
+						}
+					}
+				}
 			}
 		}
+		/* And now, we have all our poly from current group in poly_stack (from 0 to (ps_end_idx - 1)), as well as
+		 * all smoothgroups bits we can't use in bit_poly_group_mask.
+		 */
+		{
+			int i, *p, gid_bit = 0, poly_group_id = 1;
+
+			/* Find first bit available! */
+			for (; (poly_group_id & bit_poly_group_mask) && (gid_bit < 32); gid_bit++) {
+				poly_group_id <<= 1;  /* will 'overflow' on last possible iteration. */
+			}
+			if (UNLIKELY(gid_bit > 31)) {
+				/* All bits used in contiguous smooth groups, we can't do much!
+				 * Note: this is *very* unlikely - theoretically, four groups are enough, I don't think we can reach
+				 *       this goal with such a simple algo, but I don't think either we'll never need all 32 groups!
+				 */
+				printf("Warning, could not find an available id for current smooth group, faces will me marked "
+				       "as out of any smooth group...\n");
+				poly_group_id = poly_group_id_overflowed; /* Can't use 0, will have to set them to this value later. */
+				group_id_overflow = true;
+			}
+			if (gid_bit > tot_group) {
+				tot_group = gid_bit;
+			}
+			/* And assign the final smooth group id to that poly group! */
+			for (i = ps_end_idx, p = poly_stack; i--; p++) {
+				poly_groups[*p] = poly_group_id;
+			}
+		}
 	}
 
+	if (UNLIKELY(group_id_overflow)) {
+		int i = totpoly, *gid = poly_groups;
+		for (; i--; gid++) {
+			if (*gid == poly_group_id_overflowed) {
+				*gid = 0;
+			}
+		}
+	}
+
 	MEM_freeN(edge_poly_map);
 	MEM_freeN(edge_poly_mem);
 	MEM_freeN(poly_stack);
 
-	STACK_FREE(poly_stack);
+	*r_totgroup = tot_group + 1;
 
-	*r_totgroup = poly_group_id;
-
 	return poly_groups;
 }
 

Modified: branches/soc-2013-depsgraph_mt/source/blender/bmesh/intern/bmesh_operators.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/bmesh/intern/bmesh_operators.c	2013-09-02 17:24:56 UTC (rev 59744)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list