Commit: e42f61dda8b635511f083c09ccda5db9d28ec172
Author: Pablo Dobarro
Date:   Mon Mar 16 17:52:51 2020 +0100
Branches: master
https://developer.blender.org/rBe42f61dda8b635511f083c09ccda5db9d28ec172

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

===================================================================

M       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);
   }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to