[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50139] branches/soc-2011-tomato: svn merge ^/trunk/blender -r50132:50138

Campbell Barton ideasman42 at gmail.com
Thu Aug 23 08:32:52 CEST 2012


Revision: 50139
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50139
Author:   campbellbarton
Date:     2012-08-23 06:32:51 +0000 (Thu, 23 Aug 2012)
Log Message:
-----------
svn merge ^/trunk/blender -r50132:50138

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

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_interp.c
    branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_interp.h
    branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_opdefines.c
    branches/soc-2011-tomato/source/blender/bmesh/operators/bmo_connect.c
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_InpaintOperation.cpp
    branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_tools.c
    branches/soc-2011-tomato/source/blender/imbuf/intern/dds/CMakeLists.txt
    branches/soc-2011-tomato/source/blender/imbuf/intern/dds/SConscript
    branches/soc-2011-tomato/source/blender/imbuf/intern/dds/dds_api.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-50132
   + /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-50138

Modified: branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_interp.c
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_interp.c	2012-08-23 06:27:12 UTC (rev 50138)
+++ branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_interp.c	2012-08-23 06:32:51 UTC (rev 50139)
@@ -45,47 +45,67 @@
 #include "bmesh.h"
 #include "intern/bmesh_private.h"
 
-/**
- * \brief Data, Interp From Verts
- *
- * Interpolates per-vertex data from two sources to a target.
- */
-void BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, const float fac)
+/* edge and vertex share, currently theres no need to have different logic */
+static void bm_data_interp_from_elem(BMesh *bm, BMElem *ele1, BMElem *ele2, BMElem *ele_dst, const float fac)
 {
-	if (v1->head.data && v2->head.data) {
+	if (ele1->head.data && ele2->head.data) {
 		/* first see if we can avoid interpolation */
 		if (fac <= 0.0f) {
-			if (v1 == v) {
+			if (ele1 == ele_dst) {
 				/* do nothing */
 			}
 			else {
-				CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
-				CustomData_bmesh_copy_data(&bm->vdata, &bm->vdata, v1->head.data, &v->head.data);
+				CustomData_bmesh_free_block(&bm->vdata, &ele_dst->head.data);
+				CustomData_bmesh_copy_data(&bm->vdata, &bm->vdata, ele1->head.data, &ele_dst->head.data);
 			}
 		}
 		else if (fac >= 1.0f) {
-			if (v2 == v) {
+			if (ele2 == ele_dst) {
 				/* do nothing */
 			}
 			else {
-				CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
-				CustomData_bmesh_copy_data(&bm->vdata, &bm->vdata, v2->head.data, &v->head.data);
+				CustomData_bmesh_free_block(&bm->vdata, &ele_dst->head.data);
+				CustomData_bmesh_copy_data(&bm->vdata, &bm->vdata, ele2->head.data, &ele_dst->head.data);
 			}
 		}
 		else {
 			void *src[2];
 			float w[2];
 
-			src[0] = v1->head.data;
-			src[1] = v2->head.data;
+			src[0] = ele1->head.data;
+			src[1] = ele2->head.data;
 			w[0] = 1.0f - fac;
 			w[1] = fac;
-			CustomData_bmesh_interp(&bm->vdata, src, w, NULL, 2, v->head.data);
+			CustomData_bmesh_interp(&bm->vdata, src, w, NULL, 2, ele_dst->head.data);
 		}
 	}
 }
 
 /**
+ * \brief Data, Interp From Verts
+ *
+ * Interpolates per-vertex data from two sources to a target.
+ *
+ * \note This is an exact match to #BM_data_interp_from_edges
+ */
+void BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, const float fac)
+{
+	bm_data_interp_from_elem(bm, (BMElem *)v1, (BMElem *)v2, (BMElem *)v, fac);
+}
+
+/**
+ * \brief Data, Interp From Edges
+ *
+ * Interpolates per-edge data from two sources to a target.
+ *
+ * \note This is an exact match to #BM_data_interp_from_verts
+ */
+void BM_data_interp_from_edges(BMesh *bm, BMEdge *e1, BMEdge *e2, BMEdge *e, const float fac)
+{
+	bm_data_interp_from_elem(bm, (BMElem *)e1, (BMElem *)e2, (BMElem *)e, fac);
+}
+
+/**
  * \brief Data Vert Average
  *
  * Sets all the customdata (e.g. vert, loop) associated with a vert

Modified: branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_interp.h
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_interp.h	2012-08-23 06:27:12 UTC (rev 50138)
+++ branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_interp.h	2012-08-23 06:32:51 UTC (rev 50139)
@@ -31,6 +31,7 @@
 void  BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source);
 
 void  BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, const float fac);
+void  BM_data_interp_from_edges(BMesh *bm, BMEdge *e1, BMEdge *e2, BMEdge *e, const float fac);
 void  BM_data_interp_face_vert_edge(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, BMEdge *e1, const float fac);
 void  BM_data_layer_add(BMesh *em, CustomData *data, int type);
 void  BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name);

Modified: branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_opdefines.c
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_opdefines.c	2012-08-23 06:27:12 UTC (rev 50138)
+++ branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_opdefines.c	2012-08-23 06:32:51 UTC (rev 50139)
@@ -422,6 +422,8 @@
 	"bridge_loops",
 	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
 	 {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */
+	 {BMO_OP_SLOT_BOOL,        "use_merge"},
+	 {BMO_OP_SLOT_FLT,         "merge_factor"},
 	 {0, /* null-terminating sentinel */}},
 	bmo_bridge_loops_exec,
 	0,

Modified: branches/soc-2011-tomato/source/blender/bmesh/operators/bmo_connect.c
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/operators/bmo_connect.c	2012-08-23 06:27:12 UTC (rev 50138)
+++ branches/soc-2011-tomato/source/blender/bmesh/operators/bmo_connect.c	2012-08-23 06:32:51 UTC (rev 50139)
@@ -223,6 +223,10 @@
 	BMEdge *e, *nexte;
 	int c = 0, cl1 = 0, cl2 = 0;
 
+	/* merge-bridge support */
+	const int   use_merge    = BMO_slot_bool_get(op, "use_merge");
+	const float merge_factor = BMO_slot_float_get(op, "merge_factor");
+
 	BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
 
 	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
@@ -423,59 +427,101 @@
 			}
 		}
 		
