32#include "range_tree.h"
113#define logkey_hash BLI_ghashutil_inthash_p_simple
114#define logkey_cmp BLI_ghashutil_intcmp
171 if (cd_vert_mask_offset != -1) {
182 if (cd_vert_mask_offset != -1) {
261 for (i = 0; i < 3; i++, l_iter = l_iter->
next) {
262 e_tri[i] = l_iter->
e;
267 for (i = 0; i < 3; i++) {
313 if (cd_face_sets != -1) {
365 uint id = range_tree_uint_take_any(
log->unused_ids);
371 uint id = range_tree_uint_take_any(
log->unused_ids);
418 range_tree_uint_retake(unused_ids,
id);
424 const uint *a =
static_cast<const uint *
>(a_v);
425 const uint *
b =
static_cast<const uint *
>(b_v);
444 for (i = 0; i < totid; i++) {
461 range_tree_uint_release(
log->unused_ids,
id);
472 log->unused_ids = range_tree_uint_alloc(0,
uint(-1));
509 log->current_entry = entry;
512 log->current_entry =
nullptr;
516 log->entries.first =
log->entries.last = entry;
519 while (entry->
prev) {
521 log->entries.first = entry;
524 while (entry->
next) {
526 log->entries.last = entry;
530 for (entry =
static_cast<BMLogEntry *
>(
log->entries.first); entry; entry = entry->
next) {
547 if (
log->unused_ids) {
548 range_tree_uint_free(
log->unused_ids);
551 if (
log->id_to_elem) {
555 if (
log->elem_to_id) {
562 entry->log =
nullptr;
631 entry =
log->current_entry;
634 for (entry = entry->
next; entry; entry =
next) {
646 log->current_entry = entry;
661 else if (entry->
next) {
697 else if (!entry->
next) {
709 if (
log->current_entry == entry) {
710 log->current_entry = entry->
prev;
722 log->current_entry = entry->
prev;
746 else if (entry->
next) {
755 log->current_entry = entry;
793 uint v_id = range_tree_uint_take_any(
log->unused_ids);
814 uint f_id = range_tree_uint_take_any(
log->unused_ids);
836 range_tree_uint_release(
log->unused_ids, v_id);
864 range_tree_uint_release(
log->unused_ids, f_id);
929 return lv ==
nullptr ? nullptr : lv->
co;
940 return lv ==
nullptr ? nullptr : &lv->
mask;
1008 return log->current_entry;
1013 return log->unused_ids;
1020void bm_log_print(
const BMLog *
log,
const char *description)
1023 const char *current =
" <-- current";
1026 printf(
"%s:\n", description);
1027 printf(
" % 2d: [ initial ]%s\n", 0, (!
log->current_entry) ? current :
"");
1028 for (entry =
log->entries.first, i = 1; entry; entry = entry->
next, i++) {
1029 printf(
" % 2d: [%p]%s\n", i, entry, (entry ==
log->current_entry) ? current :
"");
1037 printf(
"BM { totvert=%d totedge=%d totloop=%d faces_num=%d\n",
1044 printf(
"%s: Warning: empty bmesh\n", __func__);
1048 printf(
"BM { totvert=unknown totedge=unknown totloop=unknown faces_num=unknown\n");
1051 printf(
"v | added: %d, removed: %d, modified: %d\n",
1055 printf(
"f | added: %d, removed: %d, modified: %d\n",
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
#define BLI_assert_msg(a, msg)
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_reinsert(GHash *gh, void *key, void *val, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
#define GHASH_ITER(gh_iter_, ghash_)
GHash * BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_int_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghash_reserve(GHash *gh, unsigned int nentries_reserve)
GHash * BLI_ghash_ptr_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_new_ex(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_remove(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
bool BLI_ghash_ensure_p(GHash *gh, void *key, void ***r_val) ATTR_WARN_UNUSED_RESULT
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void swap_v3_v3(float a[3], float b[3])
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
BLI_mempool * BLI_mempool_create(unsigned int esize, unsigned int elem_num, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
#define POINTER_AS_UINT(i)
#define POINTER_FROM_UINT(i)
Read Guarded memory(de)allocation.
#define BM_ELEM_CD_SET_FLOAT(ele, offset, f)
#define BM_ELEM_CD_GET_FLOAT(ele, offset)
#define BM_ELEM_CD_SET_INT(ele, offset, f)
#define BM_FACE_FIRST_LOOP(p)
void BM_vert_kill(BMesh *bm, BMVert *v)
void BM_face_kill(BMesh *bm, BMFace *f)
BMFace * BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
void BM_edge_kill(BMesh *bm, BMEdge *e)
BMVert * BM_vert_create(BMesh *bm, const float co[3], const BMVert *v_example, const eBMCreateFlag create_flag)
Main function for creating a new vertex.
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
static int uint_compare(const void *a_v, const void *b_v)
static void vert_mask_set(BMVert *v, const float new_mask, const int cd_vert_mask_offset)
static BMLogEntry * bm_log_entry_create()
void BM_log_all_added(BMesh *bm, BMLog *log)
void BM_log_face_added(BMLog *log, BMFace *f)
const float * BM_log_find_original_vert_mask(BMLog *log, BMVert *v)
static void bm_log_face_values_swap(BMLog *log, GHash *faces)
void BM_log_face_removed(BMLog *log, BMFace *f)
RangeTreeUInt * BM_log_unused_ids(BMLog *log)
static void bm_log_assign_ids(BMesh *bm, BMLog *log)
void BM_log_free(BMLog *log)
static void bm_log_faces_unmake(BMesh *bm, BMLog *log, GHash *faces)
static void bm_log_face_id_set(BMLog *log, BMFace *f, uint id)
void BM_log_cleanup_entry(BMLogEntry *entry)
static BMLogFace * bm_log_face_alloc(BMLog *log, BMFace *f)
void BM_log_original_vert_data(BMLog *log, BMVert *v, const float **r_co, const float **r_no)
float BM_log_original_mask(BMLog *log, BMVert *v)
static BMFace * bm_log_face_from_id(BMLog *log, uint id)
static GHash * bm_log_compress_ids_to_indices(uint *ids, uint totid)
BMLogEntry * BM_log_current_entry(BMLog *log)
const float * BM_log_original_vert_co(BMLog *log, BMVert *v)
const float * BM_log_find_original_vert_co(BMLog *log, BMVert *v)
void BM_log_vert_added(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
static BMVert * bm_log_vert_from_id(BMLog *log, uint id)
static void bm_log_verts_restore(BMesh *bm, BMLog *log, GHash *verts)
static float vert_mask_get(BMVert *v, const int cd_vert_mask_offset)
void BM_log_face_modified(BMLog *log, BMFace *f)
const float * BM_log_original_vert_no(BMLog *log, BMVert *v)
void BM_log_redo(BMesh *bm, BMLog *log)
static BMLogVert * bm_log_vert_alloc(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
static void bm_log_faces_restore(BMesh *bm, BMLog *log, GHash *faces)
void BM_log_print_entry(BMesh *bm, BMLogEntry *entry)
static void bm_log_entry_free(BMLogEntry *entry)
static void bm_log_vert_bmvert_copy(BMLogVert *lv, BMVert *v, const int cd_vert_mask_offset)
static uint bm_log_vert_id_get(BMLog *log, BMVert *v)
void BM_log_mesh_elems_reorder(BMesh *bm, BMLog *log)
static uint bm_log_face_id_get(BMLog *log, BMFace *f)
void BM_log_vert_removed(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
void BM_log_vert_before_modified(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
static void bm_log_vert_values_swap(BMesh *bm, BMLog *log, GHash *verts)
void BM_log_entry_drop(BMLogEntry *entry)
static void bm_log_id_ghash_release(BMLog *log, GHash *id_ghash)
BMLog * BM_log_from_existing_entries_create(BMesh *bm, BMLogEntry *entry)
BMLog * BM_log_create(BMesh *bm)
static void bm_log_id_ghash_retake(RangeTreeUInt *unused_ids, GHash *id_ghash)
void BM_log_undo(BMesh *bm, BMLog *log)
int BM_log_length(const BMLog *log)
void BM_log_before_all_removed(BMesh *bm, BMLog *log)
static void bm_log_vert_id_set(BMLog *log, BMVert *v, uint id)
BMLogEntry * BM_log_entry_add(BMLog *log)
static void bm_log_verts_unmake(BMesh *bm, BMLog *log, GHash *verts)
void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const uint *face_idx)
void BM_face_as_array_vert_tri(BMFace *f, BMVert *r_verts[3])
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert * v
local_group_size(16, 16) .push_constant(Type b
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
ccl_device_inline float3 log(float3 v)
ccl_device_inline float4 mask(const int4 mask, const float4 a)
RangeTreeUInt * unused_ids
BMLogEntry * current_entry