[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56261] branches/soc-2011-tomato: Merging r56252 through r56260 from trunk into soc-2011-tomato

Sergey Sharybin sergey.vfx at gmail.com
Wed Apr 24 15:51:20 CEST 2013


Revision: 56261
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56261
Author:   nazgul
Date:     2013-04-24 13:51:19 +0000 (Wed, 24 Apr 2013)
Log Message:
-----------
Merging r56252 through r56260 from trunk into soc-2011-tomato

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

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/freestyle/style_modules/parameter_editor.py
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_data_modifier.py
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_bmesh.h
    branches/soc-2011-tomato/source/blender/blenkernel/intern/bvhutils.c
    branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_mesh.c
    branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_mesh.h
    branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_tools.c
    branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_utils.c
    branches/soc-2011-tomato/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_snap.c
    branches/soc-2011-tomato/source/blender/editors/transform/transform_snap.c
    branches/soc-2011-tomato/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
    branches/soc-2011-tomato/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_modifier.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_object_force.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_bevel.c
    branches/soc-2011-tomato/source/blender/python/bmesh/bmesh_py_types.c
    branches/soc-2011-tomato/source/blender/render/intern/include/render_types.h
    branches/soc-2011-tomato/source/blender/render/intern/source/bake.c
    branches/soc-2011-tomato/source/blender/render/intern/source/pipeline.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-56251
   + /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-56260

Modified: branches/soc-2011-tomato/release/scripts/freestyle/style_modules/parameter_editor.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/freestyle/style_modules/parameter_editor.py	2013-04-24 13:12:29 UTC (rev 56260)
+++ branches/soc-2011-tomato/release/scripts/freestyle/style_modules/parameter_editor.py	2013-04-24 13:51:19 UTC (rev 56261)
@@ -356,9 +356,9 @@
     while not it.is_end:
         material = func(Interface0DIterator(it))
         if material_attribute == 'DIFF':
-            color = material.diffuse[:]
+            color = material.diffuse[0:3]
         elif material_attribute == 'SPEC':
-            color = material.specular[:]
+            color = material.specular[0:3]
         else:
             raise ValueError("unexpected material attribute: " + material_attribute)
         yield it, color
@@ -370,7 +370,7 @@
     while not it.is_end:
         material = func(Interface0DIterator(it))
         if material_attribute == 'DIFF':
-            r, g, b = material.diffuse
+            r, g, b = material.diffuse[0:3]
             t = 0.35 * r + 0.45 * r + 0.2 * b
         elif material_attribute == 'DIFF_R':
             t = material.diffuse[0]
@@ -379,7 +379,7 @@
         elif material_attribute == 'DIFF_B':
             t = material.diffuse[2]
         elif material_attribute == 'SPEC':
-            r, g, b = material.specular
+            r, g, b = material.specular[0:3]
             t = 0.35 * r + 0.45 * r + 0.2 * b
         elif material_attribute == 'SPEC_R':
             t = material.specular[0]

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_data_modifier.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_data_modifier.py	2013-04-24 13:12:29 UTC (rev 56260)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_data_modifier.py	2013-04-24 13:51:19 UTC (rev 56261)
@@ -119,13 +119,13 @@
         layout.prop(md, "end_cap")
 
     def BEVEL(self, layout, ob, md):
+        layout.prop(md, "width")
+        layout.prop(md, "segments")
+
         split = layout.split()
-
-        split.prop(md, "width")
         split.prop(md, "use_only_vertices")
+        split.prop(md, "overlap_ok")
 
-        layout.prop(md, "segments")
-
         layout.label(text="Limit Method:")
         layout.row().prop(md, "limit_method", expand=True)
         if md.limit_method == 'ANGLE':

Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_bmesh.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_bmesh.h	2013-04-24 13:12:29 UTC (rev 56260)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_bmesh.h	2013-04-24 13:51:19 UTC (rev 56261)
@@ -66,6 +66,8 @@
 	                                       * here because they are mixed - campbell */
 #define BME_BEVEL_DIST          (1 << 12) /* same as above */
 
+#define BME_BEVEL_OVERLAP_OK    (1 << 13)
+
 typedef struct BME_TransData {
 	struct BMesh *bm; /* the bmesh the vert belongs to */
 	struct BMVert *v;  /* pointer to the vert this tdata applies to */

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/bvhutils.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/bvhutils.c	2013-04-24 13:12:29 UTC (rev 56260)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/bvhutils.c	2013-04-24 13:51:19 UTC (rev 56261)
@@ -394,7 +394,32 @@
 
 	} while (t2);
 }
+/* copy of function above (warning, should de-duplicate with editmesh_bvh.c) */
+static void editmesh_faces_nearest_point(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
+{
+	const BVHTreeFromMesh *data = (BVHTreeFromMesh *) userdata;
+	BMEditMesh *em = data->em_evil;
+	const BMLoop **ltri = (const BMLoop **)em->looptris[index];
 
+	float *t0, *t1, *t2;
+	t0 = ltri[0]->v->co;
+	t1 = ltri[1]->v->co;
+	t2 = ltri[2]->v->co;
+
+	{
+		float nearest_tmp[3], dist;
+		int vertex, edge;
+
+		dist = nearest_point_in_tri_surface(t0, t1, t2, co, &vertex, &edge, nearest_tmp);
+		if (dist < nearest->dist) {
+			nearest->index = index;
+			nearest->dist = dist;
+			copy_v3_v3(nearest->co, nearest_tmp);
+			normal_tri_v3(nearest->no, t0, t1, t2);
+		}
+	}
+}
+
 /* Callback to bvh tree raycast. The tree must bust have been built using bvhtree_from_mesh_faces.
  * userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. */
 static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
@@ -434,7 +459,36 @@
 
 	} while (t2);
 }
