[Bf-blender-cvs] [f07f56aa378] temp_bmesh_multires: BM_mesh_create will now add mesh_id customdata layers when asked, instead of leaving that to the client.
Joseph Eagar
noreply at git.blender.org
Mon Jul 12 04:04:18 CEST 2021
Commit: f07f56aa378d7e7b98c97e95c5fc40796a67a1ef
Author: Joseph Eagar
Date: Sun Jul 11 22:02:52 2021 -0400
Branches: temp_bmesh_multires
https://developer.blender.org/rBf07f56aa378d7e7b98c97e95c5fc40796a67a1ef
BM_mesh_create will now add mesh_id customdata layers when asked,
instead of leaving that to the client.
Also semi-fixed uninitialized memory bug in bmesh unit test (dunno
how best to memset a C struct in C++ won't won't run afoul of some
random compiler somewhere).
===================================================================
M source/blender/blenkernel/intern/customdata.c
M source/blender/bmesh/intern/bmesh_mesh.c
M source/blender/bmesh/tests/bmesh_core_test.cc
M source/blender/editors/sculpt_paint/sculpt_dyntopo.c
===================================================================
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 32e96212ec1..c07c75b7745 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -3866,9 +3866,10 @@ static void CustomData_bmesh_set_default_n(CustomData *data, void **block, int n
int offset = data->layers[n].offset;
const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[n].type);
+ /*
if (data->layers[n].flag & CD_FLAG_ELEM_NOCOPY) {
return;
- }
+ }*/
if (typeInfo->set_default) {
typeInfo->set_default(POINTER_OFFSET(*block, offset), 1);
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index b21c310801c..fe91200f079 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -184,6 +184,23 @@ BMesh *BM_mesh_create(const BMAllocTemplate *allocsize, const struct BMeshCreate
CustomData_reset(&bm->ldata);
CustomData_reset(&bm->pdata);
+ if (params->use_unique_ids) {
+ bm_init_idmap_cdlayers(bm);
+
+ if (bm->vdata.totlayer) {
+ CustomData_bmesh_init_pool(&bm->vdata, 0, BM_VERT);
+ }
+ if (bm->edata.totlayer) {
+ CustomData_bmesh_init_pool(&bm->edata, 0, BM_EDGE);
+ }
+ if (bm->ldata.totlayer) {
+ CustomData_bmesh_init_pool(&bm->ldata, 0, BM_LOOP);
+ }
+ if (bm->pdata.totlayer) {
+ CustomData_bmesh_init_pool(&bm->pdata, 0, BM_FACE);
+ }
+ }
+
return bm;
}
diff --git a/source/blender/bmesh/tests/bmesh_core_test.cc b/source/blender/bmesh/tests/bmesh_core_test.cc
index 202d16b09e3..070bdfc45cf 100644
--- a/source/blender/bmesh/tests/bmesh_core_test.cc
+++ b/source/blender/bmesh/tests/bmesh_core_test.cc
@@ -12,6 +12,8 @@ TEST(bmesh_core, BMVertCreate)
BMeshCreateParams bm_params;
bm_params.use_toolflags = true;
+ bm_params.use_unique_ids = false;
+
bm = BM_mesh_create(&bm_mesh_allocsize_default, &bm_params);
EXPECT_EQ(bm->totvert, 0);
/* make a custom layer so we can see if it is copied properly */
diff --git a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
index bedc86c109a..13ca5a7b73f 100644
--- a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
@@ -468,6 +468,11 @@ BMesh *BM_mesh_bm_from_me_threaded(BMesh *bm,
const Mesh *me,
const struct BMeshFromMeshParams *params);
+#define EXPECT_EQ(a, b) \
+ if ((a) != (b)) { \
+ printf("error\n"); \
+ }
+
void SCULPT_dynamic_topology_enable_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
{
SculptSession *ss = ob->sculpt;
More information about the Bf-blender-cvs
mailing list