30 #include "range_tree.h"
111 #define logkey_hash BLI_ghashutil_inthash_p_simple
112 #define logkey_cmp BLI_ghashutil_intcmp
169 if (cd_vert_mask_offset != -1) {
180 if (cd_vert_mask_offset != -1) {
258 for (i = 0; i < 3; i++, l_iter = l_iter->
next) {
259 e_tri[i] = l_iter->
e;
264 for (i = 0; i < 3; i++) {
308 if (cd_face_sets != -1) {
359 uint id = range_tree_uint_take_any(
log->unused_ids);
365 uint id = range_tree_uint_take_any(
log->unused_ids);
412 range_tree_uint_retake(unused_ids,
id);
438 for (i = 0; i < totid; i++) {
455 range_tree_uint_release(
log->unused_ids,
id);
466 log->unused_ids = range_tree_uint_alloc(0, (
uint)-1);
503 log->current_entry = entry;
510 log->entries.first =
log->entries.last = entry;
513 while (entry->
prev) {
515 log->entries.first = entry;
517 entry =
log->entries.last;
518 while (entry->
next) {
520 log->entries.last = entry;
524 for (entry =
log->entries.first; entry; entry = entry->
next) {
543 if (
log->unused_ids) {
544 range_tree_uint_free(
log->unused_ids);
547 if (
log->id_to_elem) {
551 if (
log->elem_to_id) {
557 for (entry =
log->entries.first; entry; entry = entry->
next) {
627 entry =
log->current_entry;
630 for (entry = entry->
next; entry; entry =
next) {
642 log->current_entry = entry;
657 else if (entry->
next) {
693 else if (!entry->
next) {
705 if (
log->current_entry == entry) {
706 log->current_entry = entry->
prev;
718 log->current_entry = entry->
prev;
740 entry =
log->entries.first;
742 else if (entry->
next) {
751 log->current_entry = entry;
789 uint v_id = range_tree_uint_take_any(
log->unused_ids);
810 uint f_id = range_tree_uint_take_any(
log->unused_ids);
832 range_tree_uint_release(
log->unused_ids, v_id);
860 range_tree_uint_release(
log->unused_ids, f_id);
980 return log->current_entry;
985 return log->unused_ids;
992 void bm_log_print(
const BMLog *
log,
const char *description)
995 const char *current =
" <-- current";
998 printf(
"%s:\n", description);
999 printf(
" % 2d: [ initial ]%s\n", 0, (!
log->current_entry) ? current :
"");
1000 for (entry =
log->entries.first, i = 1; entry; entry = entry->
next, i++) {
1001 printf(
" % 2d: [%p]%s\n", i, entry, (entry ==
log->current_entry) ? current :
"");
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset(const struct CustomData *data, int type)
#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
GHash * BLI_ghash_int_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC 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
void BLI_ghash_reserve(GHash *gh, unsigned int nentries_reserve)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT
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
bool BLI_ghash_remove(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
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
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])
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_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
#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)
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.
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_vert_kill(BMesh *bm, BMVert *v)
void BM_face_kill(BMesh *bm, BMFace *f)
void BM_edge_kill(BMesh *bm, BMEdge *e)
#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)
BMLog * BM_log_create(BMesh *bm)
void BM_log_all_added(BMesh *bm, BMLog *log)
void BM_log_face_added(BMLog *log, BMFace *f)
static void bm_log_face_values_swap(BMLog *log, GHash *faces)
void BM_log_face_removed(BMLog *log, BMFace *f)
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)
BMLogEntry * BM_log_entry_add(BMLog *log)
const float * BM_log_original_vert_no(BMLog *log, BMVert *v)
static BMLogVert * bm_log_vert_alloc(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
static void bm_log_face_id_set(BMLog *log, BMFace *f, uint id)
void BM_log_cleanup_entry(BMLogEntry *entry)
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)
void BM_log_vert_added(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
static void bm_log_verts_restore(BMesh *bm, BMLog *log, GHash *verts)
const float * BM_log_original_vert_co(BMLog *log, BMVert *v)
BMLogEntry * BM_log_current_entry(BMLog *log)
static float vert_mask_get(BMVert *v, const int cd_vert_mask_offset)
void BM_log_face_modified(BMLog *log, BMFace *f)
static BMLogEntry * bm_log_entry_create(void)
RangeTreeUInt * BM_log_unused_ids(BMLog *log)
void BM_log_redo(BMesh *bm, BMLog *log)
static GHash * bm_log_compress_ids_to_indices(uint *ids, uint totid)
static void bm_log_faces_restore(BMesh *bm, BMLog *log, GHash *faces)
static BMLogFace * bm_log_face_alloc(BMLog *log, BMFace *f)
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)
BMLog * BM_log_from_existing_entries_create(BMesh *bm, BMLogEntry *entry)
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)
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)
static BMVert * bm_log_vert_from_id(BMLog *log, uint id)
static BMFace * bm_log_face_from_id(BMLog *log, uint id)
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
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
ccl_device_inline float3 log(float3 v)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
SocketIndexByIdentifierMap * map
struct RangeTreeUInt * unused_ids
BMLogEntry * current_entry