Fix T103394: default/active color status lost after remeshing
Caused by rB6514bb05ea5a. For the remeshing, we have to make sure these names are brought over each time a mesh is made from another in the process. This happens when reprojecting the colors in `BKE_remesh_reproject_vertex_paint` and also again in `BKE_mesh_nomain_to_mesh`. A bit unsure if this should happen as deep as in `BKE_mesh_nomain_to_mesh` (if not, this can be isolated to `voxel_remesh_exec`), but I would assume other callers of `BKE_mesh_nomain_to_mesh` would actually benefit from it, too? Maniphest Tasks: T103394 Differential Revision: https://developer.blender.org/D16847
This commit is contained in:
parent
f803a0a95b
commit
fb8778a28c
Notes:
blender-bot
2023-02-14 10:09:24 +01:00
Referenced by issue #103394, Sculpt: Color attribute lose selected status after remesh
|
@ -1191,6 +1191,16 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob)
|
|||
CustomData_copy(&mesh_src->pdata, &mesh_dst->pdata, mask.pmask, CD_ASSIGN, mesh_src->totpoly);
|
||||
CustomData_copy(&mesh_src->ldata, &mesh_dst->ldata, mask.lmask, CD_ASSIGN, mesh_src->totloop);
|
||||
|
||||
/* Make sure active/default color attribute (names) are brought over. */
|
||||
if (mesh_src->active_color_attribute) {
|
||||
MEM_SAFE_FREE(mesh_dst->active_color_attribute);
|
||||
mesh_dst->active_color_attribute = BLI_strdup(mesh_src->active_color_attribute);
|
||||
}
|
||||
if (mesh_src->default_color_attribute) {
|
||||
MEM_SAFE_FREE(mesh_dst->default_color_attribute);
|
||||
mesh_dst->default_color_attribute = BLI_strdup(mesh_src->default_color_attribute);
|
||||
}
|
||||
|
||||
BLI_freelistN(&mesh_dst->vertex_group_names);
|
||||
mesh_dst->vertex_group_names = mesh_src->vertex_group_names;
|
||||
BLI_listbase_clear(&mesh_src->vertex_group_names);
|
||||
|
|
|
@ -489,6 +489,16 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, const Mesh *source)
|
|||
}
|
||||
}
|
||||
|
||||
/* Make sure active/default color attribute (names) are brought over. */
|
||||
if (source->active_color_attribute) {
|
||||
MEM_SAFE_FREE(target->active_color_attribute);
|
||||
target->active_color_attribute = BLI_strdup(source->active_color_attribute);
|
||||
}
|
||||
if (source->default_color_attribute) {
|
||||
MEM_SAFE_FREE(target->default_color_attribute);
|
||||
target->default_color_attribute = BLI_strdup(source->default_color_attribute);
|
||||
}
|
||||
|
||||
MEM_SAFE_FREE(source_lmap);
|
||||
MEM_SAFE_FREE(source_lmap_mem);
|
||||
MEM_SAFE_FREE(target_lmap);
|
||||
|
|
Loading…
Reference in New Issue