[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39620] branches/soc-2011-avocado/blender/ source/blender/bmesh/operators/primitiveops.c: gpencil to bmesh tool : bug analysis and comments added
Dan Walters
dan683 at gmail.com
Mon Aug 22 20:18:14 CEST 2011
Revision: 39620
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39620
Author: dan_w
Date: 2011-08-22 18:18:13 +0000 (Mon, 22 Aug 2011)
Log Message:
-----------
gpencil to bmesh tool : bug analysis and comments added
Modified Paths:
--------------
branches/soc-2011-avocado/blender/source/blender/bmesh/operators/primitiveops.c
Modified: branches/soc-2011-avocado/blender/source/blender/bmesh/operators/primitiveops.c
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/bmesh/operators/primitiveops.c 2011-08-22 18:13:37 UTC (rev 39619)
+++ branches/soc-2011-avocado/blender/source/blender/bmesh/operators/primitiveops.c 2011-08-22 18:18:13 UTC (rev 39620)
@@ -690,18 +690,25 @@
void bmesh_create_mesh_from_splines(BMesh *bm, BMOperator *op)
{
+ // stroke iterators, current and next pointers
bGPDstroke *gps, *gpsn;
+ // stroke iterators for searching, current and next pointers
bGPDstroke *search_gps, *search_gpsn;
+ // various 3d positions used as temporary registers when performing intersection tests
float i_vec0[3], i_vec1[3], i_vec2[3], i_vec3[3], i_vec_intersect[3], intersect_lambda;
+ // bmesh vertex pointers and edge pointer. used when creating verticies and edges.
+ // pointer must be retained in order to set flags, etc
BMVert *bm_vertex = 0;
BMVert *bm_previous = 0;
BMVert *bm_intersect = 0;
BMEdge *bm_edge = 0;
+ // for loop counters
int i, j;
+ // retrieve the grease pencil frame. this is passed as a parameter and points to the root frame
bGPDframe* p_frame = BMO_Get_Pnt(op, "frame");
/* error checking */
@@ -729,6 +736,15 @@
for(j = 0; j < search_gps->totpoints; j++)
{
+ /*
+ in this scope, we are iterating every point in every stroke for every
+ point in every stroke. This allows to compare each stroke segment with
+ every other stroke segment, for intersection testing.
+
+ We are iterating every point, but we are interested only in every line
+ segment. Hence, skip the first point, and test each line with the points
+ j-1 and j.
+ */
if(j != 0)
{
@@ -751,11 +767,11 @@
if(isect_line_line_strict_v3(i_vec0, i_vec1, i_vec2, i_vec3, i_vec_intersect, &intersect_lambda))
{
- // there is an intersection hence we must add an extra vertex and 2 edges rather than just one edge
+ // there is an intersection hence we must add an extra vertex
bm_intersect = BM_Make_Vert(bm, i_vec_intersect, NULL);
BMO_SetFlag(bm, bm_intersect, VERT_MARK);
- // create edge
+ // if there is already a vertex found on this stroke, we can also create edge
if(bm_previous)
{
bm_edge = BM_Make_Edge(bm, bm_intersect, bm_previous, NULL, 0);
@@ -776,6 +792,10 @@
BMO_CallOpf(bm, "removedoubles verts=%fv dist=%f", VERT_MARK, 0.001f);
// fill in faces
+ // this following line has no effect. This must be because in the bmop above, when welding the existing edges
+ // are destroyed and new edges are created with no flags set.
+ // dan_w todo: flag all the edges.
+ // otherwise, edgenet_fill should fill the vertex and edge net with faces.
BMO_CallOpf(bm, "edgenet_fill edges=%fe", VERT_MARK);
BMO_Flag_To_Slot(bm, op, "vertout", VERT_MARK, BM_VERT);
More information about the Bf-blender-cvs
mailing list