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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user