-		/* Generate the bridge quads */
-		for (i = 0; i < BLI_array_count(ee1) && i < BLI_array_count(ee2); i++) {
-			BMFace *f;
+		/* merge loops of bridge faces */
+		if (use_merge) {
+			/* at the moment these will be the same */
+			const int vert_len = mini(BLI_array_count(vv1), BLI_array_count(vv2));
+			const int edge_len = mini(BLI_array_count(ee1), BLI_array_count(ee2));
 
-			BMLoop *l_1 = NULL;
-			BMLoop *l_2 = NULL;
-			BMLoop *l_1_next = NULL;
-			BMLoop *l_2_next = NULL;
-			BMLoop *l_iter;
-			BMFace *f_example;
+			if (merge_factor <= 0.0f) {
+				/* 2 --> 1 */
+				for (i = 0; i < vert_len; i++) {
+					BM_vert_splice(bm, vv2[i], vv1[i]);
+				}
+				for (i = 0; i < edge_len; i++) {
+					BM_edge_splice(bm, ee2[i], ee1[i]);
+				}
+			}
+			else if (merge_factor >= 1.0f) {
+				/* 1 --> 2 */
+				for (i = 0; i < vert_len; i++) {
+					BM_vert_splice(bm, vv1[i], vv2[i]);
+				}
+				for (i = 0; i < edge_len; i++) {
+					BM_edge_splice(bm, ee1[i], ee2[i]);
+				}
+			}
+			else {
+				/* mid factor, be tricky */
+				/* 1 --> 2 */
+				for (i = 0; i < vert_len; i++) {
+					BM_data_interp_from_verts(bm, vv1[i], vv2[i], vv2[i], merge_factor);
+					interp_v3_v3v3(vv2[i]->co, vv1[i]->co, vv2[i]->co, merge_factor);
+					BM_elem_flag_merge(vv1[i], vv2[i]);
+					BM_vert_splice(bm, vv1[i], vv2[i]);
+				}
+				for (i = 0; i < edge_len; i++) {
+					BM_data_interp_from_edges(bm, ee1[i], ee2[i], ee2[i], merge_factor);
+					BM_elem_flag_merge(ee1[i], ee2[i]);
+					BM_edge_splice(bm, ee1[i], ee2[i]);
+				}
+			}
+		}
+		else {
+			/* Generate the bridge quads */
+			for (i = 0; i < BLI_array_count(ee1) && i < BLI_array_count(ee2); i++) {
+				BMFace *f;
 
-			int i1, i1next, i2, i2next;
+				BMLoop *l_1 = NULL;
+				BMLoop *l_2 = NULL;
+				BMLoop *l_1_next = NULL;
+				BMLoop *l_2_next = NULL;
+				BMLoop *l_iter;
+				BMFace *f_example;
 
-			i1 = clamp_index(i * dir1 + starti, lenv1);
-			i1next = clamp_index((i + 1) * dir1 + starti, lenv1);
-			i2 = i;
-			i2next = clamp_index(i + 1, lenv2);
+				int i1, i1next, i2, i2next;
 
-			if (vv1[i1] == vv1[i1next]) {
-				continue;
-			}
+				i1 = clamp_index(i * dir1 + starti, lenv1);
+				i1next = clamp_index((i + 1) * dir1 + starti, lenv1);
+				i2 = i;
+				i2next = clamp_index(i + 1, lenv2);
 
-			if (wdir < 0) {
-				SWAP(int, i1, i1next);
-				SWAP(int, i2, i2next);
-			}
+				if (vv1[i1] == vv1[i1next]) {
+					continue;
+				}
 
-			/* get loop data - before making the face */
-			bm_vert_loop_pair(bm, vv1[i1], vv2[i2], &l_1, &l_2);
-			bm_vert_loop_pair(bm, vv1[i1next], vv2[i2next], &l_1_next, &l_2_next);
-			/* copy if loop data if its is missing on one ring */
-			if (l_1 && l_1_next == NULL) l_1_next = l_1;
-			if (l_1_next && l_1 == NULL) l_1 = l_1_next;
-			if (l_2 && l_2_next == NULL) l_2_next = l_2;
-			if (l_2_next && l_2 == NULL) l_2 = l_2_next;
-			f_example = l_1 ? l_1->f : (l_2 ? l_2->f : NULL);
+				if (wdir < 0) {
+					SWAP(int, i1, i1next);
+					SWAP(int, i2, i2next);
+				}
 
-			f = BM_face_create_quad_tri(bm,
-			                            vv1[i1],
-			                            vv2[i2],
-			                            vv2[i2next],
-			                            vv1[i1next],
-			                            f_example, TRUE);
-			if (!f || f->len != 4) {
-				fprintf(stderr, "%s: in bridge! (bmesh internal error)\n", __func__);
-			}
-			else {
-				l_iter = BM_FACE_FIRST_LOOP(f);
+				/* get loop data - before making the face */
+				bm_vert_loop_pair(bm, vv1[i1], vv2[i2], &l_1, &l_2);
+				bm_vert_loop_pair(bm, vv1[i1next], vv2[i2next], &l_1_next, &l_2_next);
+				/* copy if loop data if its is missing on one ring */
+				if (l_1 && l_1_next == NULL) l_1_next = l_1;
+				if (l_1_next && l_1 == NULL) l_1 = l_1_next;
+				if (l_2 && l_2_next == NULL) l_2_next = l_2;
+				if (l_2_next && l_2 == NULL) l_2 = l_2_next;
+				f_example = l_1 ? l_1->f : (l_2 ? l_2->f : NULL);
 
-				if (l_1)      BM_elem_attrs_copy(bm, bm, l_1,      l_iter); l_iter = l_iter->next;
-				if (l_2)      BM_elem_attrs_copy(bm, bm, l_2,      l_iter); l_iter = l_iter->next;
-				if (l_2_next) BM_elem_attrs_copy(bm, bm, l_2_next, l_iter); l_iter = l_iter->next;

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list