Blender  V2.93
bmo_unsubdivide.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
24 #include "BLI_math.h"
25 #include "BLI_utildefines.h"
26 
27 #include "bmesh.h"
28 #include "bmesh_tools.h"
29 
30 #include "intern/bmesh_operators_private.h" /* own include */
31 
32 /* - BMVert.flag & BM_ELEM_TAG: shows we touched this vert
33  * - BMVert.index == -1: shows we will remove this vert
34  */
36 {
37  BMVert *v;
38  BMIter iter;
39 
40  const int iterations = max_ii(1, BMO_slot_int_get(op->slots_in, "iterations"));
41 
42  BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
43  BMVert **vinput_arr = (BMVert **)vinput->data.buf;
44  int v_index;
45 
46  /* tag verts */
47  BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
49  }
50  for (v_index = 0; v_index < vinput->len; v_index++) {
51  v = vinput_arr[v_index];
53  }
54 
55  /* do all the real work here */
56  BM_mesh_decimate_unsubdivide_ex(bm, iterations, true);
57 }
MINLINE int max_ii(int a, int b)
@ BM_ELEM_TAG
Definition: bmesh_class.h:484
void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool tag_only)
#define BM_elem_flag_disable(ele, hflag)
Definition: bmesh_inline.h:29
#define BM_elem_flag_enable(ele, hflag)
Definition: bmesh_inline.h:28
#define BM_ITER_MESH(ele, iter, bm, itype)
@ BM_VERTS_OF_MESH
ATTR_WARN_UNUSED_RESULT BMesh * bm
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
BMOpSlot * BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
BMESH OPSTACK GET SLOT.
ATTR_WARN_UNUSED_RESULT const BMVert * v
void bmo_unsubdivide_exec(BMesh *bm, BMOperator *op)
union BMOpSlot::@139 data
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]