Blender  V2.93
bmesh_log.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
23 struct BMFace;
24 struct BMVert;
25 struct BMesh;
26 struct RangeTreeUInt;
27 
28 typedef struct BMLog BMLog;
29 typedef struct BMLogEntry BMLogEntry;
30 
31 /* Allocate and initialize a new BMLog */
33 
34 /* Allocate and initialize a new BMLog using existing BMLogEntries */
36 
37 /* Free all the data in a BMLog including the log itself */
38 void BM_log_free(BMLog *log);
39 
40 /* Get the number of log entries */
41 int BM_log_length(const BMLog *log);
42 
43 /* Apply a consistent ordering to BMesh vertices and faces */
45 
46 /* Start a new log entry and update the log entry list */
48 
49 /* Mark all used ids as unused for this node */
50 void BM_log_cleanup_entry(BMLogEntry *entry);
51 
52 /* Remove an entry from the log */
53 void BM_log_entry_drop(BMLogEntry *entry);
54 
55 /* Undo one BMLogEntry */
56 void BM_log_undo(BMesh *bm, BMLog *log);
57 
58 /* Redo one BMLogEntry */
59 void BM_log_redo(BMesh *bm, BMLog *log);
60 
61 /* Log a vertex before it is modified */
62 void BM_log_vert_before_modified(BMLog *log, struct BMVert *v, const int cd_vert_mask_offset);
63 
64 /* Log a new vertex as added to the BMesh */
65 void BM_log_vert_added(BMLog *log, struct BMVert *v, const int cd_vert_mask_offset);
66 
67 /* Log a face before it is modified */
68 void BM_log_face_modified(BMLog *log, struct BMFace *f);
69 
70 /* Log a new face as added to the BMesh */
71 void BM_log_face_added(BMLog *log, struct BMFace *f);
72 
73 /* Log a vertex as removed from the BMesh */
74 void BM_log_vert_removed(BMLog *log, struct BMVert *v, const int cd_vert_mask_offset);
75 
76 /* Log a face as removed from the BMesh */
77 void BM_log_face_removed(BMLog *log, struct BMFace *f);
78 
79 /* Log all vertices/faces in the BMesh as added */
81 
82 /* Log all vertices/faces in the BMesh as removed */
84 
85 /* Get the logged coordinates of a vertex */
86 const float *BM_log_original_vert_co(BMLog *log, BMVert *v);
87 
88 /* Get the logged normal of a vertex */
89 const short *BM_log_original_vert_no(BMLog *log, BMVert *v);
90 
91 /* Get the logged mask of a vertex */
93 
94 /* Get the logged data of a vertex (avoid multiple lookups) */
95 void BM_log_original_vert_data(BMLog *log, BMVert *v, const float **r_co, const short **r_no);
96 
97 /* For internal use only (unit testing) */
99 struct RangeTreeUInt *BM_log_unused_ids(BMLog *log);
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMLog * BM_log_create(BMesh *bm)
Definition: bmesh_log.c:472
void BM_log_all_added(BMesh *bm, BMLog *log)
Definition: bmesh_log.c:987
void BM_log_vert_added(BMLog *log, struct BMVert *v, const int cd_vert_mask_offset)
Definition: bmesh_log.c:862
void BM_log_original_vert_data(BMLog *log, BMVert *v, const float **r_co, const short **r_no)
Definition: bmesh_log.c:1087
void BM_log_vert_removed(BMLog *log, struct BMVert *v, const int cd_vert_mask_offset)
Definition: bmesh_log.c:924
void BM_log_face_removed(BMLog *log, struct BMFace *f)
Definition: bmesh_log.c:965
void BM_log_free(BMLog *log)
Definition: bmesh_log.c:559
BMLogEntry * BM_log_entry_add(BMLog *log)
Definition: bmesh_log.c:652
void BM_log_cleanup_entry(BMLogEntry *entry)
Definition: bmesh_log.c:487
struct RangeTreeUInt * BM_log_unused_ids(BMLog *log)
Definition: bmesh_log.c:1112
float BM_log_original_mask(BMLog *log, BMVert *v)
Definition: bmesh_log.c:1072
void BM_log_face_modified(BMLog *log, struct BMFace *f)
Definition: bmesh_log.c:878
const float * BM_log_original_vert_co(BMLog *log, BMVert *v)
Definition: bmesh_log.c:1036
BMLogEntry * BM_log_current_entry(BMLog *log)
Definition: bmesh_log.c:1106
const short * BM_log_original_vert_no(BMLog *log, BMVert *v)
Definition: bmesh_log.c:1054
void BM_log_redo(BMesh *bm, BMLog *log)
Definition: bmesh_log.c:781
void BM_log_vert_before_modified(BMLog *log, struct BMVert *v, const int cd_vert_mask_offset)
Definition: bmesh_log.c:838
BMLog * BM_log_from_existing_entries_create(BMesh *bm, BMLogEntry *entry)
Definition: bmesh_log.c:517
void BM_log_mesh_elems_reorder(BMesh *bm, BMLog *log)
Definition: bmesh_log.c:591
void BM_log_entry_drop(BMLogEntry *entry)
Definition: bmesh_log.c:688
void BM_log_face_added(BMLog *log, struct BMFace *f)
Definition: bmesh_log.c:894
void BM_log_undo(BMesh *bm, BMLog *log)
Definition: bmesh_log.c:757
int BM_log_length(const BMLog *log)
Definition: bmesh_log.c:585
void BM_log_before_all_removed(BMesh *bm, BMLog *log)
Definition: bmesh_log.c:1015
ATTR_WARN_UNUSED_RESULT const BMVert * v
INLINE Rall1d< T, V, S > log(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:303