diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-18 12:35:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-18 12:35:27 +0400 |
commit | 4401ac8c9e312a81bf1a750f0a7068e24174a7fd (patch) | |
tree | 82d55c6d93ae3b7081b6a663319ff3b131815ce2 | |
parent | 9a74fb5b05476eacdaf1a2d8c8f027c8aae34805 (diff) |
finish moving bevel code out of the operator dir (it works again)
-rw-r--r-- | source/blender/bmesh/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/bmesh/bmesh.h | 1 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_bevel.c | 51 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 27 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.h | 32 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate.h | 2 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate_collapse.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate_dissolve.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c | 2 |
9 files changed, 103 insertions, 18 deletions
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index 75f424010ae..2a23658f5d0 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -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 diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h index 54f55833664..6257aa4bf3e 100644 --- a/source/blender/bmesh/bmesh.h +++ b/source/blender/bmesh/bmesh.h @@ -267,6 +267,7 @@ extern "C" { #include "intern/bmesh_inline.h" #include "tools/bmesh_decimate.h" +#include "tools/bmesh_bevel.h" #ifdef __cplusplus } diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c new file mode 100644 index 00000000000..9de15fb9c9c --- /dev/null +++ b/source/blender/bmesh/operators/bmo_bevel.c @@ -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); + } +} diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 3854bca5d44..fc655d60318 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -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)) { diff --git a/source/blender/bmesh/tools/bmesh_bevel.h b/source/blender/bmesh/tools/bmesh_bevel.h new file mode 100644 index 00000000000..a80e4f3a4a2 --- /dev/null +++ b/source/blender/bmesh/tools/bmesh_bevel.h @@ -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__ */ diff --git a/source/blender/bmesh/tools/bmesh_decimate.h b/source/blender/bmesh/tools/bmesh_decimate.h index 04dc0cfd2ea..4d382d65659 100644 --- a/source/blender/bmesh/tools/bmesh_decimate.h +++ b/source/blender/bmesh/tools/bmesh_decimate.h @@ -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 */ diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index c38b9f54a33..781001508f2 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -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. diff --git a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c index fb78050988d..d2a5c580ae6 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c +++ b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c @@ -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). diff --git a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c index 1ec13010d80..acdab2510a4 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c +++ b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c @@ -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. |