+/* copy of function above (warning, should de-duplicate with editmesh_bvh.c) */
+static void editmesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
+{
+	const BVHTreeFromMesh *data = (BVHTreeFromMesh *) userdata;
+	BMEditMesh *em = data->em_evil;
+	const BMLoop **ltri = (const BMLoop **)em->looptris[index];
 
+	float *t0, *t1, *t2;
+	t0 = ltri[0]->v->co;
+	t1 = ltri[1]->v->co;
+	t2 = ltri[2]->v->co;
+
+
+	{
+		float dist;
+		if (data->sphere_radius == 0.0f)
+			dist = bvhtree_ray_tri_intersection(ray, hit->dist, t0, t1, t2);
+		else
+			dist = sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, t0, t1, t2);
+
+		if (dist >= 0 && dist < hit->dist) {
+			hit->index = index;
+			hit->dist = dist;
+			madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist);
+
+			normal_tri_v3(hit->no, t0, t1, t2);
+		}
+	}
+}
+
 /* Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_edges.
  * userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. */
 static void mesh_edges_nearest_point(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
@@ -521,77 +575,88 @@
 BVHTree *bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis)
 {
 	BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_FACES);
+	BMEditMesh *em = data->em_evil;
 
 	/* Not in cache */
 	if (tree == NULL) {
 		int i;
-		int numFaces = mesh->getNumTessFaces(mesh);
+		int numFaces;
 
 		/* BMESH specific check that we have tessfaces,
 		 * we _could_ tessellate here but rather not - campbell
 		 *
 		 * this assert checks we have tessfaces,
 		 * if not caller should use DM_ensure_tessface() */
-		BLI_assert(!(numFaces == 0 && mesh->getNumPolys(mesh) != 0));
+		if (em) {
+			numFaces = em->tottri;
+		}
+		else {
+			numFaces = mesh->getNumTessFaces(mesh);
+			BLI_assert(!(numFaces == 0 && mesh->getNumPolys(mesh) != 0));
+		}
 
 		if (numFaces != 0) {
 			/* Create a bvh-tree of the given target */
+			// printf("%s: building BVH, total=%d\n", __func__, numFaces);
 			tree = BLI_bvhtree_new(numFaces, epsilon, tree_type, axis);
 			if (tree != NULL) {
-				BMEditMesh *em = data->em_evil;
 				if (em) {
+					const struct BMLoop *(*looptris)[3] = (void *)em->looptris;
+
+					/* avoid double-up on face searches for quads-ngons */
+					bool insert_prev = false;
+					BMFace *f_prev = NULL;
+
 					/* data->em_evil is only set for snapping, and only for the mesh of the object
 					 * which is currently open in edit mode. When set, the bvhtree should not contain
 					 * faces that will interfere with snapping (e.g. faces that are hidden/selected
 					 * or faces that have selected verts).*/
 
-					/* XXX, for snap only, em & dm are assumed to be aligned, since dm is the em's cage */
-
 					/* Insert BMesh-tessellation triangles into the bvh tree, unless they are hidden
 					 * and/or selected. Even if the faces themselves are not selected for the snapped
 					 * transform, having a vertex selected means the face (and thus it's tessellated
 					 * triangles) will be moving and will not be a good snap targets.*/
 					for (i = 0; i < em->tottri; i++) {
-						BMLoop **tri = em->looptris[i];
-						BMFace *f;
-						BMVert *v;
-						BMIter iter;
-						int insert;
+						const BMLoop **ltri = looptris[i];
+						BMFace *f = ltri[0]->f;
+						bool insert;
 
-						/* Each loop of the triangle points back to the BMFace it was tessellated from.
-						 * All three should point to the same face, so just use the face from the first
-						 * loop.*/
-						f = tri[0]->f;
-
-						/* If the looptris is ordered such that all triangles tessellated from a single
-						 * faces are consecutive elements in the array, then we could speed up the tests
-						 * below by using the insert value from the previous iteration.*/
-
-						/*Start with the assumption the triangle should be included for snapping.*/
-						insert = 1;
-
-						if (BM_elem_flag_test(f, BM_ELEM_SELECT) || BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
-							/* Don't insert triangles tessellated from faces that are hidden
-							 * or selected*/
-							insert = 0;
+						/* Start with the assumption the triangle should be included for snapping. */
+						if (f == f_prev) {
+							insert = insert_prev;
 						}
 						else {
-							BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) {
-								if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
-									/* Don't insert triangles tessellated from faces that have
-									 * any selected verts.*/
-									insert = 0;
-								}
+							if (BM_elem_flag_test(f, BM_ELEM_SELECT) || BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+								/* Don't insert triangles tessellated from faces that are hidden
+								 * or selected*/

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list