Blender  V2.93
Classes | Macros | Functions
bmesh_log.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_ghash.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_mempool.h"
#include "BLI_utildefines.h"
#include "BKE_customdata.h"
#include "bmesh.h"
#include "bmesh_log.h"
#include "range_tree.h"
#include "BLI_strict_flags.h"

Go to the source code of this file.

Classes

struct  BMLogEntry
 
struct  BMLog
 
struct  BMLogVert
 
struct  BMLogFace
 

Macros

#define logkey_hash   BLI_ghashutil_inthash_p_simple
 
#define logkey_cmp   BLI_ghashutil_intcmp
 

Functions

static uint bm_log_vert_id_get (BMLog *log, BMVert *v)
 
static void bm_log_vert_id_set (BMLog *log, BMVert *v, uint id)
 
static BMVertbm_log_vert_from_id (BMLog *log, uint id)
 
static uint bm_log_face_id_get (BMLog *log, BMFace *f)
 
static void bm_log_face_id_set (BMLog *log, BMFace *f, uint id)
 
static BMFacebm_log_face_from_id (BMLog *log, uint id)
 
static float vert_mask_get (BMVert *v, const int cd_vert_mask_offset)
 
static void vert_mask_set (BMVert *v, const float new_mask, const int cd_vert_mask_offset)
 
static void bm_log_vert_bmvert_copy (BMLogVert *lv, BMVert *v, const int cd_vert_mask_offset)
 
static BMLogVertbm_log_vert_alloc (BMLog *log, BMVert *v, const int cd_vert_mask_offset)
 
static BMLogFacebm_log_face_alloc (BMLog *log, BMFace *f)
 
static void bm_log_verts_unmake (BMesh *bm, BMLog *log, GHash *verts)
 
static void bm_log_faces_unmake (BMesh *bm, BMLog *log, GHash *faces)
 
static void bm_log_verts_restore (BMesh *bm, BMLog *log, GHash *verts)
 
static void bm_log_faces_restore (BMesh *bm, BMLog *log, GHash *faces)
 
static void bm_log_vert_values_swap (BMesh *bm, BMLog *log, GHash *verts)
 
static void bm_log_face_values_swap (BMLog *log, GHash *faces)
 
static void bm_log_assign_ids (BMesh *bm, BMLog *log)
 
static BMLogEntrybm_log_entry_create (void)
 
static void bm_log_entry_free (BMLogEntry *entry)
 
static void bm_log_id_ghash_retake (RangeTreeUInt *unused_ids, GHash *id_ghash)
 
static int uint_compare (const void *a_v, const void *b_v)
 
static GHashbm_log_compress_ids_to_indices (uint *ids, uint totid)
 
static void bm_log_id_ghash_release (BMLog *log, GHash *id_ghash)
 
BMLogBM_log_create (BMesh *bm)
 
void BM_log_cleanup_entry (BMLogEntry *entry)
 
BMLogBM_log_from_existing_entries_create (BMesh *bm, BMLogEntry *entry)
 
void BM_log_free (BMLog *log)
 
int BM_log_length (const BMLog *log)
 
void BM_log_mesh_elems_reorder (BMesh *bm, BMLog *log)
 
BMLogEntryBM_log_entry_add (BMLog *log)
 
void BM_log_entry_drop (BMLogEntry *entry)
 
void BM_log_undo (BMesh *bm, BMLog *log)
 
void BM_log_redo (BMesh *bm, BMLog *log)
 
void BM_log_vert_before_modified (BMLog *log, BMVert *v, const int cd_vert_mask_offset)
 
void BM_log_vert_added (BMLog *log, BMVert *v, const int cd_vert_mask_offset)
 
void BM_log_face_modified (BMLog *log, BMFace *f)
 
void BM_log_face_added (BMLog *log, BMFace *f)
 
void BM_log_vert_removed (BMLog *log, BMVert *v, const int cd_vert_mask_offset)
 
void BM_log_face_removed (BMLog *log, BMFace *f)
 
void BM_log_all_added (BMesh *bm, BMLog *log)
 
