Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-11-09 09:11:35 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-11-09 09:11:35 +0300
commita7540f4b3611a0d06f197e6f27148319927188f7 (patch)
tree330598c659cff3d39814f62a264e76173386e084 /source/blender/bmesh
parent2772a033c9506f3358686154ee76777048a48426 (diff)
parent2eb94f30368bef17c6d0b4e2d16cd3e6d9290184 (diff)
Merge branch 'blender-v3.0-release'
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c20
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.h4
2 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index 6f7b2cbc79f..a10a911b06c 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -31,6 +31,7 @@
#include "BKE_customdata.h"
+#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "bmesh.h"
@@ -589,6 +590,25 @@ static BMFace *bm_mesh_copy_new_face(
return f_new;
}
+void BM_mesh_copy_init_customdata_from_mesh(BMesh *bm_dst,
+ const Mesh *me_src,
+ const BMAllocTemplate *allocsize)
+{
+ if (allocsize == NULL) {
+ allocsize = &bm_mesh_allocsize_default;
+ }
+
+ CustomData_copy(&me_src->vdata, &bm_dst->vdata, CD_MASK_BMESH.vmask, CD_CALLOC, 0);
+ CustomData_copy(&me_src->edata, &bm_dst->edata, CD_MASK_BMESH.emask, CD_CALLOC, 0);
+ CustomData_copy(&me_src->ldata, &bm_dst->ldata, CD_MASK_BMESH.lmask, CD_CALLOC, 0);
+ CustomData_copy(&me_src->pdata, &bm_dst->pdata, CD_MASK_BMESH.pmask, CD_CALLOC, 0);
+
+ CustomData_bmesh_init_pool(&bm_dst->vdata, allocsize->totvert, BM_VERT);
+ CustomData_bmesh_init_pool(&bm_dst->edata, allocsize->totedge, BM_EDGE);
+ CustomData_bmesh_init_pool(&bm_dst->ldata, allocsize->totloop, BM_LOOP);
+ CustomData_bmesh_init_pool(&bm_dst->pdata, allocsize->totface, BM_FACE);
+}
+
void BM_mesh_copy_init_customdata(BMesh *bm_dst, BMesh *bm_src, const BMAllocTemplate *allocsize)
{
if (allocsize == NULL) {
diff --git a/source/blender/bmesh/intern/bmesh_construct.h b/source/blender/bmesh/intern/bmesh_construct.h
index f5102283ede..f2b5e2b4daa 100644
--- a/source/blender/bmesh/intern/bmesh_construct.h
+++ b/source/blender/bmesh/intern/bmesh_construct.h
@@ -23,6 +23,7 @@
#include "bmesh_core.h"
struct BMAllocTemplate;
+struct Mesh;
bool BM_verts_from_edges(BMVert **vert_arr, BMEdge **edge_arr, const int len);
@@ -66,6 +67,9 @@ void BM_elem_attrs_copy_ex(BMesh *bm_src,
void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v);
void BM_elem_select_copy(BMesh *bm_dst, void *ele_dst_v, const void *ele_src_v);
+void BM_mesh_copy_init_customdata_from_mesh(BMesh *bm_dst,
+ const struct Mesh *me_src,
+ const struct BMAllocTemplate *allocsize);
void BM_mesh_copy_init_customdata(BMesh *bm_dst,
BMesh *bm_src,
const struct BMAllocTemplate *allocsize);