Blender V5.0
bmesh_mesh_partial_update.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_bit_vector.hh"
#include "BLI_math_base.h"
#include "bmesh.hh"

Go to the source code of this file.

Classes

class  BitSpan
class  BitVector< InlineBufferCapacity, Allocator >
class  MutableBitSpan

Functions

BLI_INLINE bool partial_elem_vert_ensure (BMPartialUpdate *bmpinfo, MutableBitSpan verts_tag, BMVert *v)
BLI_INLINE bool partial_elem_face_ensure (BMPartialUpdate *bmpinfo, MutableBitSpan faces_tag, BMFace *f)
BMPartialUpdateBM_mesh_partial_create_from_verts (BMesh &bm, const BMPartialUpdate_Params &params, const BitSpan verts_mask, const int verts_mask_count)
BMPartialUpdateBM_mesh_partial_create_from_verts_group_single (BMesh &bm, const BMPartialUpdate_Params &params, const BitSpan verts_mask, const int verts_mask_count)
BMPartialUpdateBM_mesh_partial_create_from_verts_group_multi (BMesh &bm, const BMPartialUpdate_Params &params, const Span< int > verts_group, const int verts_group_count)
void BM_mesh_partial_destroy (BMPartialUpdate *bmpinfo)

Detailed Description

Generate data needed for partially updating mesh information. Currently this is used for normals and tessellation.

Transform is the obvious use case where there is no need to update normals or tessellation for geometry which has not been modified.

In the future this could be integrated into GPU updates too.

Kinds of Partial Geometry

All Tagged

Operate on everything that's tagged as well as connected geometry. see: BM_mesh_partial_create_from_verts

Grouped

Operate on everything that is connected to both tagged and un-tagged. see: BM_mesh_partial_create_from_verts_group_single

Reduces computations when transforming isolated regions.

Optionally support multiple groups since axis-mirror (for example) will transform vertices in different directions, as well as keeping centered vertices. see: BM_mesh_partial_create_from_verts_group_multi

Note
Others can be added as needed.

Definition in file bmesh_mesh_partial_update.cc.

Function Documentation

◆ BM_mesh_partial_create_from_verts()

◆ BM_mesh_partial_create_from_verts_group_multi()

BMPartialUpdate * BM_mesh_partial_create_from_verts_group_multi ( BMesh & bm,
const BMPartialUpdate_Params & params,
blender::Span< int > verts_group,
int verts_group_count )
nodiscard

All Connected, operate on all faces that have vertices in the same group.

Reduces computations when transforming isolated regions.

This is a version of BM_mesh_partial_create_from_verts_group_single that handles multiple groups instead of a bitmap mask.

This is needed for example when transform has mirror enabled, since one side needs to have a different group to the other since a face that has vertices attached to both won't have an affine transformation.

Parameters
verts_groupVertex aligned array of groups. Values are used as follows:
  • >0: Each face is grouped with other faces of the same group.
  • 0: Not in a group (don't handle these).
  • -1: Don't use grouping logic (include any face that contains a vertex with this group).
verts_group_countThe number of non-zero values in verts_groups.

Definition at line 242 of file bmesh_mesh_partial_update.cc.

References bm, BM_elem_index_get, BM_elem_index_set, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH_INDEX, BM_vert_find_first_loop(), BM_VERTS_OF_MESH, BMPartialUpdate::faces, i, BMFace::len, BMFace::mat_nr, max_ii(), min_ii(), BMLoop::next, BMPartialUpdate::params, params, partial_elem_face_ensure(), partial_elem_vert_ensure(), BMLoop::prev, Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::bits::BitVector< InlineBufferCapacity, Allocator >::resize(), Vector< T, InlineBufferCapacity, Allocator >::size(), UNLIKELY, BMLoop::v, v, and BMPartialUpdate::verts.

Referenced by blender::ed::transform::mesh_partial_ensure().

◆ BM_mesh_partial_create_from_verts_group_single()

◆ BM_mesh_partial_destroy()

◆ partial_elem_face_ensure()

◆ partial_elem_vert_ensure()