Fixed SCULPT_dynamic_topology_sync_layers from last commit.
This commit is contained in:
parent
f9859a3b2a
commit
4fc4a7e1f4
|
@ -1717,6 +1717,7 @@ void BKE_sculpt_update_object_after_eval(Depsgraph *depsgraph, Object *ob_eval)
|
|||
|
||||
BLI_assert(me_eval != NULL);
|
||||
sculpt_update_object(depsgraph, ob_orig, me_eval, false, false, false);
|
||||
SCULPT_dynamic_topology_sync_layers(ob_orig, me_eval);
|
||||
}
|
||||
|
||||
void BKE_sculpt_color_layer_create_if_needed(struct Object *object)
|
||||
|
@ -1733,6 +1734,7 @@ void BKE_sculpt_color_layer_create_if_needed(struct Object *object)
|
|||
CustomData_add_layer(&orig_me->vdata, CD_PROP_COLOR, CD_DEFAULT, NULL, orig_me->totvert);
|
||||
BKE_mesh_update_customdata_pointers(orig_me, true);
|
||||
DEG_id_tag_update(&orig_me->id, ID_RECALC_GEOMETRY);
|
||||
SCULPT_dynamic_topology_sync_layers(object, orig_me);
|
||||
}
|
||||
|
||||
void BKE_sculpt_update_object_for_edit(
|
||||
|
@ -1981,6 +1983,7 @@ static PBVH *build_pbvh_for_dynamic_topology(Object *ob)
|
|||
ob->sculpt->cd_origvcol_offset);
|
||||
pbvh_show_mask_set(pbvh, ob->sculpt->show_mask);
|
||||
pbvh_show_face_sets_set(pbvh, false);
|
||||
|
||||
return pbvh;
|
||||
}
|
||||
|
||||
|
@ -2071,7 +2074,9 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
|
|||
}
|
||||
}
|
||||
else if (BKE_pbvh_type(pbvh) == PBVH_BMESH) {
|
||||
SCULPT_dynamic_topology_sync_layers(ob);
|
||||
Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
|
||||
SCULPT_dynamic_topology_sync_layers(ob, BKE_object_get_original_mesh(ob));
|
||||
}
|
||||
return pbvh;
|
||||
}
|
||||
|
|
|
@ -238,6 +238,8 @@ void SCULPT_dynamic_topology_sync_layers(Object *ob, Mesh *me)
|
|||
CustomData *cd1[4] = {&me->vdata, &me->edata, &me->ldata, &me->pdata};
|
||||
CustomData *cd2[4] = {&bm->vdata, &bm->edata, &bm->ldata, &bm->pdata};
|
||||
int types[4] = {BM_VERT, BM_EDGE, BM_LOOP, BM_FACE};
|
||||
int badmask = CD_MASK_MLOOP | CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MPOLY |
|
||||
CD_MASK_ORIGINDEX | CD_MASK_ORIGSPACE | CD_MASK_MFACE;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
CustomDataLayer **newlayers = NULL;
|
||||
|
@ -252,19 +254,15 @@ void SCULPT_dynamic_topology_sync_layers(Object *ob, Mesh *me)
|
|||
|
||||
for (int j = 0; j < data1->totlayer; j++) {
|
||||
CustomDataLayer *cl1 = data1->layers + j;
|
||||
|
||||
if ((1 << cl1->type) & badmask) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int idx = CustomData_get_named_layer_index(data2, cl1->type, cl1->name);
|
||||
if (idx < 0) {
|
||||
BLI_array_append(newlayers, cl1);
|
||||
}
|
||||
else {
|
||||
idx -= CustomData_get_layer_index(data2, cl1->type);
|
||||
|
||||
int idx2 = i - CustomData_get_layer_index(data1, cl1->type);
|
||||
|
||||
if (idx != idx2) {
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < BLI_array_len(newlayers); j++) {
|
||||
|
@ -277,27 +275,32 @@ void SCULPT_dynamic_topology_sync_layers(Object *ob, Mesh *me)
|
|||
};
|
||||
|
||||
for (int j = 0; j < data1->totlayer; j++) {
|
||||
CustomDataLayer *cl1 = data1->layers + j;
|
||||
CustomDataLayer *cl = data1->layers + j;
|
||||
CustomDataLayer *cl1 = cl;
|
||||
|
||||
if ((1 << cl1->type) & badmask) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typemap[cl1->type]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
typemap[cl1->type] = 1;
|
||||
cl1 = CustomData_get_active_layer(data1, cl1->type);
|
||||
cl1 = cl + CustomData_get_active_layer(data1, cl1->type);
|
||||
|
||||
int idx = CustomData_get_named_layer_index(data2, cl1->type, cl1->name);
|
||||
CustomData_set_layer_active_index(data2, cl1->type, idx);
|
||||
|
||||
cl1 = CustomData_get_render_layer(data1, cl1->type);
|
||||
cl1 = cl + CustomData_get_render_layer(data1, cl1->type);
|
||||
idx = CustomData_get_named_layer_index(data2, cl1->type, cl1->name);
|
||||
CustomData_set_layer_render_index(data2, cl1->type, idx);
|
||||
|
||||
cl1 = CustomData_get_stencil_layer(data1, cl1->type);
|
||||
cl1 = cl + CustomData_get_stencil_layer(data1, cl1->type);
|
||||
idx = CustomData_get_named_layer_index(data2, cl1->type, cl1->name);
|
||||
CustomData_set_layer_stencil_index(data2, cl1->type, idx);
|
||||
|
||||
cl1 = CustomData_get_clone_layer(data1, cl1->type);
|
||||
cl1 = cl + CustomData_get_clone_layer(data1, cl1->type);
|
||||
idx = CustomData_get_named_layer_index(data2, cl1->type, cl1->name);
|
||||
CustomData_set_layer_clone_index(data2, cl1->type, idx);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue