Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-03-16 19:52:51 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-03-16 19:53:03 +0300
commite42f61dda8b635511f083c09ccda5db9d28ec172 (patch)
treec29908e127f9fba42130bd8cbddf368eb60acf1d /source/blender/editors/mesh/editmesh_mask_extract.c
parentbab0fd13087e74709d6bfb2872f9e3ed95f99748 (diff)
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
Diffstat (limited to 'source/blender/editors/mesh/editmesh_mask_extract.c')
-rw-r--r--source/blender/editors/mesh/editmesh_mask_extract.c5
1 files changed, 5 insertions, 0 deletions
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);
}