Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_mask_expand.c
| Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | for (int n = 0; n < ss->filter_cache->totnode; n++) { | ||||
| BKE_pbvh_node_mark_redraw(node); | BKE_pbvh_node_mark_redraw(node); | ||||
| } | } | ||||
| if (!create_face_set) { | if (!create_face_set) { | ||||
| SCULPT_flush_update_step(C, SCULPT_UPDATE_MASK); | SCULPT_flush_update_step(C, SCULPT_UPDATE_MASK); | ||||
| } | } | ||||
| SCULPT_filter_cache_free(ss); | SCULPT_filter_cache_free(ss); | ||||
| SCULPT_undo_push_end(); | SCULPT_undo_push_end(C); | ||||
| SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_MASK); | SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_MASK); | ||||
| ED_workspace_status_text(C, NULL); | ED_workspace_status_text(C, NULL); | ||||
| } | } | ||||
| static void sculpt_expand_task_cb(void *__restrict userdata, | static void sculpt_expand_task_cb(void *__restrict userdata, | ||||
| const int i, | const int i, | ||||
| const TaskParallelTLS *__restrict UNUSED(tls)) | const TaskParallelTLS *__restrict UNUSED(tls)) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | if ((event->type == LEFTMOUSE && event->val == KM_RELEASE) || | ||||
| MEM_freeN(op->customdata); | MEM_freeN(op->customdata); | ||||
| for (int i = 0; i < ss->filter_cache->totnode; i++) { | for (int i = 0; i < ss->filter_cache->totnode; i++) { | ||||
| BKE_pbvh_node_mark_redraw(ss->filter_cache->nodes[i]); | BKE_pbvh_node_mark_redraw(ss->filter_cache->nodes[i]); | ||||
| } | } | ||||
| SCULPT_filter_cache_free(ss); | SCULPT_filter_cache_free(ss); | ||||
| SCULPT_undo_push_end(); | SCULPT_undo_push_end(C); | ||||
| SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_MASK); | SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_MASK); | ||||
| ED_workspace_status_text(C, NULL); | ED_workspace_status_text(C, NULL); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| /* When pressing Ctrl, expand directly to the max number of iterations. This allows to flood fill | /* When pressing Ctrl, expand directly to the max number of iterations. This allows to flood fill | ||||
| * mask and face sets by connectivity directly. */ | * mask and face sets by connectivity directly. */ | ||||
| if (event->ctrl) { | if (event->ctrl) { | ||||
| ▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | static int sculpt_mask_expand_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); | BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); | ||||
| int vertex_count = SCULPT_vertex_count_get(ss); | int vertex_count = SCULPT_vertex_count_get(ss); | ||||
| ss->filter_cache = MEM_callocN(sizeof(FilterCache), "filter cache"); | ss->filter_cache = MEM_callocN(sizeof(FilterCache), "filter cache"); | ||||
| BKE_pbvh_search_gather(pbvh, NULL, NULL, &ss->filter_cache->nodes, &ss->filter_cache->totnode); | BKE_pbvh_search_gather(pbvh, NULL, NULL, &ss->filter_cache->nodes, &ss->filter_cache->totnode); | ||||
| SCULPT_undo_push_begin("Mask Expand"); | SCULPT_undo_push_begin(C, "Mask Expand"); | ||||
| if (create_face_set) { | if (create_face_set) { | ||||
| SCULPT_undo_push_node(ob, ss->filter_cache->nodes[0], SCULPT_UNDO_FACE_SETS); | SCULPT_undo_push_node(ob, ss->filter_cache->nodes[0], SCULPT_UNDO_FACE_SETS); | ||||
| for (int i = 0; i < ss->filter_cache->totnode; i++) { | for (int i = 0; i < ss->filter_cache->totnode; i++) { | ||||
| BKE_pbvh_node_mark_redraw(ss->filter_cache->nodes[i]); | BKE_pbvh_node_mark_redraw(ss->filter_cache->nodes[i]); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| ▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines | |||||