171 for (j = 0; j < mp->
totloop; j++, ml++) {
173 edges[j] = etable[ml->
e];
236 int tot_shape_keys = 0;
261 if (is_new ==
false) {
264 const float(**shape_key_table)[3] = tot_shape_keys ?
268 if ((
params->active_shapekey != 0) && tot_shape_keys > 0) {
276 if (tot_shape_keys ||
params->add_key_index) {
281 if (tot_shape_keys) {
287 "%s had to generate shape key uid's in a situation we shouldn't need to! "
288 "(bmesh internal error)\n",
305 for (i = 0, block = me->
key->
block.
first; i < tot_shape_keys; block = block->
next, i++) {
311 shape_key_table[i] = (
const float(*)[3])block->
data;
329 const int cd_shape_keyindex_offset = is_new && (tot_shape_keys ||
params->add_key_index) ?
335 for (i = 0, mvert = me->
mvert; i < me->totvert; i++, mvert++) {
352 if (cd_vert_bweight_offset != -1) {
357 if (cd_shape_keyindex_offset != -1) {
362 if (tot_shape_keys) {
364 for (
int j = 0; j < tot_shape_keys; j++, co_dst++) {
376 for (i = 0; i < me->
totedge; i++, medge++) {
392 if (cd_edge_bweight_offset != -1) {
395 if (cd_edge_crease_offset != -1) {
410 for (i = 0, totloops = 0; i < me->
totpoly; i++, mp++) {
415 if (ftable !=
NULL) {
421 "%s: Warning! Bad face in mesh"
422 " \"%s\" at index %d!, skipping\n",
453 }
while ((l_iter = l_iter->
next) != l_first);
458 if (
params->calc_face_normal) {
474 for (i = 0, msel = me->
mselect; i < me->totselect; i++, msel++) {
476 switch (msel->
type) {
490 if (*ele_p !=
NULL) {
521 vertMap =
MEM_callocN(
sizeof(*vertMap) * ototvert,
"vertMap");
522 if (cd_shape_keyindex_offset != -1) {
529 (vertMap[keyi] ==
NULL)) {
576 (
e->l && (
e->l !=
e->l->radial_next)) &&
604 const int ototvert = me->
totvert;
606 if (me->
key && (cd_shape_keyindex_offset != -1)) {
613 oldverts = me->
mvert;
673 if (cd_vert_bweight_offset != -1) {
699 if (cd_edge_crease_offset != -1) {
702 if (cd_edge_bweight_offset != -1) {
734 }
while ((l_iter = l_iter->
next) != l_first);
749 if (
params->calc_object_remap && (ototvert > 0)) {
758 if (vertMap ==
NULL) {
762 if (ob->
par1 < ototvert) {
763 eve = vertMap[ob->
par1];
768 if (ob->
par2 < ototvert) {
769 eve = vertMap[ob->
par2];
774 if (ob->
par3 < ototvert) {
775 eve = vertMap[ob->
par3];
781 if (ob->
data == me) {
786 if (vertMap ==
NULL) {
790 for (i = j = 0; i < hmd->
totindex; i++) {
791 if (hmd->
indexar[i] < ototvert) {
792 eve = vertMap[hmd->
indexar[i]];
876 (oldverts !=
NULL) &&
879 (cd_shape_keyindex_offset != -1)) {
912 const float(*ofs_pt)[3] = ofs;
913 float *newkey, (*oldkey)[3], *fp;
916 const int cd_shape_offset = (currkey_uuid == -1) ? -1 :
920 const bool apply_offset = (cd_shape_offset != -1) && (ofs !=
NULL) && (currkey != actkey) &&
924 oldkey = currkey->
data;
929 if (currkey == actkey) {
933 if (cd_shape_keyindex_offset != -1) {
943 else if (cd_shape_offset != -1) {
947 else if ((oldkey !=
NULL) && (cd_shape_keyindex_offset != -1) &&
949 (keyi < currkey->totelem)) {
978 currkey->
data = newkey;
987 if (
params->update_shapekey_indices) {
990 if (cd_shape_keyindex_offset != -1) {
997 if (oldverts !=
NULL) {
1049 if (cd_mask_extra !=
NULL) {
1068 int *index, add_orig;
1093 if (cd_vert_bweight_offset != -1) {
1107 MEdge *med = &medge[i];
1124 if (cd_edge_crease_offset != -1) {
1127 if (cd_edge_bweight_offset != -1) {
1143 MPoly *mp = &mpoly[i];
1162 }
while ((l_iter = l_iter->
next) != l_first);
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
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)
bool CustomData_has_layer(const struct CustomData *data, int type)
void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
void * CustomData_set_layer(const struct CustomData *data, int type, void *ptr)
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, const char htype)
const CustomData_MeshMasks CD_MASK_BMESH
bool CustomData_bmesh_merge(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, struct BMesh *bm, const char htype)
void * CustomData_get_layer(const struct CustomData *data, int type)
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
bool CustomData_merge(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, int totelem)
void CustomData_copy(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, int totelem)
int CustomData_get_offset(const struct CustomData *data, int type)
const CustomData_MeshMasks CD_MASK_MESH
void CustomData_update_typemap(struct CustomData *data)
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(struct Key *key, const int index)
struct KeyBlock * BKE_keyblock_add(struct Key *key, const char *name)
void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd)
void BKE_mesh_runtime_clear_geometry(struct Mesh *mesh)
void multires_topology_changed(struct Mesh *me)
#define BLI_array_alloca(arr, realsize)
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 normal_float_to_short_v3(short r[3], const float n[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void normal_short_to_float_v3(float r[3], const short n[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])
bool DEG_is_original_id(const struct ID *id)
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
#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(MPoly *mp, MLoop *ml, BMesh *bm, BMVert **vtable, BMEdge **etable)
static BMVert ** bm_to_mesh_vertex_map(BMesh *bm, int ototvert)
BMesh -> Mesh.
char BM_mesh_cd_flag_from_bmesh(BMesh *bm)
void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshParams *params)
Mesh -> BMesh.
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 const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
struct BMEditSelection * next
struct BMLoop * radial_next
struct BLI_mempool * pool
struct CustomData pdata ldata
struct CustomData vdata edata fdata
struct ModifierData * next
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)