void BM_log_before_all_removed (BMesh *bm, BMLog *log)
 
const floatBM_log_original_vert_co (BMLog *log, BMVert *v)
 
const short * BM_log_original_vert_no (BMLog *log, BMVert *v)
 
float BM_log_original_mask (BMLog *log, BMVert *v)
 
void BM_log_original_vert_data (BMLog *log, BMVert *v, const float **r_co, const short **r_no)
 
BMLogEntryBM_log_current_entry (BMLog *log)
 
RangeTreeUInt * BM_log_unused_ids (BMLog *log)
 

Detailed Description

The BMLog is an interface for storing undo/redo steps as a BMesh is modified. It only stores changes to the BMesh, not full copies.

Currently it supports the following types of changes:

Definition in file bmesh_log.c.

Macro Definition Documentation

◆ logkey_cmp

#define logkey_cmp   BLI_ghashutil_intcmp

Definition at line 126 of file bmesh_log.c.

◆ logkey_hash

#define logkey_hash   BLI_ghashutil_inthash_p_simple

Definition at line 125 of file bmesh_log.c.

Function Documentation

◆ BM_log_all_added()

void BM_log_all_added ( BMesh bm,
BMLog log 
)

◆ bm_log_assign_ids()

static void bm_log_assign_ids ( BMesh bm,
BMLog log 
)
static

◆ BM_log_before_all_removed()

void BM_log_before_all_removed ( BMesh bm,
BMLog log 
)

◆ BM_log_cleanup_entry()

void BM_log_cleanup_entry ( BMLogEntry entry)

◆ bm_log_compress_ids_to_indices()

static GHash* bm_log_compress_ids_to_indices ( uint ids,
uint  totid 
)
static

◆ BM_log_create()

BMLog* BM_log_create ( BMesh bm)

◆ BM_log_current_entry()

BMLogEntry* BM_log_current_entry ( BMLog log)

Definition at line 1106 of file bmesh_log.c.

References KDL::log().

◆ BM_log_entry_add()

BMLogEntry* BM_log_entry_add ( BMLog log)

◆ bm_log_entry_create()

static BMLogEntry* bm_log_entry_create ( void  )
static

◆ BM_log_entry_drop()

void BM_log_entry_drop ( BMLogEntry entry)

◆ bm_log_entry_free()

static void bm_log_entry_free ( BMLogEntry entry)
static

◆ BM_log_face_added()

void BM_log_face_added ( BMLog log,
BMFace f 
)

◆ bm_log_face_alloc()

static BMLogFace* bm_log_face_alloc ( BMLog log,
BMFace f 
)
static

◆ bm_log_face_from_id()

static BMFace* bm_log_face_from_id ( BMLog log,
uint  id 
)
static

◆ bm_log_face_id_get()

static uint bm_log_face_id_get ( BMLog log,
BMFace f 
)
static

◆ bm_log_face_id_set()

static void bm_log_face_id_set ( BMLog log,
BMFace f,
uint  id 
)
static

◆ BM_log_face_modified()

void BM_log_face_modified ( BMLog log,
BMFace f 
)

◆ BM_log_face_removed()

void BM_log_face_removed ( BMLog log,
BMFace f 
)

◆ bm_log_face_values_swap()

static void bm_log_face_values_swap ( BMLog log,
GHash faces 
)
static

◆ bm_log_faces_restore()

static void bm_log_faces_restore ( BMesh bm,
BMLog log,
GHash faces 
)
static

◆ bm_log_faces_unmake()

static void bm_log_faces_unmake ( BMesh bm,
BMLog log,
GHash faces 
)
static

◆ BM_log_free()

void BM_log_free ( BMLog log)

◆ BM_log_from_existing_entries_create()

BMLog* BM_log_from_existing_entries_create ( BMesh bm,
BMLogEntry entry 
)

◆ bm_log_id_ghash_release()

static void bm_log_id_ghash_release ( BMLog log,
GHash id_ghash 
)
static

Definition at line 458 of file bmesh_log.c.

References BLI_ghashIterator_getKey(), GHASH_ITER, KDL::log(), and POINTER_AS_UINT.

Referenced by BM_log_entry_drop().

◆ bm_log_id_ghash_retake()

static void bm_log_id_ghash_retake ( RangeTreeUInt *  unused_ids,
GHash id_ghash 
)
static

◆ BM_log_length()

int BM_log_length ( const BMLog log)

Definition at line 585 of file bmesh_log.c.

References BLI_listbase_count(), and KDL::log().

◆ BM_log_mesh_elems_reorder()

void BM_log_mesh_elems_reorder ( BMesh bm,
BMLog log 
)

◆ BM_log_original_mask()

float BM_log_original_mask ( BMLog log,
BMVert v 
)

◆ BM_log_original_vert_co()

const float* BM_log_original_vert_co ( BMLog log,
BMVert v 
)

◆ BM_log_original_vert_data()

void BM_log_original_vert_data ( BMLog log,
BMVert v,
const float **  r_co,
const short **  r_no 
)

◆ BM_log_original_vert_no()

const short* BM_log_original_vert_no ( BMLog log,
BMVert v 
)

◆ BM_log_redo()

void BM_log_redo ( BMesh bm,
BMLog log 
)

◆ BM_log_undo()

void BM_log_undo ( BMesh bm,
BMLog log 
)

◆ BM_log_unused_ids()

RangeTreeUInt* BM_log_unused_ids ( BMLog log)

Definition at line 1112 of file bmesh_log.c.

References KDL::log().

◆ BM_log_vert_added()

void BM_log_vert_added ( BMLog log,
BMVert v,
const int  cd_vert_mask_offset 
)

◆ bm_log_vert_alloc()

static BMLogVert* bm_log_vert_alloc ( BMLog log,
BMVert v,
const int  cd_vert_mask_offset 
)
static

◆ BM_log_vert_before_modified()

void BM_log_vert_before_modified ( BMLog log,
BMVert v,
const int  cd_vert_mask_offset 
)

◆ bm_log_vert_bmvert_copy()

static void bm_log_vert_bmvert_copy ( BMLogVert lv,
BMVert v,
const int  cd_vert_mask_offset 
)
static

◆ bm_log_vert_from_id()

static BMVert* bm_log_vert_from_id ( BMLog log,
uint  id 
)
static

◆ bm_log_vert_id_get()

static uint bm_log_vert_id_get ( BMLog log,
BMVert v 
)
static

◆ bm_log_vert_id_set()

static void bm_log_vert_id_set ( BMLog log,
BMVert v,
uint  id 
)
static

◆ BM_log_vert_removed()

void BM_log_vert_removed ( BMLog log,
BMVert v,
const int  cd_vert_mask_offset 
)

◆ bm_log_vert_values_swap()

static void bm_log_vert_values_swap ( BMesh bm,
BMLog log,
GHash verts 
)
static

◆ bm_log_verts_restore()

static void bm_log_verts_restore ( BMesh bm,
BMLog log,
GHash verts 
)
static

◆ bm_log_verts_unmake()

static void bm_log_verts_unmake ( BMesh bm,
BMLog log,
GHash verts 
)
static

◆ uint_compare()

static int uint_compare ( const void *  a_v,
const void *  b_v 
)
static

Definition at line 426 of file bmesh_log.c.

References Freestyle::a.

Referenced by bm_log_compress_ids_to_indices().

◆ vert_mask_get()

static float vert_mask_get ( BMVert v,
const int  cd_vert_mask_offset 
)
static

Definition at line 181 of file bmesh_log.c.

References BM_ELEM_CD_GET_FLOAT, and v.

Referenced by bm_log_vert_bmvert_copy(), and bm_log_vert_values_swap().

◆ vert_mask_set()

static void vert_mask_set ( BMVert v,
const float  new_mask,
const int  cd_vert_mask_offset 
)
static

Definition at line 192 of file bmesh_log.c.

References BM_ELEM_CD_SET_FLOAT, and v.

Referenced by bm_log_vert_values_swap(), and bm_log_verts_restore().