Blender  V3.3
bmo_unsubdivide.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
10 #include "BLI_math.h"
11 #include "BLI_utildefines.h"
12 
13 #include "bmesh.h"
14 #include "bmesh_tools.h"
15 
16 #include "intern/bmesh_operators_private.h" /* own include */
17 
19 {
20  /* - `BMVert.flag & BM_ELEM_TAG`: Shows we touched this vert.
21  * - `BMVert.index == -1`: Shows we will remove this vert. */
22  BMVert *v;
23  BMIter iter;
24 
25  const int iterations = max_ii(1, BMO_slot_int_get(op->slots_in, "iterations"));
26 
27  BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
28  BMVert **vinput_arr = (BMVert **)vinput->data.buf;
29  int v_index;
30 
31  /* tag verts */
32  BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
34  }
35  for (v_index = 0; v_index < vinput->len; v_index++) {
36  v = vinput_arr[v_index];
38  }
39 
40  /* do all the real work here */
41  BM_mesh_decimate_unsubdivide_ex(bm, iterations, true);
42 }
MINLINE int max_ii(int a, int b)
@ BM_ELEM_TAG
Definition: bmesh_class.h:484
void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, int iterations, bool tag_only)
#define BM_elem_flag_disable(ele, hflag)
Definition: bmesh_inline.h:15
#define BM_elem_flag_enable(ele, hflag)
Definition: bmesh_inline.h:14
#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::@145 data
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]