diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-06 16:05:55 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-09 21:25:38 +0300 |
commit | 6eb76f64304235bd91e7a226019da5424e0b28d3 (patch) | |
tree | 3789fa5b3aacaa3e152ea75dc508ebfef4807de4 /source | |
parent | a540d16ee82e6c91d76fdfea8c0b90b922ece4d9 (diff) |
Fix T74492: Reset Face Set data when cancelling the expand operator
The operator was resetting the mask data when cancelling instead of the
face set data, so it was crashing because mask data was not available
when starting the operator in expand face set mode.
Reviewed By: brecht
Maniphest Tasks: T74492
Differential Revision: https://developer.blender.org/D7043
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 0fb5897628f..443aaef85c5 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -9687,22 +9687,32 @@ static void sculpt_mask_expand_cancel(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; + const bool create_face_set = RNA_boolean_get(op->ptr, "create_face_set"); MEM_freeN(op->customdata); for (int n = 0; n < ss->filter_cache->totnode; n++) { PBVHNode *node = ss->filter_cache->nodes[n]; - PBVHVertexIter vd; - BKE_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE) - { - *vd.mask = ss->filter_cache->prev_mask[vd.index]; + if (create_face_set) { + for (int i = 0; i < ss->totpoly; i++) { + ss->face_sets[i] = ss->filter_cache->prev_face_set[i]; + } + } + else { + PBVHVertexIter vd; + BKE_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE) + { + *vd.mask = ss->filter_cache->prev_mask[vd.index]; + } + BKE_pbvh_vertex_iter_end; } - BKE_pbvh_vertex_iter_end; BKE_pbvh_node_mark_redraw(node); } - sculpt_flush_update_step(C, SCULPT_UPDATE_MASK); + if (!create_face_set) { + sculpt_flush_update_step(C, SCULPT_UPDATE_MASK); + } sculpt_filter_cache_free(ss); SCULPT_undo_push_end(); sculpt_flush_update_done(C, ob, SCULPT_UPDATE_MASK); |