Fix T70102: Mask Extract bad solution

Reviewed By: brecht

Maniphest Tasks: T70102

Differential Revision: https://developer.blender.org/D5978
This commit is contained in:
Pablo Dobarro 2019-10-03 01:32:32 +02:00
parent 11768d1c9f
commit 8a1f4fc8a7
Notes: blender-bot 2023-02-14 00:44:03 +01:00
Referenced by issue #70102, Mask Extract bad solution
1 changed files with 5 additions and 3 deletions

View File

@ -105,12 +105,14 @@ static int paint_mask_extract_exec(bContext *C, wmOperator *op)
float mask_threshold = RNA_float_get(op->ptr, "mask_threshold");
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
bool delete_face = false;
bool keep_face = true;
BM_ITER_ELEM (v, &face_iter, f, BM_VERTS_OF_FACE) {
float mask = BM_elem_float_data_get(&bm->vdata, v, CD_PAINT_MASK);
delete_face = mask < mask_threshold;
if (mask < mask_threshold) {
keep_face = false;
}
}
BM_elem_flag_set(f, BM_ELEM_TAG, delete_face);
BM_elem_flag_set(f, BM_ELEM_TAG, !keep_face);
}
BM_mesh_delete_hflag_context(bm, BM_ELEM_TAG, DEL_FACES);