[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20256] branches/bmesh/blender/source/ blender: selection now works.

Joseph Eagar joeedh at gmail.com
Mon May 18 12:29:37 CEST 2009


Revision: 20256
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20256
Author:   joeedh
Date:     2009-05-18 12:29:37 +0200 (Mon, 18 May 2009)

Log Message:
-----------
selection now works.  next up, undo, and also need to track down an odd bug with face selection and the subdivide tool, which may be related to the bmesh derivedmesh not being refreshed often enough.  also committing a start on a set of docs, which are in mediawiki format.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/bmesh.h
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
    branches/bmesh/blender/source/blender/editors/include/ED_mesh.h
    branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c
    branches/bmesh/blender/source/blender/editors/mesh/bmeshutils_mods.c
    branches/bmesh/blender/source/blender/editors/mesh/editmesh_mods.c
    branches/bmesh/blender/source/blender/editors/mesh/editmesh_tools.c
    branches/bmesh/blender/source/blender/editors/mesh/meshtools.c
    branches/bmesh/blender/source/blender/editors/space_view3d/drawobject.c
    branches/bmesh/blender/source/blender/editors/space_view3d/view3d_header.c
    branches/bmesh/blender/source/blender/editors/space_view3d/view3d_select.c

Added Paths:
-----------
    branches/bmesh/blender/source/blender/bmesh/docs/
    branches/bmesh/blender/source/blender/bmesh/docs/bmesh_design.mwiki
    branches/bmesh/blender/source/blender/bmesh/docs/bmesh_iterators.mwiki
    branches/bmesh/blender/source/blender/bmesh/docs/bmesh_ops.mwiki
    branches/bmesh/blender/source/blender/bmesh/docs/bmesh_tutorial.mwiki
    branches/bmesh/blender/source/blender/bmesh/docs/bmesh_walkers.mwiki
    branches/bmesh/blender/source/blender/bmesh/docs/readme.txt
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh.h	2009-05-18 10:27:09 UTC (rev 20255)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh.h	2009-05-18 10:29:37 UTC (rev 20256)
@@ -300,6 +300,7 @@
 
 /*computes the centroid of a face, using the center of the bounding box*/
 int BM_Compute_Face_Center(BMesh *bm, BMFace *f, float center[3]);
+void BM_SelectMode_Flush(BMesh *bm);
 
 /*convert an editmesh to a bmesh*/
 BMesh *editmesh_to_bmesh(struct EditMesh *em);

