finish moving bevel code out of the operator dir (it works again)

This commit is contained in:
Campbell Barton
2012-11-18 08:35:27 +00:00
parent 9a74fb5b05
commit 4401ac8c9e
9 changed files with 103 additions and 18 deletions

View File

@@ -105,6 +105,8 @@ set(SRC
intern/bmesh_error.h
tools/BME_bevel.c
tools/bmesh_bevel.c
tools/bmesh_bevel.h
tools/bmesh_decimate_collapse.c
tools/bmesh_decimate_dissolve.c
tools/bmesh_decimate_unsubdivide.c

View File

@@ -267,6 +267,7 @@ extern "C" {
#include "intern/bmesh_inline.h"
#include "tools/bmesh_decimate.h"
#include "tools/bmesh_bevel.h"
#ifdef __cplusplus
}

View File

@@ -0,0 +1,51 @@
/*
* ***** 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):
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/bmesh/operators/bmesh_bevel.c
* \ingroup bmesh
*/
#include "BLI_utildefines.h"
#include "bmesh.h"
#include "intern/bmesh_operators_private.h" /* own include */
void bmo_bevel_exec(BMesh *bm, BMOperator *op)
{
BMOIter siter;
BMVert *v;
const float offset = BMO_slot_float_get(op, "offset");
const int seg = BMO_slot_int_get(op, "segments");
if (offset > 0) {
/* first flush 'geom' into flags, this makes it possible to check connected data */
BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE, BM_ELEM_TAG, FALSE);
BMO_ITER (v, &siter, bm, op, "geom", BM_VERT | BM_EDGE) {
BM_elem_flag_enable(v, BM_ELEM_TAG);
}
BM_mesh_bevel(bm, offset, seg);
}
}

View File

@@ -15,12 +15,16 @@
* 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, Aleksandr Mokhov, Howard Trickey
* Contributor(s):
* Joseph Eagar,
* Aleksandr Mokhov,
* Howard Trickey,
* Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/bmesh/operators/bmo_bevel.c
/** \file blender/bmesh/tools/bmesh_bevel.c
* \ingroup bmesh
*/
@@ -34,7 +38,7 @@
#include "bmesh.h"
#include "intern/bmesh_operators_private.h" /* own include */
/* experemental - Campbell */
// #define USE_ALTERNATE_ADJ
@@ -1661,16 +1665,18 @@ static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme)
}
}
void bmo_bevel_exec(BMesh *bm, BMOperator *op)
/**
* currently only bevels BM_ELEM_TAG'd verts and edges
*/
void BM_mesh_bevel(BMesh *bm, const float offset, const float segments)
{
BMIter iter;
BMOIter siter;
BMVert *v;
BMEdge *e;
BevelParams bp = {NULL};
bp.offset = BMO_slot_float_get(op, "offset");
bp.seg = BMO_slot_int_get(op, "segments");
bp.offset = offset;
bp.seg = segments;
if (bp.offset > 0) {
/* primary alloc */
@@ -1678,13 +1684,6 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
bp.mem_arena = BLI_memarena_new((1 << 16), __func__);
BLI_memarena_use_calloc(bp.mem_arena);
/* first flush 'geom' into flags, this makes it possible to check connected data */
BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE, BM_ELEM_TAG, FALSE);
BMO_ITER (v, &siter, bm, op, "geom", BM_VERT | BM_EDGE) {
BM_elem_flag_enable(v, BM_ELEM_TAG);
}
/* The analysis of the input vertices and execution additional constructions */
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {

View File

@@ -0,0 +1,32 @@
/*
* ***** 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):
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_BEVEL_H__
#define __BMESH_BEVEL_H__
/** \file blender/bmesh/tools/bmesh_bevel.h
* \ingroup bmesh
*/
void BM_mesh_bevel(BMesh *bm, const float offset, const float segments);
#endif /* __BMESH_BEVEL_H__ */

View File

@@ -23,7 +23,7 @@
#ifndef __BMESH_DECIMATE_H__
#define __BMESH_DECIMATE_H__
/** \file blender/bmesh/intern/bmesh_decimate.h
/** \file blender/bmesh/tools/bmesh_decimate.h
* \ingroup bmesh
*/

View File

@@ -20,7 +20,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/bmesh/intern/bmesh_decimate_collapse.c
/** \file blender/bmesh/tools/bmesh_decimate_collapse.c
* \ingroup bmesh
*
* BMesh decimator that uses an edge collapse method.

View File

@@ -20,7 +20,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/bmesh/intern/bmesh_decimate_dissolve.c
/** \file blender/bmesh/tools/bmesh_decimate_dissolve.c
* \ingroup bmesh
*
* BMesh decimator that dissolves flat areas into polygons (ngons).

View File

@@ -20,7 +20,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/bmesh/intern/bmesh_decimate_unsubdivide.c
/** \file blender/bmesh/tools/bmesh_decimate_unsubdivide.c
* \ingroup bmesh
*
* BMesh decimator that uses a grid un-subdivide method.