From e42f61dda8b635511f083c09ccda5db9d28ec172 Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Mon, 16 Mar 2020 17:52:51 +0100 Subject: Fix incorrect Face Sets when using mask extract Mask extract modifies the topology when adding the boundary loop, so previous face sets may not be correct in the new mesh. Remove the face sets datalayer and let sculpt mode rebuild it when entering sculpt mode in the new object. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D7129 --- source/blender/editors/mesh/editmesh_mask_extract.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/editors/mesh/editmesh_mask_extract.c') diff --git a/source/blender/editors/mesh/editmesh_mask_extract.c b/source/blender/editors/mesh/editmesh_mask_extract.c index a1c8aab9bec..cd91aa1e491 100644 --- a/source/blender/editors/mesh/editmesh_mask_extract.c +++ b/source/blender/editors/mesh/editmesh_mask_extract.c @@ -212,6 +212,11 @@ static int paint_mask_extract_exec(bContext *C, wmOperator *op) Object *new_ob = ED_object_add_type(C, OB_MESH, NULL, ob->loc, ob->rot, false, local_view_bits); BKE_mesh_nomain_to_mesh(new_mesh, new_ob->data, new_ob, &CD_MASK_EVERYTHING, true); + /* Remove the Face Sets as they need to be recreated when entering Sculpt Mode in the new object. + * TODO(pablodobarro): In the future we can try to preserve them from the original mesh. */ + Mesh *new_ob_mesh = new_ob->data; + CustomData_free_layers(&new_ob_mesh->pdata, CD_SCULPT_FACE_SETS, new_ob_mesh->totpoly); + if (RNA_boolean_get(op->ptr, "apply_shrinkwrap")) { BKE_shrinkwrap_mesh_nearest_surface_deform(C, new_ob, ob); } -- cgit v1.2.3