Added: branches/bmesh/blender/source/blender/bmesh/docs/bmesh_design.mwiki
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/docs/bmesh_design.mwiki	                        (rev 0)
+++ branches/bmesh/blender/source/blender/bmesh/docs/bmesh_design.mwiki	2009-05-18 10:29:37 UTC (rev 20256)
@@ -0,0 +1,94 @@
+{{Note|Note|Don't edit this page, instead edit the version in the bmesh branch, in source/blender/bmesh/docs/bmesh_design.mwiki (obviously you must be a committer involved in the bmesh project for this).  The idea is that having the documentation inside the repository, will remind us devs to update it more often.}} 
+
+= Introduction  =
+
+BMesh is a non-manifold, locally-modifiable boundary representation. It was designed to replace the current, limited EditMesh structure, solving many of the design limitations and maintainance issues of EditMesh. 
+
+== The Structure  ==
+
+BMesh stores topology in four main structures: 
+
+*Faces 
+*Loops (stores per-face-vertex data) 
+*Edges 
+*Verts
+
+=== Faces  ===
+
+Faces in BMesh are stored as a circular linked list of loops. loops store per-face-vertex data (amongst other things outlined later in this document), and define the face boundary. 
+
+=== The Loop  ===
+
+Loops define the boundary loop of a face. Each loop logically corrusponds to an edge, which is defined by the loop and succeeding loop's vertices. 
+
+Loops store several handy pointers: 
+
+*v - pointer to the vertex associated with this loop 
+*e - pointer to the edge associated with this loop 
+*f - pointer to the face associated with this loop
+
+=== 2-Sided Faces  ===
+
+There are some situations where you need 2-sided faces (e.g. a face of two vertices). This is supported by BMesh, but note that such faces should only be used as intermediary steps, and should not end up in the final mesh. 
+
+=== Edges and Vertices  ===
+
+Edges and Vertices in BMesh are much like their counterparts in EditMesh, except for some members private to the BMesh api. 
+
+=== Queries  ===
+
+The following topological queries are available: 
+
+*Edges/Faces/Loops around a vertex. 
+*Faces around an edge. 
+*The loops that corruspond to an edge.
+
+These are accessible through the iterator api, which is covered later in this document 
+
+== The BMesh API  ==
+
+One of the goals of the BMesh API is to make it easier and natural to produce highly maintainable code. Code duplication, etc are avoided where possibe. 
+
+=== Iterator API  ===
+
+Most topological queries in BMesh go through an iterator API (see Queries above). These are defined in bmesh_iterators.h. 
+
+=== Walker API  ===
+
+Topological queries that require a stack (e.g. recursive queries) go through the Walker API, which is defined in bmesh_walkers.h. Currently the "walkers" are hard-coded into the API, though a mechanism for plugging in new walkers may be added at some point. 
+
+All topological queries should go through these two APIs, except the following pointers: 
+
+*Vert->[v/e/f] 
+*Edge->[v1,v2] 
+*Loop->[v/e/f]
+
+=== Operators  ===
+
+Operators are an integrat part of BMesh. Unlike normal blender operators, BMesh operators can be nested (e.g. call other operators). 
+
+Each operator has a number of input/output "slots" which are used to pass data into/out of the operator (and allows for chaining operators together). 
+
+==== Tool Flags  ====
+
+The BMesh API provides a set of flags for faces, edges and vertices, which are private to an operator. These flags may be used by the client operator code as needed (a common example is flagging elements for use in another operator). 
+
+==== Slot Types  ====
+
+The following slot types are available: 
+
+*Integer 
+*Float 
+*Pointer - do not store arrays corrusponding to elements with this 
+*Element Buffer - a list of verts/edges/faces 
+*Map - simple hash map
+
+==== Slot Iterators  ====
+
+Access to element buffers or maps must go through the slot iterator api, defined in bmesh_operators.h. 
+
+==== Element Buffers  ====
+
+The element buffer slot type is used to feed elements (verts/edges/faces) to operators. Internally they are stored as pointer arrays (which happily has not caused any problems so far). Many operators take in a buffer of elements, process it, then spit out a new one; this allows operators to be chained together. 
+
+{{Note|Note|Element buffers may have elements of different types within the same buffer (this is supported by the API}}\
\ No newline at end of file

Added: branches/bmesh/blender/source/blender/bmesh/docs/bmesh_iterators.mwiki
===================================================================

Added: branches/bmesh/blender/source/blender/bmesh/docs/bmesh_ops.mwiki
===================================================================

Added: branches/bmesh/blender/source/blender/bmesh/docs/bmesh_tutorial.mwiki
===================================================================

Added: branches/bmesh/blender/source/blender/bmesh/docs/bmesh_walkers.mwiki
===================================================================

Added: branches/bmesh/blender/source/blender/bmesh/docs/readme.txt
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/docs/readme.txt	                        (rev 0)
+++ branches/bmesh/blender/source/blender/bmesh/docs/readme.txt	2009-05-18 10:29:37 UTC (rev 20256)
@@ -0,0 +1,2 @@
+This directory is for high-level design documents and tutorials;
+all API reference should be embedded within the C source files.
\ No newline at end of file

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c	2009-05-18 10:27:09 UTC (rev 20255)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c	2009-05-18 10:29:37 UTC (rev 20256)
@@ -27,7 +27,7 @@
  *
 */
 
-void bmesh_selectmode_flush(BMesh *bm)
+void BM_SelectMode_Flush(BMesh *bm)
 {
 	BMEdge *e;
 	BMLoop *l;
@@ -178,7 +178,7 @@
 			BM_Select_Edge(bm, e, 0);
 		for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm ); f; f= BMIter_Step(&faces))
 			bmesh_clear_sysflag(&(f->head), 0);
-		bmesh_selectmode_flush(bm);
+		BM_SelectMode_Flush(bm);
 	}
 	else if(bm->selectmode & BM_EDGE){
 		for(v= BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm ); v; v= BMIter_Step(&verts))
@@ -187,7 +187,7 @@
 			if(bmesh_test_sysflag(&(e->head), BM_SELECT))
 				BM_Select_Edge(bm, e, 1);
 		}
-		bmesh_selectmode_flush(bm);
+		BM_SelectMode_Flush(bm);
 	}
 	else if(bm->selectmode & BM_FACE){
 		for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm ); e; e= BMIter_Step(&edges))

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c	2009-05-18 10:27:09 UTC (rev 20255)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c	2009-05-18 10:29:37 UTC (rev 20256)
@@ -273,5 +273,5 @@
 
 	/*compute normals, clear temp flags and flush selections*/
 	BM_Compute_Normals(bm);
-	bmesh_selectmode_flush(bm);
+	BM_SelectMode_Flush(bm);
 }

Modified: branches/bmesh/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- branches/bmesh/blender/source/blender/editors/include/ED_mesh.h	2009-05-18 10:27:09 UTC (rev 20255)
+++ branches/bmesh/blender/source/blender/editors/include/ED_mesh.h	2009-05-18 10:29:37 UTC (rev 20256)
@@ -90,7 +90,15 @@
 int EDBM_get_actSelection(struct BMEditMesh *em, struct BMEditSelection *ese);
 void EDBM_editselection_center(struct BMEditMesh *em, float *center, struct BMEditSelection *ese);
 void EDBM_editselection_plane(struct BMEditMesh *em, float *plane, struct BMEditSelection *ese);
+void EDBM_selectmode_set(struct BMEditMesh *em);
+void EDBM_convertsel(struct BMEditMesh *em, short oldmode, short selectmode);
 
+int			EDBM_check_backbuf(unsigned int index);
+int			EDBM_mask_init_backbuf_border(struct ViewContext *vc, short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax);
+void		EDBM_free_backbuf(void);
+int			EDBM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
+int			EDBM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads);
+
 /* meshtools.c */
 
 intptr_t	mesh_octree_table(struct Object *ob, struct BMEditMesh *em, float *co, char mode);
@@ -156,7 +164,7 @@
 void              EM_free_uv_vert_map(struct UvVertMap *vmap);
 
 /* editmesh_mods.c */
-extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs;
+extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
 
 void		mouse_mesh(struct bContext *C, short mval[2], short extend);
 int			EM_check_backbuf(unsigned int index);

Added: branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c	                        (rev 0)
+++ branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c	2009-05-18 10:29:37 UTC (rev 20256)
@@ -0,0 +1,274 @@
+ /* $Id: bmesh_tools.c
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list