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).
This commit is contained in:
parent
4e91e72d53
commit
f07f56aa37
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue