197 verts[i] = vtable[loops[i].v];
198 edges[i] = etable[loops[i].e];
209 float(*keyco)[3] =
nullptr;
228 const float(*vert_normals)[3] =
nullptr;
229 if (
params->calc_vert_normal) {
248 int tot_shape_keys = 0;
273 if (is_new ==
false) {
277 shape_key_table, tot_shape_keys) :
280 if ((
params->active_shapekey != 0) && tot_shape_keys > 0) {
288 if (tot_shape_keys ||
params->add_key_index) {
293 if (tot_shape_keys) {
299 "%s had to generate shape key uid's in a situation we shouldn't need to! "
300 "(bmesh internal error)\n",
311 keyco =
params->use_shapekey ?
static_cast<float(*)[3]
>(actkey->
data) :
nullptr;
320 block = block->
next, i++) {
326 shape_key_table[i] =
static_cast<const float(*)[3]
>(block->
data);
351 const int cd_shape_keyindex_offset = is_new && (tot_shape_keys ||
params->add_key_index) ?
357 for (
const int i : mvert.index_range()) {
366 if (mvert[i].flag &
SELECT) {
377 if (cd_vert_bweight_offset != -1) {
382 if (cd_shape_keyindex_offset != -1) {
387 if (tot_shape_keys) {
389 for (
int j = 0; j < tot_shape_keys; j++, co_dst++) {
400 for (
const int i : medge.index_range()) {
409 if (medge[i].flag &
SELECT) {
416 if (cd_edge_bweight_offset != -1) {
419 if (cd_edge_crease_offset != -1) {
438 for (
const int i : mpoly.index_range()) {
440 *
bm, mloop.slice(mpoly[i].loopstart, mpoly[i].totloop), vtable, etable);
447 "%s: Warning! Bad face in mesh"
448 " \"%s\" at index %d!, skipping\n",
466 f->
mat_nr = mpoly[i].mat_nr;
471 int j = mpoly[i].loopstart;
480 }
while ((l_iter = l_iter->
next) != l_first);
485 if (
params->calc_face_normal) {
518 if (*ele_p !=
nullptr) {
535 BMVert **vertMap =
nullptr;
543 vertMap =
static_cast<BMVert **
>(
MEM_callocN(
sizeof(*vertMap) * ototvert,
"vertMap"));
544 if (cd_shape_keyindex_offset != -1) {
551 (vertMap[keyi] ==
nullptr)) {
686 const bool active_shapekey_to_mvert)
691 bool actkey_has_layer =
false;
708 if (currkey == actkey) {
709 actkey_has_layer =
true;
721 float(*ofs)[3] =
nullptr;
726 (actkey_has_layer ==
true) &&
728 (cd_shape_keyindex_offset != -1) &&
768 bool update_vertex_coords_from_refkey =
false;
769 int cd_shape_offset_refkey = -1;
770 if (active_shapekey_to_mvert ==
false) {
771 if ((actkey != key->
refkey) && (cd_shape_keyindex_offset != -1)) {
773 if (refkey_uuid != -1) {
775 if (cd_shape_offset_refkey != -1) {
776 update_vertex_coords_from_refkey =
true;
784 float(*currkey_data)[3];
787 const int cd_shape_offset = (currkey_uuid == -1) ?
792 if (cd_shape_offset != -1) {
793 const bool apply_offset = (ofs !=
nullptr) && (currkey != actkey) &&
796 if (currkey->data && (currkey->totelem ==
bm->
totvert)) {
803 currkey_data = (
float(*)[3])currkey->data;
809 if (currkey == actkey) {
812 if (update_vertex_coords_from_refkey) {
839 if (currkey->data && (cd_shape_keyindex_offset != -1)) {
841 "Found shape-key but no CD_SHAPEKEY layers to read from, "
842 "using existing shake-key data where possible");
846 "Found shape-key but no CD_SHAPEKEY layers to read from, "
847 "using basis shape-key data");
850 currkey_data =
static_cast<float(*)[3]
>(
856 if ((currkey->data !=
nullptr) && (cd_shape_keyindex_offset != -1) &&
858 (keyi < currkey->totelem)) {
864 const float(*oldkey)[3] =
static_cast<const float(*)[3]
>(currkey->data);
877 currkey->data = currkey_data;
896 (
e->l && (
e->l !=
e->l->radial_next)) &&
919 const int ototvert = me->
totvert;
981 if (cd_vert_bweight_offset != -1) {
1007 if (cd_edge_crease_offset != -1) {
1010 if (cd_edge_bweight_offset != -1) {
1023 BMLoop *l_iter, *l_first;
1042 }
while ((l_iter = l_iter->
next) != l_first);
1057 if (
params->calc_object_remap && (ototvert > 0)) {
1059 BMVert **vertMap =
nullptr;
1064 if (vertMap ==
nullptr) {
1068 if (ob->par1 < ototvert) {
1069 eve = vertMap[ob->par1];
1074 if (ob->par2 < ototvert) {
1075 eve = vertMap[ob->par2];
1080 if (ob->par3 < ototvert) {
1081 eve = vertMap[ob->par3];
1087 if (ob->data == me) {
1092 if (vertMap ==
nullptr) {
1097 if (hmd->
indexar[i] < ototvert) {
1098 eve = vertMap[hmd->
indexar[i]];
1132 if (selected->htype ==
BM_VERT) {
1135 else if (selected->htype ==
BM_EDGE) {
1138 else if (selected->htype ==
BM_FACE) {
1151 if (
params->update_shapekey_indices) {
1154 if (cd_shape_keyindex_offset != -1) {
1188 if (cd_mask_extra !=
nullptr) {
1228 if (cd_vert_bweight_offset != -1) {
1237 MEdge *med = &medge[i];
1254 if (cd_edge_crease_offset != -1) {
1257 if (cd_edge_bweight_offset != -1) {
1269 MPoly *mp = &mpoly[i];
1288 }
while ((l_iter = l_iter->
next) != l_first);
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
bool CustomData_merge(const struct CustomData *source, struct CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
void CustomData_free(struct CustomData *data, int totelem)
int CustomData_number_of_layers(const struct CustomData *data, int type)
void CustomData_from_bmesh_block(const struct CustomData *source, struct CustomData *dest, void *src_block, int dest_index)
void CustomData_copy(const struct CustomData *source, struct CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
bool CustomData_has_layer(const struct CustomData *data, int type)
void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
int CustomData_get_layer_index_n(const struct CustomData *data, int type, int n)
void * CustomData_add_layer_named(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem, const char *name)
void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, char htype)
const CustomData_MeshMasks CD_MASK_BMESH
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
int CustomData_get_n_offset(const struct CustomData *data, int type, int n)
const CustomData_MeshMasks CD_MASK_DERIVEDMESH
int CustomData_get_offset(const struct CustomData *data, int type)
const CustomData_MeshMasks CD_MASK_MESH
bool CustomData_bmesh_merge(const struct CustomData *source, struct CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, struct BMesh *bm, char htype)
void CustomData_to_bmesh_block(const struct CustomData *source, struct CustomData *dest, int src_index, void **dest_block, bool use_default_init)
bool BKE_keyblock_is_basis(const struct Key *key, int index)
struct KeyBlock * BKE_keyblock_add(struct Key *key, const char *name)
const float(* BKE_mesh_vertex_normals_ensure(const struct Mesh *mesh))[3]
void BKE_mesh_update_customdata_pointers(struct Mesh *me, bool do_ensure_tess_cd)
void BKE_mesh_clear_derived_normals(struct Mesh *mesh)
void BKE_mesh_runtime_clear_geometry(struct Mesh *mesh)
void multires_topology_changed(struct Mesh *me)
#define BLI_array_alloca(arr, realsize)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3(float r[3], const float a[3])
#define CLOG_WARN(clg_ref,...)
bool DEG_is_original_id(const struct ID *id)
Object is a sort of wrapper for general info.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
#define BM_ELEM_CD_SET_FLOAT(ele, offset, f)
#define BM_ELEM_CD_GET_INT(ele, offset)
#define BM_ELEM_CD_SET_INT(ele, offset, f)
#define BM_FACE_FIRST_LOOP(p)
#define BM_ELEM_CD_GET_FLOAT_AS_UCHAR(ele, offset)
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
char BM_face_flag_from_mflag(const char mflag)
char BM_face_flag_to_mflag(BMFace *f)
short BM_edge_flag_to_mflag(BMEdge *e)
char BM_vert_flag_from_mflag(const char mflag)
char BM_edge_flag_from_mflag(const short mflag)
char BM_vert_flag_to_mflag(BMVert *v)
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(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, const BMFace *f_example, const eBMCreateFlag create_flag)
BMEdge * BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag)
Main function for creating a new edge.
#define BM_elem_index_get(ele)
#define BM_elem_index_set(ele, index)
void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_select_history_clear(BMesh *bm)
void BM_face_select_set(BMesh *bm, BMFace *f, const bool select)
Select Face.
void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select)
Select Vert.
void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select)
Select Edge.
#define BM_select_history_store_notest(bm, ele)
static int bm_to_mesh_shape_layer_index_from_kb(BMesh *bm, KeyBlock *currkey)
void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *cd_mask_extra)
BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
static BMFace * bm_face_create_from_mpoly(BMesh &bm, Span< MLoop > loops, Span< BMVert * > vtable, Span< BMEdge * > etable)
static BMVert ** bm_to_mesh_vertex_map(BMesh *bm, int ototvert)
BMesh -> Mesh.
static void bm_to_mesh_shape(BMesh *bm, Key *key, MVert *mvert, const bool active_shapekey_to_mvert)
char BM_mesh_cd_flag_from_bmesh(BMesh *bm)
void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshParams *params)
void BM_mesh_cd_flag_ensure(BMesh *bm, Mesh *mesh, const char cd_flag)
void BM_mesh_cd_flag_apply(BMesh *bm, const char cd_flag)
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMeshParams *params)
void BM_face_normal_update(BMFace *f)
#define BM_CHECK_ELEMENT(el)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
void reinitialize(const int64_t new_size)
constexpr int64_t size() const
constexpr IndexRange index_range() const
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 float4 mask(const int4 &mask, const float4 &a)
struct BMLoop * radial_next
struct BLI_mempool * pool