2011-10-24 23:32:24 +00:00
|
|
|
/*
|
2009-03-08 15:02:49 +00:00
|
|
|
* BMesh API.
|
2009-01-07 15:17:58 +00:00
|
|
|
*
|
|
|
|
|
* ***** 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. The Blender
|
|
|
|
|
* Foundation also sells licenses for use in proprietary software under
|
|
|
|
|
* the Blender License. See http://www.blender.org/BL/ for information
|
2010-07-14 22:06:10 +00:00
|
|
|
* about this.
|
2009-01-07 15:17:58 +00:00
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Geoffrey Bantle, Levi Schooley.
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2009-03-08 15:02:49 +00:00
|
|
|
#ifndef BMESH_H
|
|
|
|
|
#define BMESH_H
|
2009-01-07 15:17:58 +00:00
|
|
|
|
2010-07-14 22:06:10 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-01-07 15:17:58 +00:00
|
|
|
#include "DNA_listBase.h"
|
2009-05-18 14:55:34 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2009-07-17 01:43:01 +00:00
|
|
|
#include "DNA_customdata_types.h"
|
|
|
|
|
|
|
|
|
|
#include "BKE_customdata.h"
|
|
|
|
|
|
2011-05-12 01:55:08 +00:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
2009-03-14 02:52:16 +00:00
|
|
|
/*
|
|
|
|
|
short introduction:
|
|
|
|
|
|
2010-07-14 22:06:10 +00:00
|
|
|
the bmesh structure is a boundary representation, supporting non-manifold
|
2009-03-14 02:52:16 +00:00
|
|
|
locally modifiable topology. the API is designed to allow clean, maintainable
|
|
|
|
|
code, that never (or almost never) directly inspects the underlying structure.
|
|
|
|
|
|
|
|
|
|
The API includes iterators, including many useful topological iterators;
|
|
|
|
|
walkers, which walk over a mesh, without the risk of hitting the recursion
|
|
|
|
|
limit; operators, which are logical, reusable mesh modules; topological
|
2010-07-14 22:06:10 +00:00
|
|
|
modification functions (like split face, join faces, etc), which are used for
|
|
|
|
|
topological manipulations; and some (not yet finished) geometric utility
|
2009-03-14 13:16:35 +00:00
|
|
|
functions.
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
some definitions:
|
|
|
|
|
|
|
|
|
|
tool flags: private flags for tools. each operator has it's own private
|
|
|
|
|
tool flag "layer", which it can use to flag elements.
|
|
|
|
|
tool flags are also used by various other parts of the api.
|
|
|
|
|
header flags: stores persistent flags, such as selection state, hide state,
|
|
|
|
|
etc. be careful of touching these.
|
|
|
|
|
*/
|
|
|
|
|
|
2009-01-07 15:17:58 +00:00
|
|
|
/*forward declarations*/
|
2009-07-17 01:43:01 +00:00
|
|
|
struct BMesh;
|
2009-01-07 15:17:58 +00:00
|
|
|
struct BMVert;
|
|
|
|
|
struct BMEdge;
|
|
|
|
|
struct BMFace;
|
|
|
|
|
struct BMLoop;
|
2009-03-14 02:52:16 +00:00
|
|
|
struct BMOperator;
|
2009-06-16 20:08:40 +00:00
|
|
|
struct Mesh;
|
|
|
|
|
struct EditMesh;
|
2009-01-07 15:17:58 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* BMHeader
|
|
|
|
|
*
|
2010-07-14 22:06:10 +00:00
|
|
|
* All mesh elements begin with a BMHeader. This structure
|
2009-01-07 15:17:58 +00:00
|
|
|
* hold several types of data
|
|
|
|
|
*
|
|
|
|
|
* 1: The type of the element (vert, edge, loop or face)
|
2009-07-17 01:36:21 +00:00
|
|
|
* 2: Persistant "header" flags/markings (sharp, seam, select, hidden, ect)
|
|
|
|
|
note that this is different from the "tool" flags.
|
2009-01-07 15:17:58 +00:00
|
|
|
* 3: Unique ID in the bmesh.
|
|
|
|
|
* 4: some elements for internal record keeping.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*BMHeader->type*/
|
|
|
|
|
#define BM_VERT 1
|
|
|
|
|
#define BM_EDGE 2
|
2009-08-18 20:05:08 +00:00
|
|
|
#define BM_LOOP 4
|
|
|
|
|
#define BM_FACE 8
|
|
|
|
|
#define BM_ALL (BM_VERT | BM_EDGE | BM_LOOP | BM_FACE)
|
2009-01-07 15:17:58 +00:00
|
|
|
|
|
|
|
|
/*BMHeader->flag*/
|
|
|
|
|
#define BM_SELECT (1<<0)
|
|
|
|
|
|
|
|
|
|
#define BM_SEAM (1<<1)
|
|
|
|
|
#define BM_FGON (1<<2)
|
|
|
|
|
#define BM_HIDDEN (1<<3)
|
|
|
|
|
#define BM_SHARP (1<<4)
|
|
|
|
|
#define BM_SMOOTH (1<<5)
|
2009-03-09 09:52:32 +00:00
|
|
|
#define BM_ACTIVE (1<<6)
|
2011-11-01 09:48:20 +00:00
|
|
|
#define BM_TMP_TAG (1<<7) /* internal flag, used for ensuring correct normals
|
|
|
|
|
* during multires interpolation, and any other time
|
|
|
|
|
* when temp tagging is handy.
|
|
|
|
|
* always assume dirty & clear before use. */
|
|
|
|
|
|
|
|
|
|
/* #define BM_NONORMCALC (1<<8) */ /* UNUSED */
|
2009-01-07 15:17:58 +00:00
|
|
|
|
2010-07-14 22:06:10 +00:00
|
|
|
#include "bmesh_class.h"
|
2009-01-07 15:17:58 +00:00
|
|
|
|
|
|
|
|
/*stub */
|
2010-07-14 22:06:10 +00:00
|
|
|
void bmesh_error ( void );
|
2009-01-07 15:17:58 +00:00
|
|
|
|
|
|
|
|
/*Mesh Level Ops */
|
2011-03-29 05:48:18 +00:00
|
|
|
|
|
|
|
|
/*ob is needed by multires*/
|
|
|
|
|
struct BMesh *BM_Make_Mesh (struct Object *ob, int allocsize[4] );
|
2010-07-14 22:06:10 +00:00
|
|
|
BMesh *BM_Copy_Mesh ( BMesh *bmold );
|
|
|
|
|
void BM_Free_Mesh ( struct BMesh *bm );
|
2009-05-16 16:18:08 +00:00
|
|
|
|
|
|
|
|
/*frees mesh, but not actual BMesh struct*/
|
2010-07-14 22:06:10 +00:00
|
|
|
void BM_Free_Mesh_Data ( BMesh *bm );
|
|
|
|
|
void BM_Compute_Normals ( struct BMesh *bm );
|
2009-01-07 15:17:58 +00:00
|
|
|
|
|
|
|
|
/*Construction*/
|
2011-09-12 05:01:39 +00:00
|
|
|
struct BMVert *BM_Make_Vert ( struct BMesh *bm, float co[3], const struct BMVert *example );
|
|
|
|
|
struct BMEdge *BM_Make_Edge ( struct BMesh *bm, struct BMVert *v1, struct BMVert *v2, const struct BMEdge *example, int nodouble );
|
|
|
|
|
struct BMFace *BM_Make_Quadtriangle ( struct BMesh *bm, struct BMVert **verts, BMEdge **edges, int len, const struct BMFace *example, int nodouble );
|
2010-07-14 22:06:10 +00:00
|
|
|
|
2011-10-13 04:58:34 +00:00
|
|
|
BMFace *BM_Make_Face(BMesh *bm, BMVert **verts, BMEdge **edges, int len, int nodouble);
|
2009-06-18 01:31:50 +00:00
|
|
|
|
|
|
|
|
/*more easier to use version of BM_Make_Quadtriangle.
|
|
|
|
|
creates edges if necassary.*/
|
2010-07-14 22:06:10 +00:00
|
|
|
BMFace *BM_Make_QuadTri ( BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3,
|
2011-09-12 05:01:39 +00:00
|
|
|
BMVert *v4, const BMFace *example, int nodouble );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*makes an ngon from an unordered list of edges. v1 and v2 must be the verts
|
|
|
|
|
defining edges[0], and define the winding of the new face.*/
|
2010-07-14 22:06:10 +00:00
|
|
|
struct BMFace *BM_Make_Ngon ( struct BMesh *bm, struct BMVert *v1, struct BMVert *v2, struct BMEdge **edges, int len, int nodouble );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
2009-05-16 16:18:08 +00:00
|
|
|
/*stuff for dealing with header flags*/
|
2011-09-12 05:01:39 +00:00
|
|
|
BM_INLINE int BM_TestHFlag(const void *element, const int flag);
|
2009-05-16 16:18:08 +00:00
|
|
|
|
2011-05-12 01:55:08 +00:00
|
|
|
/*stuff for dealing with header flags*/
|
2011-05-13 10:59:30 +00:00
|
|
|
BM_INLINE void BM_SetHFlag(void *element, const int flag);
|
2011-05-12 01:55:08 +00:00
|
|
|
|
|
|
|
|
/*stuff for dealing with header flags*/
|
2011-05-13 10:59:30 +00:00
|
|
|
BM_INLINE void BM_ClearHFlag(void *element, const int flag);
|
2011-05-12 01:55:08 +00:00
|
|
|
|
|
|
|
|
/*stuff for dealing BM_ToggleHFlag header flags*/
|
2011-05-13 10:59:30 +00:00
|
|
|
BM_INLINE void BM_ToggleHFlag(void *element, const int flag);
|
2011-09-09 03:34:48 +00:00
|
|
|
BM_INLINE void BM_MergeHFlag(void *element_a, void *element_b);
|
2011-05-13 10:59:30 +00:00
|
|
|
BM_INLINE void BM_SetIndex(void *element, const int index);
|
|
|
|
|
BM_INLINE int BM_GetIndex(const void *element);
|
2009-03-14 02:52:16 +00:00
|
|
|
|
2009-02-14 11:58:52 +00:00
|
|
|
/*copies loop data from adjacent faces*/
|
2010-07-14 22:06:10 +00:00
|
|
|
void BM_Face_CopyShared ( BMesh *bm, BMFace *f );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*copies attributes, e.g. customdata, header flags, etc, from one element
|
|
|
|
|
to another of the same type.*/
|
2011-09-12 05:01:39 +00:00
|
|
|
void BM_Copy_Attributes ( struct BMesh *source_mesh, struct BMesh *target_mesh, const void *source, void *target );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
2009-01-07 15:17:58 +00:00
|
|
|
/*Modification*/
|
2009-03-14 02:52:16 +00:00
|
|
|
/*join two adjacent faces together along an edge. note that
|
|
|
|
|
the faces must only be joined by on edge. e is the edge you
|
|
|
|
|
wish to dissolve.*/
|
2010-07-14 22:06:10 +00:00
|
|
|
BMFace *BM_Join_TwoFaces(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e);
|
|
|
|
|
|
|
|
|
|
/*generic, flexible join faces function; note that most everything uses
|
|
|
|
|
this, including BM_Join_TwoFaces*/
|
|
|
|
|
BMFace *BM_Join_Faces(BMesh *bm, BMFace **faces, int totface);
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*split a face along two vertices. returns the newly made face, and sets
|
|
|
|
|
the nl member to a loop in the newly created edge.*/
|
2010-07-14 22:06:10 +00:00
|
|
|
struct BMFace *BM_Split_Face ( struct BMesh *bm, struct BMFace *f,
|
|
|
|
|
struct BMVert *v1, struct BMVert *v2,
|
|
|
|
|
struct BMLoop **nl, struct BMEdge *example );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*dissolves a vert shared only by two edges*/
|
2011-09-26 03:37:12 +00:00
|
|
|
BMEdge* BM_Collapse_Vert ( struct BMesh *bm, struct BMEdge *ke, struct BMVert *kv,
|
2010-07-14 22:06:10 +00:00
|
|
|
float fac );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*splits an edge. ne is set to the new edge created.*/
|
2010-07-14 22:06:10 +00:00
|
|
|
struct BMVert *BM_Split_Edge ( struct BMesh *bm, struct BMVert *v,
|
|
|
|
|
struct BMEdge *e, struct BMEdge **ne,
|
|
|
|
|
float percent );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*split an edge multiple times evenly*/
|
2010-07-14 22:06:10 +00:00
|
|
|
struct BMVert *BM_Split_Edge_Multi ( struct BMesh *bm, struct BMEdge *e,
|
|
|
|
|
int numcuts );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*connect two verts together, through a face they share. this function may
|
|
|
|
|
be removed in the future.*/
|
2010-07-14 22:06:10 +00:00
|
|
|
BMEdge *BM_Connect_Verts ( BMesh *bm, BMVert *v1, BMVert *v2, BMFace **nf );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
2009-07-26 14:58:31 +00:00
|
|
|
/*rotates an edge topologically, either clockwise (if ccw=0) or counterclockwise
|
|
|
|
|
(if ccw is 1).*/
|
2010-07-14 22:06:10 +00:00
|
|
|
BMEdge *BM_Rotate_Edge ( BMesh *bm, BMEdge *e, int ccw );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
2011-10-12 06:11:21 +00:00
|
|
|
/* Rip a single face from a vertex fan */
|
|
|
|
|
BMVert *BM_Rip_Vertex ( BMesh *bm, BMFace *sf, BMVert *sv);
|
|
|
|
|
|
2009-03-14 02:52:16 +00:00
|
|
|
/*updates a face normal*/
|
2010-07-14 22:06:10 +00:00
|
|
|
void BM_Face_UpdateNormal ( BMesh *bm, BMFace *f );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*updates face and vertex normals incident on an edge*/
|
2010-07-14 22:06:10 +00:00
|
|
|
void BM_Edge_UpdateNormals ( BMesh *bm, BMEdge *e );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*update a vert normal (but not the faces incident on it)*/
|
2010-07-14 22:06:10 +00:00
|
|
|
void BM_Vert_UpdateNormal ( BMesh *bm, BMVert *v );
|
2011-03-28 00:29:45 +00:00
|
|
|
void BM_Vert_UpdateAllNormals ( BMesh *bm, BMVert *v );
|
2009-03-01 06:23:22 +00:00
|
|
|
|
2010-07-14 22:06:10 +00:00
|
|
|
void BM_flip_normal ( BMesh *bm, BMFace *f );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*dissolves all faces around a vert, and removes it.*/
|
2010-07-14 22:06:10 +00:00
|
|
|
int BM_Dissolve_Disk ( BMesh *bm, BMVert *v );
|
2009-03-01 06:23:22 +00:00
|
|
|
|
2009-03-14 02:52:16 +00:00
|
|
|
/*dissolves vert, in more situations then BM_Dissolve_Disk
|
|
|
|
|
(e.g. if the vert is part of a wire edge, etc).*/
|
2010-07-14 22:06:10 +00:00
|
|
|
int BM_Dissolve_Vert ( BMesh *bm, BMVert *v );
|
2009-01-07 15:17:58 +00:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
/*Projects co onto face f, and returns true if it is inside
|
|
|
|
|
the face bounds. Note that this uses a best-axis projection
|
|
|
|
|
test, instead of projecting co directly into f's orientation
|
|
|
|
|
space, so there might be accuracy issues.*/
|
|
|
|
|
int BM_Point_In_Face(BMesh *bm, BMFace *f, float co[3]);
|
2009-03-14 02:52:16 +00:00
|
|
|
|
2009-01-07 15:17:58 +00:00
|
|
|
/*Interpolation*/
|
2011-03-17 22:59:54 +00:00
|
|
|
|
|
|
|
|
/*projects target onto source for customdata interpolation. note: only
|
2011-03-27 03:06:21 +00:00
|
|
|
does loop customdata. multires is handled. */
|
2011-03-17 22:59:54 +00:00
|
|
|
void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source);
|
|
|
|
|
|
2011-03-27 03:06:21 +00:00
|
|
|
/*projects a single loop, target, onto source for customdata interpolation. multires is handled.
|
|
|
|
|
if do_vertex is true, target's vert data will also get interpolated.*/
|
2011-04-13 21:48:16 +00:00
|
|
|
void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
|
|
|
|
|
int do_vertex, int do_multires);
|
2011-03-27 03:06:21 +00:00
|
|
|
|
2011-03-27 02:56:41 +00:00
|
|
|
/*smoothes boundaries between multires grids, including some borders in adjacent faces*/
|
|
|
|
|
void BM_multires_smooth_bounds(BMesh *bm, BMFace *f);
|
2011-03-17 22:59:54 +00:00
|
|
|
|
2011-03-27 02:56:41 +00:00
|
|
|
/*project the multires grid in target onto source's set of multires grids*/
|
|
|
|
|
void BM_loop_interp_multires(BMesh *bm, BMLoop *target, BMFace *source);
|
2011-03-27 03:06:21 +00:00
|
|
|
void BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source);
|
|
|
|
|
|
2011-10-26 07:41:56 +00:00
|
|
|
void BM_Data_Interp_From_Verts (struct BMesh *bm, struct BMVert *v1, struct BMVert *v2, struct BMVert *v, float fac);
|
|
|
|
|
void BM_Data_Facevert_Edgeinterp (struct BMesh *bm, struct BMVert *v1, struct BMVert *v2, struct BMVert *v, struct BMEdge *e1, float fac);
|
|
|
|
|
void BM_add_data_layer (BMesh *em, CustomData *data, int type);
|
|
|
|
|
void BM_add_data_layer_named (BMesh *bm, CustomData *data, int type, const char *name);
|
2011-03-28 00:29:45 +00:00
|
|
|
void BM_free_data_layer (BMesh *em, CustomData *data, int type );
|
|
|
|
|
void BM_free_data_layer_n(BMesh *bm, CustomData *data, int type, int n);
|
2010-07-14 22:06:10 +00:00
|
|
|
float BM_GetCDf(struct CustomData *cd, void *element, int type);
|
|
|
|
|
void BM_SetCDf(struct CustomData *cd, void *element, int type, float val);
|
2009-07-16 06:27:37 +00:00
|
|
|
|
2009-05-18 08:46:04 +00:00
|
|
|
/*computes the centroid of a face, using the center of the bounding box*/
|
2010-07-14 22:06:10 +00:00
|
|
|
int BM_Compute_Face_Center ( BMesh *bm, BMFace *f, float center[3] );
|
2009-08-18 20:05:08 +00:00
|
|
|
|
2010-07-14 22:06:10 +00:00
|
|
|
void BM_SelectMode_Flush ( BMesh *bm );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*convert an editmesh to a bmesh*/
|
2010-07-14 22:06:10 +00:00
|
|
|
BMesh *editmesh_to_bmesh ( struct EditMesh *em );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*initializes editmesh to bmesh operator, but doesn't execute.
|
|
|
|
|
this is used in situations where you need to get access to the
|
|
|
|
|
conversion operator's editmesh->bmesh mapping slot (e.g. if you
|
|
|
|
|
need to find the bmesh edge that corrusponds to a specific editmesh
|
|
|
|
|
edge).*/
|
2010-07-14 22:06:10 +00:00
|
|
|
BMesh *init_editmesh_to_bmesh ( struct EditMesh *em, struct BMOperator *op );
|
2009-03-14 02:52:16 +00:00
|
|
|
|
|
|
|
|
/*converts a bmesh to an editmesh*/
|
2010-07-14 22:06:10 +00:00
|
|
|
struct EditMesh *bmesh_to_editmesh ( BMesh *bm );
|
2009-01-07 15:17:58 +00:00
|
|
|
|
(NOTE: DO NOT TEST)
Start of planned DerivedMesh refactoring. The mface
interfaces in DerivedMesh have been renamed to reflect
their new status as tesselated face interfaces (rather
then the primary ones, which are now stored in mpolys).
short review: mpolys store "primary" face data, while
mfaces store the tesselated form of the mesh (generally
as triangles). mpolys are defined by mloops, and each
mpoly defines a range of loops it "owns" in the main
mloop array.
I've also added basic read-only face iterators, which
are implemented for CDDM, ccgsubsurf, and the bmeditmesh
derivedmesh. Since faces are now variable-length things,
trying to implement the same interface as mfaces would not
have worked well (especially since faces are stored as
an mpoly + a range of mloops).
I figure first we can evaluate these simple read-only
face iterators, then decide if a) we like using iterators
in DerivedMesh, b) how much of it should use them, and c)
if we want write-capable iterators.
I plan to write official docs on this design after I get
it more stable; I'm committing now because there's a rather
lot of changes, and I might do a merge soon.
2009-06-10 10:06:25 +00:00
|
|
|
/*convert between bmesh and Mesh flags*/
|
2010-07-14 22:06:10 +00:00
|
|
|
int BMFlags_To_MEFlags ( void *element );
|
(NOTE: DO NOT TEST)
Start of planned DerivedMesh refactoring. The mface
interfaces in DerivedMesh have been renamed to reflect
their new status as tesselated face interfaces (rather
then the primary ones, which are now stored in mpolys).
short review: mpolys store "primary" face data, while
mfaces store the tesselated form of the mesh (generally
as triangles). mpolys are defined by mloops, and each
mpoly defines a range of loops it "owns" in the main
mloop array.
I've also added basic read-only face iterators, which
are implemented for CDDM, ccgsubsurf, and the bmeditmesh
derivedmesh. Since faces are now variable-length things,
trying to implement the same interface as mfaces would not
have worked well (especially since faces are stored as
an mpoly + a range of mloops).
I figure first we can evaluate these simple read-only
face iterators, then decide if a) we like using iterators
in DerivedMesh, b) how much of it should use them, and c)
if we want write-capable iterators.
I plan to write official docs on this design after I get
it more stable; I'm committing now because there's a rather
lot of changes, and I might do a merge soon.
2009-06-10 10:06:25 +00:00
|
|
|
|
2009-06-12 14:02:37 +00:00
|
|
|
/*convert between Mesh and bmesh flags
|
|
|
|
|
type must be BM_VERT/BM_EDGE/BM_FACE,
|
|
|
|
|
and represents the type of the element
|
|
|
|
|
parameter (the three defines map to
|
|
|
|
|
MVert, MEdge, and MPoly, respectively).*/
|
2010-07-14 22:06:10 +00:00
|
|
|
int MEFlags_To_BMFlags ( int flag, int type );
|
2009-06-12 14:02:37 +00:00
|
|
|
|
2009-06-16 20:08:40 +00:00
|
|
|
/*convert MLoop*** in a bmface to mtface and mcol in
|
|
|
|
|
an MFace*/
|
2010-07-14 22:06:10 +00:00
|
|
|
void BM_loops_to_corners ( BMesh *bm, struct Mesh *me, int findex,
|
|
|
|
|
BMFace *f, int numTex, int numCol );
|
|
|
|
|
|
|
|
|
|
void BM_Kill_Loop(BMesh *bm, BMLoop *l);
|
|
|
|
|
void BM_Kill_Face(BMesh *bm, BMFace *f);
|
|
|
|
|
void BM_Kill_Edge(BMesh *bm, BMEdge *e);
|
|
|
|
|
void BM_Kill_Vert(BMesh *bm, BMVert *v);
|
|
|
|
|
|
2011-03-27 02:56:41 +00:00
|
|
|
/*kills all edges associated with f, along with any other faces containing
|
|
|
|
|
those edges*/
|
|
|
|
|
void BM_Kill_Face_Edges(BMesh *bm, BMFace *f);
|
|
|
|
|
|
|
|
|
|
/*kills all verts associated with f, along with any other faces containing
|
|
|
|
|
those vertices*/
|
|
|
|
|
void BM_Kill_Face_Verts(BMesh *bm, BMFace *f) ;
|
|
|
|
|
|
2011-04-13 00:35:48 +00:00
|
|
|
/*start/stop edit*/
|
|
|
|
|
void bmesh_begin_edit(struct BMesh *bm, int flag);
|
|
|
|
|
void bmesh_end_edit(struct BMesh *bm, int flag);
|
|
|
|
|
|
|
|
|
|
|
2010-07-14 22:06:10 +00:00
|
|
|
#define bm_firstfaceloop(p) ((BMLoopList*)(p->loops.first))->first
|
2009-06-16 20:08:40 +00:00
|
|
|
|
2009-01-07 15:17:58 +00:00
|
|
|
/*include the rest of the API*/
|
|
|
|
|
#include "bmesh_filters.h"
|
|
|
|
|
#include "bmesh_iterators.h"
|
|
|
|
|
#include "bmesh_marking.h"
|
2009-03-09 10:38:36 +00:00
|
|
|
#include "bmesh_operator_api.h"
|
2009-01-07 15:17:58 +00:00
|
|
|
#include "bmesh_operators.h"
|
2009-03-09 10:38:36 +00:00
|
|
|
#include "bmesh_error.h"
|
2009-01-07 15:17:58 +00:00
|
|
|
#include "bmesh_queries.h"
|
2009-03-08 15:02:49 +00:00
|
|
|
#include "bmesh_walkers.h"
|
2011-05-12 01:55:08 +00:00
|
|
|
#include "intern/bmesh_inline.c"
|
2009-03-08 15:02:49 +00:00
|
|
|
|
2010-07-14 22:06:10 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-03-08 15:02:49 +00:00
|
|
|
#endif /* BMESH_H */
|