[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59409] trunk/blender/source/blender/bmesh : optiona for bmesh triangle fill operator to take a normal argument

Campbell Barton ideasman42 at gmail.com
Fri Aug 23 12:12:09 CEST 2013


Revision: 59409
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59409
Author:   campbellbarton
Date:     2013-08-23 10:12:09 +0000 (Fri, 23 Aug 2013)
Log Message:
-----------
optiona for bmesh triangle fill operator to take a normal argument

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/intern/bmesh_opdefines.c
    trunk/blender/source/blender/bmesh/operators/bmo_triangulate.c

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_opdefines.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_opdefines.c	2013-08-23 09:46:11 UTC (rev 59408)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_opdefines.c	2013-08-23 10:12:09 UTC (rev 59409)
@@ -1598,6 +1598,7 @@
 	/* slots_in */
 	{{"use_beauty", BMO_OP_SLOT_BOOL},
 	 {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},    /* input edges */
+	 {"normal", BMO_OP_SLOT_VEC},  /* optionally pass the fill normal to use */
 	 {{'\0'}},
 	},
 	/* slots_out */

Modified: trunk/blender/source/blender/bmesh/operators/bmo_triangulate.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_triangulate.c	2013-08-23 09:46:11 UTC (rev 59408)
+++ trunk/blender/source/blender/bmesh/operators/bmo_triangulate.c	2013-08-23 10:12:09 UTC (rev 59409)
@@ -66,8 +66,11 @@
 	ScanFillVert *sf_vert, *sf_vert_1, *sf_vert_2;
 	ScanFillFace *sf_tri;
 	SmallHash hash;
+	float normal[3], *normal_pt;
 
 	BLI_smallhash_init(&hash);
+
+	BMO_slot_vec_get(op->slots_in, "normal", normal);
 	
 	BLI_scanfill_begin(&sf_ctx);
 	
@@ -92,7 +95,15 @@
 		/* sf_edge->tmp.p = e; */ /* UNUSED */
 	}
 	
-	BLI_scanfill_calc(&sf_ctx, BLI_SCANFILL_CALC_HOLES);
+	if (is_zero_v3(normal)) {
+		normal_pt = NULL;
+	}
+	else {
+		normalize_v3(normal);
+		normal_pt = normal;
+	}
+
+	BLI_scanfill_calc_ex(&sf_ctx, BLI_SCANFILL_CALC_HOLES, normal_pt);
 	
 	for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
 		BMFace *f = BM_face_create_quad_tri(bm,




More information about the Bf-blender-cvs mailing list