2012-02-12 15:40:08 +01: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.
|
|
|
|
*
|
|
|
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* Contributor(s): Joseph Eagar.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2013-04-13 22:31:52 +02:00
|
|
|
#ifndef __BKE_EDITMESH_H__
|
|
|
|
#define __BKE_EDITMESH_H__
|
2009-11-29 01:53:23 +01:00
|
|
|
|
2013-09-12 05:02:50 +02:00
|
|
|
/** \file BKE_editmesh.h
|
|
|
|
* \ingroup bke
|
2015-08-01 04:36:14 +02:00
|
|
|
*
|
|
|
|
* The \link edmesh EDBM module\endlink is for editmode bmesh stuff.
|
|
|
|
* In contrast, the this module is for code shared with blenkernel thats
|
|
|
|
* only concerned with low level operations on the #BMEditMesh structure.
|
2013-09-12 05:02:50 +02:00
|
|
|
*/
|
|
|
|
|
2012-04-25 05:44:01 +02:00
|
|
|
#include "BKE_customdata.h"
|
2009-05-16 18:18:08 +02:00
|
|
|
#include "bmesh.h"
|
|
|
|
|
|
|
|
struct BMesh;
|
|
|
|
struct BMLoop;
|
2009-11-02 07:33:16 +01:00
|
|
|
struct Mesh;
|
2013-04-18 03:20:04 +02:00
|
|
|
struct Scene;
|
2013-04-17 11:27:23 +02:00
|
|
|
struct DerivedMesh;
|
|
|
|
struct MeshStatVis;
|
2009-05-16 18:18:08 +02:00
|
|
|
|
2015-08-01 04:36:14 +02:00
|
|
|
/**
|
|
|
|
* This structure is used for mesh edit-mode.
|
2012-03-03 21:19:11 +01:00
|
|
|
*
|
2015-08-01 04:36:14 +02:00
|
|
|
* through this, you get access to both the edit #BMesh,
|
2012-03-03 21:19:11 +01:00
|
|
|
* it's tessellation, and various stuff that doesn't belong in the BMesh
|
|
|
|
* struct itself.
|
|
|
|
*
|
|
|
|
* the entire derivedmesh and modifier system works with this structure,
|
|
|
|
* and not BMesh. Mesh->edit_bmesh stores a pointer to this structure. */
|
2009-05-18 10:46:04 +02:00
|
|
|
typedef struct BMEditMesh {
|
2009-05-16 18:18:08 +02:00
|
|
|
struct BMesh *bm;
|
2009-06-18 09:11:55 +02:00
|
|
|
|
|
|
|
/*this is for undoing failed operations*/
|
|
|
|
struct BMEditMesh *emcopy;
|
2009-09-09 08:28:58 +02:00
|
|
|
int emcopyusers;
|
2009-05-16 18:18:08 +02:00
|
|
|
|
2012-03-03 21:19:11 +01:00
|
|
|
/* we store tessellations as triplets of three loops,
|
|
|
|
* which each define a triangle.*/
|
2009-05-16 18:18:08 +02:00
|
|
|
struct BMLoop *(*looptris)[3];
|
|
|
|
int tottri;
|
|
|
|
|
|
|
|
/*derivedmesh stuff*/
|
|
|
|
struct DerivedMesh *derivedFinal, *derivedCage;
|
2012-04-25 05:44:01 +02:00
|
|
|
CustomDataMask lastDataMask;
|
2013-04-13 22:20:21 +02:00
|
|
|
unsigned char (*derivedVertColor)[4];
|
|
|
|
int derivedVertColorLen;
|
2013-04-17 11:27:23 +02:00
|
|
|
unsigned char (*derivedFaceColor)[4];
|
|
|
|
int derivedFaceColorLen;
|
2009-05-16 18:18:08 +02:00
|
|
|
|
|
|
|
/*selection mode*/
|
2011-05-09 06:06:48 +02:00
|
|
|
short selectmode;
|
|
|
|
short mat_nr;
|
2009-11-02 07:33:16 +01:00
|
|
|
|
2012-09-10 05:42:29 +02:00
|
|
|
/* Object this editmesh came from (if it came from one) */
|
2009-11-02 07:33:16 +01:00
|
|
|
struct Object *ob;
|
2010-03-11 06:30:01 +01:00
|
|
|
|
|
|
|
/*temp variables for x-mirror editing*/
|
2011-10-28 08:23:12 +02:00
|
|
|
int mirror_cdlayer; /* -1 is invalid */
|
2009-05-18 10:46:04 +02:00
|
|
|
} BMEditMesh;
|
|
|
|
|
2013-04-18 03:20:04 +02:00
|
|
|
/* editmesh.c */
|
2013-04-16 07:59:48 +02:00
|
|
|
void BKE_editmesh_tessface_calc(BMEditMesh *em);
|
|
|
|
BMEditMesh *BKE_editmesh_create(BMesh *bm, const bool do_tessellate);
|
|
|
|
BMEditMesh *BKE_editmesh_copy(BMEditMesh *em);
|
|
|
|
BMEditMesh *BKE_editmesh_from_object(struct Object *ob);
|
2014-02-28 10:02:30 +01:00
|
|
|
void BKE_editmesh_free_derivedmesh(BMEditMesh *em);
|
2013-04-16 07:59:48 +02:00
|
|
|
void BKE_editmesh_free(BMEditMesh *em);
|
|
|
|
void BKE_editmesh_update_linked_customdata(BMEditMesh *em);
|
2013-04-18 03:20:04 +02:00
|
|
|
|
2013-04-18 19:09:56 +02:00
|
|
|
void BKE_editmesh_color_free(BMEditMesh *em);
|
|
|
|
void BKE_editmesh_color_ensure(BMEditMesh *em, const char htype);
|
2015-03-28 18:44:05 +01:00
|
|
|
float (*BKE_editmesh_vertexCos_get_orco(BMEditMesh *em, int *r_numVerts))[3];
|
2013-04-18 19:09:56 +02:00
|
|
|
|
2013-04-18 03:20:04 +02:00
|
|
|
/* editderivedmesh.c */
|
|
|
|
/* should really be defined in editmesh.c, but they use 'EditDerivedBMesh' */
|
2013-04-17 11:27:23 +02:00
|
|
|
void BKE_editmesh_statvis_calc(BMEditMesh *em, struct DerivedMesh *dm,
|
2015-03-21 12:10:43 +01:00
|
|
|
const struct MeshStatVis *statvis);
|
2009-11-29 01:53:23 +01:00
|
|
|
|
2013-04-18 03:20:04 +02:00
|
|
|
float (*BKE_editmesh_vertexCos_get(struct BMEditMesh *em, struct Scene *scene, int *r_numVerts))[3];
|
|
|
|
|
2013-04-13 22:31:52 +02:00
|
|
|
#endif /* __BKE_EDITMESH_H__ */
|