2
* ***** BEGIN GPL LICENSE BLOCK *****
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
* Contributor(s): Campbell Barton
20
* ***** END GPL LICENSE BLOCK *****
23
/** \file blender/bmesh/operators/bmo_unsubdivide.c
28
#include "BLI_utildefines.h"
32
#include "intern/bmesh_operators_private.h" /* own include */
34
/* - BMVert.flag & BM_ELEM_TAG: shows we touched this vert
35
* - BMVert.index == -1: shows we will remove this vert
37
void bmo_unsubdivide_exec(BMesh *bm, BMOperator *op)
42
const int iterations = max_ii(1, BMO_slot_int_get(op->slots_in, "iterations"));
44
BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
45
BMVert **vinput_arr = (BMVert **)vinput->data.buf;
49
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
50
BM_elem_flag_disable(v, BM_ELEM_TAG);
52
for (v_index = 0; v_index < vinput->len; v_index++) {
53
v = vinput_arr[v_index];
54
BM_elem_flag_enable(v, BM_ELEM_TAG);
57
/* do all the real work here */
58
BM_mesh_decimate_unsubdivide_ex(bm, iterations, true);